Do not crash when dumping the objc_bridge_related attribute when its optional arguments are not supplied.

Patch thanks to Joe Ranieri!

llvm-svn: 254303
This commit is contained in:
Aaron Ballman 2015-11-30 15:25:34 +00:00
parent 33c95f08b0
commit 415c414bf2
3 changed files with 8 additions and 2 deletions

View File

@ -1087,8 +1087,8 @@ def ObjCBridgeRelated : InheritableAttr {
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];
}

View File

@ -150,3 +150,7 @@ void f() {
// CHECK: DeprecatedAttr
}
}
struct __attribute__((objc_bridge_related(NSParagraphStyle,,))) TestBridgedRef;
// CHECK: CXXRecordDecl{{.*}} struct TestBridgedRef
// CHECK-NEXT: ObjCBridgeRelatedAttr{{.*}} NSParagraphStyle

View File

@ -279,6 +279,8 @@ namespace {
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 *") {