[cfe-commits] r68520 - /cfe/trunk/lib/Basic/Targets.cpp

Chris Lattner sabre at nondot.org
Tue Apr 7 09:50:55 PDT 2009


Author: lattner
Date: Tue Apr  7 11:50:40 2009
New Revision: 68520

URL: http://llvm.org/viewvc/llvm-project?rev=68520&view=rev
Log:
Fariborz points out that weak is now defined to the attribute even
in C mode.

Modified:
    cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=68520&r1=68519&r2=68520&view=diff

==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Tue Apr  7 11:50:40 2009
@@ -144,14 +144,14 @@
   Define(Defs, "__MACH__");
   Define(Defs, "OBJC_NEW_PROPERTIES");
   
-  // Darwin defines __weak and __strong even in C mode.
-  if (!Opts.ObjC1 || Opts.getGCMode() == LangOptions::NonGC) {
-    Define(Defs, "__weak", "");
+  // __weak is always defined, for use in blocks and with objc pointers.
+  Define(Defs, "__weak", "__attribute__((objc_gc(weak)))");
+  
+  // Darwin defines __strong even in C mode (just to nothing).
+  if (!Opts.ObjC1 || Opts.getGCMode() == LangOptions::NonGC)
     Define(Defs, "__strong", "");
-  } else {
-    Define(Defs, "__weak", "__attribute__((objc_gc(weak)))");
+  else
     Define(Defs, "__strong", "__attribute__((objc_gc(strong)))");
-  }
   
   // FIXME: OBJC_ZEROCOST_EXCEPTIONS when using zero cost eh.
   





More information about the cfe-commits mailing list