[cfe-commits] r51163 - in /cfe/trunk: Driver/RewriteObjC.cpp lib/Lex/Preprocessor.cpp

Steve Naroff snaroff at apple.com
Thu May 15 14:12:10 PDT 2008


Author: snaroff
Date: Thu May 15 16:12:10 2008
New Revision: 51163

URL: http://llvm.org/viewvc/llvm-project?rev=51163&view=rev
Log:
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).

Modified:
    cfe/trunk/Driver/RewriteObjC.cpp
    cfe/trunk/lib/Lex/Preprocessor.cpp

Modified: cfe/trunk/Driver/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteObjC.cpp?rev=51163&r1=51162&r2=51163&view=diff

==============================================================================
--- cfe/trunk/Driver/RewriteObjC.cpp (original)
+++ cfe/trunk/Driver/RewriteObjC.cpp Thu May 15 16:12:10 2008
@@ -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";
+  }
 }
 
 

Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=51163&r1=51162&r2=51163&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/lib/Lex/Preprocessor.cpp Thu May 15 16:12:10 2008
@@ -402,6 +402,8 @@
   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.
   {





More information about the cfe-commits mailing list