Re: [PATCH] Don't crash when dumping objc_bridge_related attributes

2015-11-30 Thread Aaron Ballman via cfe-commits
On Thu, Nov 26, 2015 at 12:00 PM, Joe Ranieri  wrote:
> On Thu, Nov 26, 2015 at 11:29 AM, Aaron Ballman  
> wrote:
>> On Wed, Nov 25, 2015 at 6:13 PM, Joe Ranieri  wrote:
>>> Clang's AST dumping currently crashes when dumping objc_bridge_related
>>> attributes where the class method and instance method fields are left
>>> empty. The attached patch marks the two arguments as optional and
>>> updates TableGen to understand the optional flag for identifier
>>> attribute arguments when generating the dump function.
>>
>> LGTM, thank you! Do you have commit privileges, or would you like me
>> to commit on your behalf?
>>
>> ~Aaron
>
> Please commit on my behalf.

Thanks! I've commit in r254303

~Aaron
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] Don't crash when dumping objc_bridge_related attributes

2015-11-26 Thread Aaron Ballman via cfe-commits
On Wed, Nov 25, 2015 at 6:13 PM, Joe Ranieri  wrote:
> Clang's AST dumping currently crashes when dumping objc_bridge_related
> attributes where the class method and instance method fields are left
> empty. The attached patch marks the two arguments as optional and
> updates TableGen to understand the optional flag for identifier
> attribute arguments when generating the dump function.

LGTM, thank you! Do you have commit privileges, or would you like me
to commit on your behalf?

~Aaron
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] Don't crash when dumping objc_bridge_related attributes

2015-11-26 Thread Joe Ranieri via cfe-commits
On Thu, Nov 26, 2015 at 11:29 AM, Aaron Ballman  wrote:
> On Wed, Nov 25, 2015 at 6:13 PM, Joe Ranieri  wrote:
>> Clang's AST dumping currently crashes when dumping objc_bridge_related
>> attributes where the class method and instance method fields are left
>> empty. The attached patch marks the two arguments as optional and
>> updates TableGen to understand the optional flag for identifier
>> attribute arguments when generating the dump function.
>
> LGTM, thank you! Do you have commit privileges, or would you like me
> to commit on your behalf?
>
> ~Aaron

Please commit on my behalf.

-- Joe Ranieri
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] Don't crash when dumping objc_bridge_related attributes

2015-11-25 Thread Joe Ranieri via cfe-commits
Clang's AST dumping currently crashes when dumping objc_bridge_related
attributes where the class method and instance method fields are left
empty. The attached patch marks the two arguments as optional and
updates TableGen to understand the optional flag for identifier
attribute arguments when generating the dump function.

-- Joe Ranieri
Index: include/clang/Basic/Attr.td
===
--- include/clang/Basic/Attr.td (revision 254076)
+++ include/clang/Basic/Attr.td (working copy)
@@ -1071,8 +1071,8 @@
   let Spellings = [GNU<"objc_bridge_related">];
   let Subjects = SubjectList<[Record], ErrorDiag>;
   let Args = [IdentifierArgument<"RelatedClass">,
-  IdentifierArgument<"ClassMethod">,
-  IdentifierArgument<"InstanceMethod">];
+  IdentifierArgument<"ClassMethod", 1>,
+  IdentifierArgument<"InstanceMethod", 1>];
   let HasCustomParsing = 1;
   let Documentation = [Undocumented];
 }
Index: test/Misc/ast-dump-attr.cpp
===
--- test/Misc/ast-dump-attr.cpp (revision 254076)
+++ test/Misc/ast-dump-attr.cpp (working copy)
@@ -150,3 +150,7 @@
   // CHECK: DeprecatedAttr
 }
 }
+
+struct __attribute__((objc_bridge_related(NSParagraphStyle,,))) TestBridgedRef;
+// CHECK: CXXRecordDecl{{.*}} struct TestBridgedRef
+// CHECK-NEXT: ObjCBridgeRelatedAttr{{.*}} NSParagraphStyle
Index: utils/TableGen/ClangAttrEmitter.cpp
===
--- utils/TableGen/ClangAttrEmitter.cpp (revision 254076)
+++ utils/TableGen/ClangAttrEmitter.cpp (working copy)
@@ -279,6 +279,8 @@
 OS << "OS << \" \";\n";
 OS << "dumpBareDeclRef(SA->get" << getUpperName() << "());\n"; 
   } else if (type == "IdentifierInfo *") {
+if (isOptional())
+  OS << "if (SA->get" << getUpperName() << "())\n  ";
 OS << "OS << \" \" << SA->get" << getUpperName()
<< "()->getName();\n";
   } else if (type == "TypeSourceInfo *") {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits