diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2008-08-12 00:21:46 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2008-08-12 00:21:46 +0000 |
| commit | 2258aa0f270b5dc01d3117c669ea68fb1399a186 (patch) | |
| tree | e3126d9d4896973618051074dbbe6d98452c510a | |
| parent | 8b8683f9f6051c6854f6e9a044d3d882649f72fd (diff) | |
| download | bcm5719-llvm-2258aa0f270b5dc01d3117c669ea68fb1399a186.tar.gz bcm5719-llvm-2258aa0f270b5dc01d3117c669ea68fb1399a186.zip | |
Move some ObjC preprocessor definitions into
InitializePredefinedMacros().
- Also now properly wired to -fobjc-gc, -fnext-runtime.
llvm-svn: 54661
| -rw-r--r-- | clang/lib/Basic/Targets.cpp | 24 | ||||
| -rw-r--r-- | clang/lib/Lex/Preprocessor.cpp | 19 |
2 files changed, 18 insertions, 25 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index bc35d7fe8e7..d4ec04835c6 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -53,23 +53,8 @@ public: 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 @@ public: 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__"); - } } }; diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index dcb399d1fa3..a4ff8bb7348 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -401,8 +401,25 @@ static void InitializePredefinedMacros(Preprocessor &PP, 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"); |

