diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-04-08 03:03:23 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-04-08 03:03:23 +0000 |
commit | 9fd0b1f845a61e71dd8099f596532d34c519630a (patch) | |
tree | 1600a934dda899a76b58bebccb7b1aa91cf016a2 /lib/Lex/Preprocessor.cpp | |
parent | a17d7ccc2ed77e321855990e180f2a34ec304bfc (diff) |
Set __PIC__ (more) correctly.
- Add -pic-level clang-cc option to specify the value for the define,
updated driver to pass this.
- Added __pic__
- Added OBJC_ZEROCOST_EXCEPTIONS define while I was here (to match gcc).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68584 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Preprocessor.cpp')
-rw-r--r-- | lib/Lex/Preprocessor.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index 139f310e7d..d3d5b8c3fd 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -497,8 +497,10 @@ static void InitializePredefinedMacros(Preprocessor &PP, if (PP.getLangOptions().ObjC1) { DefineBuiltinMacro(Buf, "__OBJC__=1"); - if (PP.getLangOptions().ObjCNonFragileABI) + if (PP.getLangOptions().ObjCNonFragileABI) { DefineBuiltinMacro(Buf, "__OBJC2__=1"); + DefineBuiltinMacro(Buf, "OBJC_ZEROCOST_EXCEPTIONS=1"); + } if (PP.getLangOptions().getGCMode() != LangOptions::NonGC) DefineBuiltinMacro(Buf, "__OBJC_GC__=1"); @@ -629,7 +631,14 @@ static void InitializePredefinedMacros(Preprocessor &PP, DefineBuiltinMacro(Buf, "__DYNAMIC__=1"); DefineBuiltinMacro(Buf, "__FINITE_MATH_ONLY__=0"); DefineBuiltinMacro(Buf, "__NO_INLINE__=1"); - DefineBuiltinMacro(Buf, "__PIC__=1"); + + if (unsigned PICLevel = PP.getLangOptions().PICLevel) { + sprintf(MacroBuf, "__PIC__=%d", PICLevel); + DefineBuiltinMacro(Buf, MacroBuf); + + sprintf(MacroBuf, "__pic__=%d", PICLevel); + DefineBuiltinMacro(Buf, MacroBuf); + } // Macros to control C99 numerics and <float.h> DefineBuiltinMacro(Buf, "__FLT_EVAL_METHOD__=0"); |