[cfe-commits] r101149 - in /cfe/trunk: lib/Frontend/RewriteObjC.cpp test/Rewriter/rewrite-super-message.mm

Chris Lattner sabre at nondot.org
Tue Apr 13 10:33:56 PDT 2010


Author: lattner
Date: Tue Apr 13 12:33:56 2010
New Revision: 101149

URL: http://llvm.org/viewvc/llvm-project?rev=101149&view=rev
Log:
make the rewriter add a #ifndef around the #define of __attribute__.
Without it, there is no reason for a compiler that supports it to
emit the dead static globals that the rewriter labels attribute(used).

Modified:
    cfe/trunk/lib/Frontend/RewriteObjC.cpp
    cfe/trunk/test/Rewriter/rewrite-super-message.mm

Modified: cfe/trunk/lib/Frontend/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/RewriteObjC.cpp?rev=101149&r1=101148&r2=101149&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/RewriteObjC.cpp Tue Apr 13 12:33:56 2010
@@ -640,7 +640,9 @@
   if (LangOpts.Microsoft) {
     Preamble += "#undef __OBJC_RW_DLLIMPORT\n";
     Preamble += "#undef __OBJC_RW_STATICIMPORT\n";
+    Preamble += "#ifndef KEEP_ATTRIBUTES\n";  // We use this for clang tests.
     Preamble += "#define __attribute__(X)\n";
+    Preamble += "#endif\n";
     Preamble += "#define __weak\n";
   }
   else {

Modified: cfe/trunk/test/Rewriter/rewrite-super-message.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/rewrite-super-message.mm?rev=101149&r1=101148&r2=101149&view=diff
==============================================================================
--- cfe/trunk/test/Rewriter/rewrite-super-message.mm (original)
+++ cfe/trunk/test/Rewriter/rewrite-super-message.mm Tue Apr 13 12:33:56 2010
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
-// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"id=struct objc_object *" -D"Class=struct objc_class *" -D"SEL=void*" -D"__declspec(X)=" -emit-llvm -o - %t-rw.cpp | FileCheck %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -DKEEP_ATTRIBUTES -D"id=struct objc_object *" -D"Class=struct objc_class *" -D"SEL=void*" -D"__declspec(X)=" -emit-llvm -o - %t-rw.cpp | FileCheck %t-rw.cpp
 // radar 7738453
 
 void *sel_registerName(const char *);





More information about the cfe-commits mailing list