@@ -865,6 +865,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
865
865
const LangOptions &LangOpts,
866
866
const FrontendOptions &FEOpts,
867
867
const PreprocessorOptions &PPOpts,
868
+ const CodeGenOptions &CGOpts,
868
869
MacroBuilder &Builder) {
869
870
// Compiler version introspection macros.
870
871
Builder.defineMacro (" __llvm__" ); // LLVM Backend
@@ -1073,9 +1074,9 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
1073
1074
Builder.defineMacro (" __clang_wide_literal_encoding__" , " \" UTF-16\" " );
1074
1075
}
1075
1076
1076
- if (LangOpts. Optimize )
1077
+ if (CGOpts. OptimizationLevel != 0 )
1077
1078
Builder.defineMacro (" __OPTIMIZE__" );
1078
- if (LangOpts .OptimizeSize )
1079
+ if (CGOpts .OptimizeSize != 0 )
1079
1080
Builder.defineMacro (" __OPTIMIZE_SIZE__" );
1080
1081
1081
1082
if (LangOpts.FastMath )
@@ -1396,7 +1397,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
1396
1397
if (LangOpts.GNUCVersion )
1397
1398
addLockFreeMacros (" __GCC_ATOMIC_" );
1398
1399
1399
- if (LangOpts. NoInlineDefine )
1400
+ if (CGOpts. getInlining () == CodeGenOptions::OnlyAlwaysInlining )
1400
1401
Builder.defineMacro (" __NO_INLINE__" );
1401
1402
1402
1403
if (unsigned PICLevel = LangOpts.PICLevel ) {
@@ -1556,8 +1557,7 @@ static void InitializePGOProfileMacros(const CodeGenOptions &CodeGenOpts,
1556
1557
void clang::InitializePreprocessor (Preprocessor &PP,
1557
1558
const PreprocessorOptions &InitOpts,
1558
1559
const PCHContainerReader &PCHContainerRdr,
1559
- const FrontendOptions &FEOpts,
1560
- const CodeGenOptions &CodeGenOpts) {
1560
+ const FrontendOptions &FEOpts) {
1561
1561
const LangOptions &LangOpts = PP.getLangOpts ();
1562
1562
std::string PredefineBuffer;
1563
1563
PredefineBuffer.reserve (4080 );
@@ -1575,10 +1575,12 @@ void clang::InitializePreprocessor(Preprocessor &PP,
1575
1575
// macros. This is not the right way to handle this.
1576
1576
if ((LangOpts.CUDA || LangOpts.isTargetDevice ()) && PP.getAuxTargetInfo ())
1577
1577
InitializePredefinedMacros (*PP.getAuxTargetInfo (), LangOpts, FEOpts,
1578
- PP.getPreprocessorOpts (), Builder);
1578
+ PP.getPreprocessorOpts (), PP.getCodeGenOpts (),
1579
+ Builder);
1579
1580
1580
1581
InitializePredefinedMacros (PP.getTargetInfo (), LangOpts, FEOpts,
1581
- PP.getPreprocessorOpts (), Builder);
1582
+ PP.getPreprocessorOpts (), PP.getCodeGenOpts (),
1583
+ Builder);
1582
1584
1583
1585
// Install definitions to make Objective-C++ ARC work well with various
1584
1586
// C++ Standard Library implementations.
@@ -1605,7 +1607,7 @@ void clang::InitializePreprocessor(Preprocessor &PP,
1605
1607
// The PGO instrumentation profile macros are driven by options
1606
1608
// -fprofile[-instr]-generate/-fcs-profile-generate/-fprofile[-instr]-use,
1607
1609
// hence they are not guarded by InitOpts.UsePredefines.
1608
- InitializePGOProfileMacros (CodeGenOpts , Builder);
1610
+ InitializePGOProfileMacros (PP. getCodeGenOpts () , Builder);
1609
1611
1610
1612
// Add on the predefines from the driver. Wrap in a #line directive to report
1611
1613
// that they come from the command line.
0 commit comments