File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ class FrontendAction {
8585 // / EndSourceFileAction() will not be called.
8686 virtual bool BeginSourceFileAction (CompilerInstance &CI) {
8787 if (CurrentInput.isPreprocessed ())
88- CI.getPreprocessor ().SetDisableMacroExpansion ( );
88+ CI.getPreprocessor ().SetEnableMacroExpansion ( false );
8989 return true ;
9090 }
9191
@@ -100,7 +100,11 @@ class FrontendAction {
100100 // /
101101 // / This is guaranteed to only be called following a successful call to
102102 // / BeginSourceFileAction (and BeginSourceFile).
103- virtual void EndSourceFileAction () {}
103+ virtual void EndSourceFileAction () {
104+ if (CurrentInput.isPreprocessed ())
105+ // reset the preprocessor macro expansion to the default
106+ getCompilerInstance ().getPreprocessor ().SetEnableMacroExpansion (true );
107+ }
104108
105109 // / Callback at the end of processing a single input, to determine
106110 // / if the output files should be erased or not.
Original file line number Diff line number Diff line change @@ -1837,10 +1837,7 @@ class Preprocessor {
18371837 MacroExpansionInDirectivesOverride = true ;
18381838 }
18391839
1840- void SetDisableMacroExpansion () {
1841- DisableMacroExpansion = true ;
1842- MacroExpansionInDirectivesOverride = false ;
1843- }
1840+ void SetEnableMacroExpansion (bool Enable) { DisableMacroExpansion = !Enable; }
18441841
18451842 // / Peeks ahead N tokens and returns that token without consuming any
18461843 // / tokens.
You can’t perform that action at this time.
0 commit comments