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
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index a43bb64..9eaf140 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -547,6 +547,11 @@
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();