provided before trying to print it.
This fixes a segfault that occurs when function printPretty generated by
tablegen tries to print an optional argument of attribute
objc_bridge_related.
rdar://problem/
28155469
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281132
91177308-0d34-0410-b5e6-
96231b3b80d8
// CHECK: }
// CHECK: @end
+
+@class C1;
+struct __attribute__((objc_bridge_related(C1,,))) S1;
+
+// CHECK: @class C1;
+// CHECK: struct __attribute__((objc_bridge_related(C1, , ))) S1;
OS << "\" << get" << getUpperName()
<< "()->getNameInfo().getAsString() << \"";
} else if (type == "IdentifierInfo *") {
- OS << "\" << get" << getUpperName() << "()->getName() << \"";
+ OS << "\";\n";
+ if (isOptional())
+ OS << " if (get" << getUpperName() << "()) ";
+ else
+ OS << " ";
+ OS << "OS << get" << getUpperName() << "()->getName();\n";
+ OS << " OS << \"";
} else if (type == "TypeSourceInfo *") {
OS << "\" << get" << getUpperName() << "().getAsString() << \"";
} else {