From 4ca076fffdfa72ebfab364c8de091b89fc291ae6 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Mon, 6 Apr 2009 17:37:10 +0000 Subject: 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 --- lib/Lex/Preprocessor.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/Lex/Preprocessor.cpp') 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(); -- cgit v1.2.3