[cfe-commits] r54661 - in /cfe/trunk/lib: Basic/Targets.cpp Lex/Preprocessor.cpp
Daniel Dunbar
daniel at zuster.org
Mon Aug 11 17:21:47 PDT 2008
Author: ddunbar
Date: Mon Aug 11 19:21:46 2008
New Revision: 54661
URL: http://llvm.org/viewvc/llvm-project?rev=54661&view=rev
Log:
Move some ObjC preprocessor definitions into
InitializePredefinedMacros().
- Also now properly wired to -fobjc-gc, -fnext-runtime.
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Lex/Preprocessor.cpp
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=54661&r1=54660&r2=54661&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Aug 11 19:21:46 2008
@@ -53,23 +53,8 @@
Define(Defs, "linux");
#endif
- if (1) { // FIXME: -fobjc-gc controls this.
- Define(Defs, "__weak", "");
- Define(Defs, "__strong", "");
- } else {
- Define(Defs, "__weak", "__attribute__((objc_gc(weak)))");
- Define(Defs, "__strong", "__attribute__((objc_gc(strong)))");
- Define(Defs, "__OBJC_GC__");
- }
-
- // darwin_constant_cfstrings controls this.
- Define(Defs, "__CONSTANT_CFSTRINGS__");
-
if (0) // darwin_pascal_strings
Define(Defs, "__PASCAL_STRINGS__");
-
- if (0) // FIXME: -fnext-runtime controls this
- Define(Defs, "__NEXT_RUNTIME__");
}
};
@@ -86,15 +71,6 @@
Define(Defs, "__SUN__");
Define(Defs, "__SOLARIS__");
#endif
-
- if (1) {// -fobjc-gc controls this.
- Define(Defs, "__weak", "");
- Define(Defs, "__strong", "");
- } else {
- Define(Defs, "__weak", "__attribute__((objc_gc(weak)))");
- Define(Defs, "__strong", "__attribute__((objc_gc(strong)))");
- Define(Defs, "__OBJC_GC__");
- }
}
};
Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=54661&r1=54660&r2=54661&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/lib/Lex/Preprocessor.cpp Mon Aug 11 19:21:46 2008
@@ -401,8 +401,25 @@
DefineBuiltinMacro(Buf, "__STDC_VERSION__=199409L");
DefineBuiltinMacro(Buf, "__STDC_HOSTED__=1");
- if (PP.getLangOptions().ObjC1)
+ if (PP.getLangOptions().ObjC1) {
DefineBuiltinMacro(Buf, "__OBJC__=1");
+
+ if (PP.getLangOptions().getGCMode() == LangOptions::NonGC) {
+ DefineBuiltinMacro(Buf, "__weak=");
+ DefineBuiltinMacro(Buf, "__strong=");
+ } else {
+ DefineBuiltinMacro(Buf, "__weak=__attribute__((objc_gc(weak)))");
+ DefineBuiltinMacro(Buf, "__strong=__attribute__((objc_gc(strong)))");
+ DefineBuiltinMacro(Buf, "__OBJC_GC__=1");
+ }
+
+ if (PP.getLangOptions().NeXTRuntime)
+ DefineBuiltinMacro(Buf, "__NEXT_RUNTIME__=1");
+
+ // darwin_constant_cfstrings controls this. This is also dependent
+ // on other things like the runtime I believe.
+ DefineBuiltinMacro(Buf, "__CONSTANT_CFSTRINGS__=1");
+ }
if (PP.getLangOptions().ObjC2)
DefineBuiltinMacro(Buf, "OBJC_NEW_PROPERTIES");
More information about the cfe-commits
mailing list