SrcMgr::CharacteristicKind FileType) {
}
+ /// Callback invoked whenever a submodule was entered.
+ ///
+ /// \param M The submodule we have entered.
+ ///
+ /// \param ImportLoc The location of import directive token.
+ ///
+ /// \param ForPragma If entering from pragma directive.
+ ///
+ virtual void EnteredSubmodule(Module *M, SourceLocation ImportLoc,
+ bool ForPragma) { }
+
+ /// Callback invoked whenever a submodule was left.
+ ///
+ /// \param M The submodule we have left.
+ ///
+ /// \param ImportLoc The location of import directive token.
+ ///
+ /// \param ForPragma If entering from pragma directive.
+ ///
+ virtual void LeftSubmodule(Module *M, SourceLocation ImportLoc,
+ bool ForPragma) { }
+
/// Callback invoked whenever there was an explicit module-import
/// syntax.
///
Imported, FileType);
}
+ void EnteredSubmodule(Module *M, SourceLocation ImportLoc,
+ bool ForPragma) override {
+ First->EnteredSubmodule(M, ImportLoc, ForPragma);
+ Second->EnteredSubmodule(M, ImportLoc, ForPragma);
+ }
+
+ void LeftSubmodule(Module *M, SourceLocation ImportLoc,
+ bool ForPragma) override {
+ First->LeftSubmodule(M, ImportLoc, ForPragma);
+ Second->LeftSubmodule(M, ImportLoc, ForPragma);
+ }
+
void moduleImport(SourceLocation ImportLoc, ModuleIdPath Path,
const Module *Imported) override {
First->moduleImport(ImportLoc, Path, Imported);
BuildingSubmoduleStack.push_back(
BuildingSubmoduleInfo(M, ImportLoc, ForPragma, CurSubmoduleState,
PendingModuleMacroNames.size()));
+ if (Callbacks)
+ Callbacks->EnteredSubmodule(M, ImportLoc, ForPragma);
return;
}
BuildingSubmoduleInfo(M, ImportLoc, ForPragma, CurSubmoduleState,
PendingModuleMacroNames.size()));
+ if (Callbacks)
+ Callbacks->EnteredSubmodule(M, ImportLoc, ForPragma);
+
// Switch to this submodule as the current submodule.
CurSubmoduleState = &State;
// 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;
}
BuildingSubmoduleStack.pop_back();
+ if (Callbacks)
+ Callbacks->LeftSubmodule(LeavingMod, ImportLoc, ForPragma);
+
// A nested #include makes the included submodule visible.
makeModuleVisible(LeavingMod, ImportLoc);
return LeavingMod;