Skip to content

Commit 9099d6f

Browse files
committed
[Review] Disable macro expansion in BeginSourceFileAction
1 parent 09c37ac commit 9099d6f

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
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 & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,12 +1559,6 @@ void clang::InitializePreprocessor(Preprocessor &PP,
15591559
const FrontendOptions &FEOpts,
15601560
const CodeGenOptions &CodeGenOpts) {
15611561

1562-
if (all_of(FEOpts.Inputs,
1563-
[](const FrontendInputFile &FI) { return FI.isPreprocessed(); })) {
1564-
PP.SetDisableMacroExpansion();
1565-
return;
1566-
}
1567-
15681562
const LangOptions &LangOpts = PP.getLangOpts();
15691563
std::string PredefineBuffer;
15701564
PredefineBuffer.reserve(4080);

0 commit comments

Comments
 (0)