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 {
85
85
// / EndSourceFileAction() will not be called.
86
86
virtual bool BeginSourceFileAction (CompilerInstance &CI) {
87
87
if (CurrentInput.isPreprocessed ())
88
- CI.getPreprocessor ().SetDisableMacroExpansion ( );
88
+ CI.getPreprocessor ().SetEnableMacroExpansion ( false );
89
89
return true ;
90
90
}
91
91
@@ -100,7 +100,11 @@ class FrontendAction {
100
100
// /
101
101
// / This is guaranteed to only be called following a successful call to
102
102
// / 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
+ }
104
108
105
109
// / Callback at the end of processing a single input, to determine
106
110
// / 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 {
1837
1837
MacroExpansionInDirectivesOverride = true ;
1838
1838
}
1839
1839
1840
- void SetDisableMacroExpansion () {
1841
- DisableMacroExpansion = true ;
1842
- MacroExpansionInDirectivesOverride = false ;
1843
- }
1840
+ void SetEnableMacroExpansion (bool Enable) { DisableMacroExpansion = !Enable; }
1844
1841
1845
1842
// / Peeks ahead N tokens and returns that token without consuming any
1846
1843
// / tokens.
You can’t perform that action at this time.
0 commit comments