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 | fba5cb12adbe95d79855e91db018b863ce48387e (patch) | |
tree | 5f9130da4710f88979d36ee5520d5a9326add574 /lib/Lex/Preprocessor.cpp | |
parent | bbce49b9e5c6d7f05926b89f8e6fd235ae01c250 (diff) |
Move some ObjC preprocessor definitions into
InitializePredefinedMacros().
- Also now properly wired to -fobjc-gc, -fnext-runtime.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54661 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Preprocessor.cpp')
-rw-r--r-- | lib/Lex/Preprocessor.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index dcb399d1fa..a4ff8bb734 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/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"); |