From: Sebastian Redl Date: Fri, 1 Oct 2010 19:59:12 +0000 (+0000) Subject: Record module loaders and module source order. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a866e652875c61f09ac29c2f44009ce9f2a25cf2;p=clang Record module loaders and module source order. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115334 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h index 2b3dbf1569..b2f08c183f 100644 --- a/include/clang/Serialization/ASTReader.h +++ b/include/clang/Serialization/ASTReader.h @@ -193,7 +193,7 @@ private: /// \brief The AST consumer. ASTConsumer *Consumer; - /// \brief Information that is needed for every file in the chain. + /// \brief Information that is needed for every module. struct PerFileData { PerFileData(); ~PerFileData(); @@ -318,12 +318,25 @@ private: /// /// The dynamic type of this stat cache is always ASTStatCache void *StatCache; - + /// \brief The number of preallocated preprocessing entities in the /// preprocessing record. unsigned NumPreallocatedPreprocessingEntities; + + /// \brief The next module in source order. + PerFileData *NextInSource; + + /// \brief All the modules that loaded this one. Can contain NULL for + /// directly loaded modules. + llvm::SmallVector Loaders; }; + /// \brief All loaded modules, indexed by name. + llvm::StringMap Modules; + + /// \brief The first module in source order. + PerFileData *FirstInSource; + /// \brief The chain of AST files. The first entry is the one named by the /// user, the last one is the one that doesn't depend on anything further. /// That is, the entry I was created with -include-pch I+1. diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index ac7385976c..adb233ac14 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -2122,8 +2122,14 @@ ASTReader::ASTReadResult ASTReader::ReadAST(const std::string &FileName) { } ASTReader::ASTReadResult ASTReader::ReadASTCore(llvm::StringRef FileName) { + PerFileData *Prev = Chain.empty() ? 0 : Chain.back(); Chain.push_back(new PerFileData()); PerFileData &F = *Chain.back(); + if (Prev) + Prev->NextInSource = &F; + else + FirstInSource = &F; + F.Loaders.push_back(Prev); // Set the AST file name. F.FileName = FileName; @@ -4199,7 +4205,7 @@ ASTReader::PerFileData::PerFileData() MacroDefinitionOffsets(0), LocalNumSelectors(0), SelectorOffsets(0), SelectorLookupTableData(0), SelectorLookupTable(0), LocalNumDecls(0), DeclOffsets(0), LocalNumTypes(0), TypeOffsets(0), StatCache(0), - NumPreallocatedPreprocessingEntities(0) + NumPreallocatedPreprocessingEntities(0), NextInSource(0) {} ASTReader::PerFileData::~PerFileData() {