(sub)module is read from an AST file. This makes sure that the AST
writer knows how to map all modules to their global IDs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145685
91177308-0d34-0410-b5e6-
96231b3b80d8
class ASTReader;
class QualType;
class MacroDefinition;
+class Module;
class ASTDeserializationListener {
protected:
/// \brief A macro definition was read from the AST file.
virtual void MacroDefinitionRead(serialization::PreprocessedEntityID,
MacroDefinition *MD) { }
+ /// \brief A module definition was read from the AST file.
+ virtual void ModuleRead(serialization::SubmoduleID ID, Module *Mod) { }
};
}
void SelectorRead(serialization::SelectorID ID, Selector Sel);
void MacroDefinitionRead(serialization::PreprocessedEntityID ID,
MacroDefinition *MD);
-
+ void ModuleRead(serialization::SubmoduleID ID, Module *Mod);
+
// ASTMutationListener implementation.
virtual void CompletedTagDefinition(const TagDecl *D);
virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D);
Error("too many submodules");
return Failure;
}
+
+ if (DeserializationListener)
+ DeserializationListener->ModuleRead(
+ CurrentModuleGlobalIndex + NUM_PREDEF_SUBMODULE_IDS,
+ CurrentModule);
+
SubmodulesLoaded[CurrentModuleGlobalIndex++] = CurrentModule;
break;
}
MacroDefinitions[MD] = ID;
}
+void ASTWriter::ModuleRead(serialization::SubmoduleID ID, Module *Mod) {
+ assert(SubmoduleIDs.find(Mod) == SubmoduleIDs.end());
+ SubmoduleIDs[Mod] = ID;
+}
+
void ASTWriter::CompletedTagDefinition(const TagDecl *D) {
assert(D->isCompleteDefinition());
assert(!WritingAST && "Already writing the AST!");