Skip to content

Commit 9039837

Browse files
committed
Redo InitPreprocessor.cpp changes without formatting changes
1 parent a3acbd0 commit 9039837

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

clang/lib/Frontend/InitPreprocessor.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
865865
const LangOptions &LangOpts,
866866
const FrontendOptions &FEOpts,
867867
const PreprocessorOptions &PPOpts,
868+
const CodeGenOptions &CGOpts,
868869
MacroBuilder &Builder) {
869870
// Compiler version introspection macros.
870871
Builder.defineMacro("__llvm__"); // LLVM Backend
@@ -1073,9 +1074,9 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
10731074
Builder.defineMacro("__clang_wide_literal_encoding__", "\"UTF-16\"");
10741075
}
10751076

1076-
if (LangOpts.Optimize)
1077+
if (CGOpts.OptimizationLevel != 0)
10771078
Builder.defineMacro("__OPTIMIZE__");
1078-
if (LangOpts.OptimizeSize)
1079+
if (CGOpts.OptimizeSize != 0)
10791080
Builder.defineMacro("__OPTIMIZE_SIZE__");
10801081

10811082
if (LangOpts.FastMath)
@@ -1396,7 +1397,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
13961397
if (LangOpts.GNUCVersion)
13971398
addLockFreeMacros("__GCC_ATOMIC_");
13981399

1399-
if (LangOpts.NoInlineDefine)
1400+
if (CGOpts.getInlining() == CodeGenOptions::OnlyAlwaysInlining)
14001401
Builder.defineMacro("__NO_INLINE__");
14011402

14021403
if (unsigned PICLevel = LangOpts.PICLevel) {
@@ -1556,8 +1557,7 @@ static void InitializePGOProfileMacros(const CodeGenOptions &CodeGenOpts,
15561557
void clang::InitializePreprocessor(Preprocessor &PP,
15571558
const PreprocessorOptions &InitOpts,
15581559
const PCHContainerReader &PCHContainerRdr,
1559-
const FrontendOptions &FEOpts,
1560-
const CodeGenOptions &CodeGenOpts) {
1560+
const FrontendOptions &FEOpts) {
15611561
const LangOptions &LangOpts = PP.getLangOpts();
15621562
std::string PredefineBuffer;
15631563
PredefineBuffer.reserve(4080);
@@ -1575,10 +1575,12 @@ void clang::InitializePreprocessor(Preprocessor &PP,
15751575
// macros. This is not the right way to handle this.
15761576
if ((LangOpts.CUDA || LangOpts.isTargetDevice()) && PP.getAuxTargetInfo())
15771577
InitializePredefinedMacros(*PP.getAuxTargetInfo(), LangOpts, FEOpts,
1578-
PP.getPreprocessorOpts(), Builder);
1578+
PP.getPreprocessorOpts(), PP.getCodeGenOpts(),
1579+
Builder);
15791580

15801581
InitializePredefinedMacros(PP.getTargetInfo(), LangOpts, FEOpts,
1581-
PP.getPreprocessorOpts(), Builder);
1582+
PP.getPreprocessorOpts(), PP.getCodeGenOpts(),
1583+
Builder);
15821584

15831585
// Install definitions to make Objective-C++ ARC work well with various
15841586
// C++ Standard Library implementations.
@@ -1605,7 +1607,7 @@ void clang::InitializePreprocessor(Preprocessor &PP,
16051607
// The PGO instrumentation profile macros are driven by options
16061608
// -fprofile[-instr]-generate/-fcs-profile-generate/-fprofile[-instr]-use,
16071609
// hence they are not guarded by InitOpts.UsePredefines.
1608-
InitializePGOProfileMacros(CodeGenOpts, Builder);
1610+
InitializePGOProfileMacros(PP.getCodeGenOpts(), Builder);
16091611

16101612
// Add on the predefines from the driver. Wrap in a #line directive to report
16111613
// that they come from the command line.

0 commit comments

Comments
 (0)