]> granicus.if.org Git - clang/commitdiff
[PCH] For ASTReader's FileDeclIDs also associate the Module that the
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Mon, 31 Oct 2011 07:20:08 +0000 (07:20 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Mon, 31 Oct 2011 07:20:08 +0000 (07:20 +0000)
local DeclIDs came from.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143340 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Serialization/ASTReader.h
lib/Serialization/ASTReader.cpp

index f9ca9b27586639b1d801a82cd46693ba07e2b7e1..ecc73c97fca6d2ac3c8ad40402a119012204440c 100644 (file)
@@ -296,8 +296,17 @@ private:
   /// \brief Declarations that have been replaced in a later file in the chain.
   DeclReplacementMap ReplacedDecls;
 
+  struct FileDeclsInfo {
+    Module *Mod;
+    ArrayRef<serialization::LocalDeclID> Decls;
+
+    FileDeclsInfo() : Mod(0) {}
+    FileDeclsInfo(Module *Mod, ArrayRef<serialization::LocalDeclID> Decls)
+      : Mod(Mod), Decls(Decls) {}
+  };
+
   /// \brief Map from a FileID to the file-level declarations that it contains.
-  llvm::DenseMap<FileID, ArrayRef<serialization::DeclID> > FileDeclIDs;
+  llvm::DenseMap<FileID, FileDeclsInfo> FileDeclIDs;
 
   // Updates for visible decls can occur for other contexts than just the
   // TU, and when we read those update records, the actual context will not
index 8a1ae3da1aae7aecc5eab2a2e15650f6fe5bd25f..7ae0c4206991a8bd724bddfcfcd0376447bc5bf2 100644 (file)
@@ -1139,7 +1139,8 @@ ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(int ID) {
     unsigned NumFileDecls = Record[8];
     if (NumFileDecls) {
       assert(F->FileSortedDecls && "FILE_SORTED_DECLS not encountered yet ?");
-      FileDeclIDs[FID] = llvm::makeArrayRef(FirstDecl, NumFileDecls);
+      FileDeclIDs[FID] = FileDeclsInfo(F, llvm::makeArrayRef(FirstDecl,
+                                                             NumFileDecls));
     }
     
     break;