forked from OSchip/llvm-project
Fix rewriter bug <rdar://problem/5929344> clang ObjC rewriter: "extern int __CFConstantStringClassReference[];" should be extern "C".
Have clang predefine OBJC_NEW_PROPERTIES (which is what gcc does). llvm-svn: 51163
This commit is contained in:
parent
6ef726a066
commit
ad91868aa6
|
@ -330,8 +330,6 @@ void RewriteObjC::Initialize(ASTContext &context) {
|
|||
Preamble += "__OBJC_RW_EXTERN int objc_exception_match";
|
||||
Preamble += "(struct objc_class *, struct objc_object *);\n";
|
||||
Preamble += "__OBJC_RW_EXTERN Protocol *objc_getProtocol(const char *);\n";
|
||||
if (LangOpts.Microsoft)
|
||||
Preamble += "#undef __OBJC_RW_EXTERN\n";
|
||||
Preamble += "#ifndef __FASTENUMERATIONSTATE\n";
|
||||
Preamble += "struct __objcFastEnumerationState {\n\t";
|
||||
Preamble += "unsigned long state;\n\t";
|
||||
|
@ -347,11 +345,13 @@ void RewriteObjC::Initialize(ASTContext &context) {
|
|||
Preamble += " char *str;\n";
|
||||
Preamble += " long length;\n";
|
||||
Preamble += "};\n";
|
||||
Preamble += "extern int __CFConstantStringClassReference[];\n";
|
||||
Preamble += "__OBJC_RW_EXTERN int __CFConstantStringClassReference[];\n";
|
||||
Preamble += "#define __NSCONSTANTSTRINGIMPL\n";
|
||||
Preamble += "#endif\n";
|
||||
if (LangOpts.Microsoft)
|
||||
if (LangOpts.Microsoft) {
|
||||
Preamble += "#undef __OBJC_RW_EXTERN\n";
|
||||
Preamble += "#define __attribute__(X)\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -402,6 +402,8 @@ static void InitializePredefinedMacros(Preprocessor &PP,
|
|||
DefineBuiltinMacro(Buf, "__STDC_HOSTED__=1");
|
||||
if (PP.getLangOptions().ObjC1)
|
||||
DefineBuiltinMacro(Buf, "__OBJC__=1");
|
||||
if (PP.getLangOptions().ObjC2)
|
||||
DefineBuiltinMacro(Buf, "OBJC_NEW_PROPERTIES");
|
||||
|
||||
// Add __builtin_va_list typedef.
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue