diff options
author | Vassil Vassilev <v.g.vassilev@gmail.com> | 2019-07-04 19:06:52 +0000 |
---|---|---|
committer | Vassil Vassilev <v.g.vassilev@gmail.com> | 2019-07-04 19:06:52 +0000 |
commit | 16de81c1585049cec6b86214f8d99d0a6f0c6b80 (patch) | |
tree | fce3eb1c357d2f8c856a7d5e66cfcab0b93034bc /clang/lib/Lex/PPLexerChange.cpp | |
parent | 0ca6d390ba70e7ffdbcc34f3226de74fd4d4edc7 (diff) | |
download | bcm5719-llvm-16de81c1585049cec6b86214f8d99d0a6f0c6b80.tar.gz bcm5719-llvm-16de81c1585049cec6b86214f8d99d0a6f0c6b80.zip |
[modules] Add PP callbacks for entering and leaving a submodule.
llvm-svn: 365153
Diffstat (limited to 'clang/lib/Lex/PPLexerChange.cpp')
-rw-r--r-- | clang/lib/Lex/PPLexerChange.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Lex/PPLexerChange.cpp b/clang/lib/Lex/PPLexerChange.cpp index cfbb547fae3..7cce5f9c9fe 100644 --- a/clang/lib/Lex/PPLexerChange.cpp +++ b/clang/lib/Lex/PPLexerChange.cpp @@ -647,6 +647,8 @@ void Preprocessor::EnterSubmodule(Module *M, SourceLocation ImportLoc, BuildingSubmoduleStack.push_back( BuildingSubmoduleInfo(M, ImportLoc, ForPragma, CurSubmoduleState, PendingModuleMacroNames.size())); + if (Callbacks) + Callbacks->EnteredSubmodule(M, ImportLoc, ForPragma); return; } @@ -691,6 +693,9 @@ void Preprocessor::EnterSubmodule(Module *M, SourceLocation ImportLoc, BuildingSubmoduleInfo(M, ImportLoc, ForPragma, CurSubmoduleState, PendingModuleMacroNames.size())); + if (Callbacks) + Callbacks->EnteredSubmodule(M, ImportLoc, ForPragma); + // Switch to this submodule as the current submodule. CurSubmoduleState = &State; @@ -731,6 +736,10 @@ Module *Preprocessor::LeaveSubmodule(bool ForPragma) { // are tracking macro visibility, don't build any, and preserve the list // of pending names for the surrounding submodule. BuildingSubmoduleStack.pop_back(); + + if (Callbacks) + Callbacks->LeftSubmodule(LeavingMod, ImportLoc, ForPragma); + makeModuleVisible(LeavingMod, ImportLoc); return LeavingMod; } @@ -815,6 +824,9 @@ Module *Preprocessor::LeaveSubmodule(bool ForPragma) { BuildingSubmoduleStack.pop_back(); + if (Callbacks) + Callbacks->LeftSubmodule(LeavingMod, ImportLoc, ForPragma); + // A nested #include makes the included submodule visible. makeModuleVisible(LeavingMod, ImportLoc); return LeavingMod; |