Skip to content

Commit 3149502

Browse files
committed
[Review] Disable macro expansion in BeginSourceFileAction
1 parent 75b7fd4 commit 3149502

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

clang/include/clang/Frontend/FrontendAction.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ class FrontendAction {
8484
/// \return True on success; on failure ExecutionAction() and
8585
/// EndSourceFileAction() will not be called.
8686
virtual bool BeginSourceFileAction(CompilerInstance &CI) {
87+
if (CurrentInput.isPreprocessed())
88+
CI.getPreprocessor().SetDisableMacroExpansion();
8789
return true;
8890
}
8991

clang/lib/Frontend/InitPreprocessor.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,13 +1558,6 @@ void clang::InitializePreprocessor(Preprocessor &PP,
15581558
const PCHContainerReader &PCHContainerRdr,
15591559
const FrontendOptions &FEOpts,
15601560
const CodeGenOptions &CodeGenOpts) {
1561-
1562-
if (all_of(FEOpts.Inputs,
1563-
[](const FrontendInputFile &FI) { return FI.isPreprocessed(); })) {
1564-
PP.SetDisableMacroExpansion();
1565-
return;
1566-
}
1567-
15681561
const LangOptions &LangOpts = PP.getLangOpts();
15691562
std::string PredefineBuffer;
15701563
PredefineBuffer.reserve(4080);

0 commit comments

Comments
 (0)