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).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51163 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/RewriteObjC.cpp b/Driver/RewriteObjC.cpp
index cf715d0..3f40e4a 100644
--- a/Driver/RewriteObjC.cpp
+++ b/Driver/RewriteObjC.cpp
@@ -330,8 +330,6 @@
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 @@
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";
+ }
}