Skip to content

Commit f447054

Browse files
committed
[Review] Disable macro expansion in BeginSourceFileAction
1 parent 776ecb2 commit f447054

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
@@ -1557,13 +1557,6 @@ void clang::InitializePreprocessor(Preprocessor &PP,
15571557
const PCHContainerReader &PCHContainerRdr,
15581558
const FrontendOptions &FEOpts,
15591559
const CodeGenOptions &CodeGenOpts) {
1560-
1561-
if (all_of(FEOpts.Inputs,
1562-
[](const FrontendInputFile &FI) { return FI.isPreprocessed(); })) {
1563-
PP.SetDisableMacroExpansion();
1564-
return;
1565-
}
1566-
15671560
const LangOptions &LangOpts = PP.getLangOpts();
15681561
std::string PredefineBuffer;
15691562
PredefineBuffer.reserve(4080);

0 commit comments

Comments
 (0)