aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-04-06 17:37:10 +0000
committerAnders Carlsson <andersca@mac.com>2009-04-06 17:37:10 +0000
commit4ca076fffdfa72ebfab364c8de091b89fc291ae6 (patch)
tree0dd4e233aad1da37a625e3a7c6e46c4dfc266e3d /lib/Lex/Preprocessor.cpp
parent50748f4362b334e4b88b1f8397bb2f63269a6bf1 (diff)
Define __OPTIMIZE__ and __OPTIMIZE_SIZE__ if the -O[12] and -Os flags are passed to the compiler.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68450 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Preprocessor.cpp')
-rw-r--r--lib/Lex/Preprocessor.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index a43bb6427e..9eaf1403a2 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -547,6 +547,11 @@ static void InitializePredefinedMacros(Preprocessor &PP,
DefineBuiltinMacro(Buf, "__int64=__INT64_TYPE__");
}
+ if (PP.getLangOptions().Optimize)
+ DefineBuiltinMacro(Buf, "__OPTIMIZE__=1");
+ if (PP.getLangOptions().OptimizeSize)
+ DefineBuiltinMacro(Buf, "__OPTIMIZE_SIZE__=1");
+
// Initialize target-specific preprocessor defines.
const TargetInfo &TI = PP.getTargetInfo();