aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Serialization/Module.h
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-12-17 23:38:30 +0000
committerDouglas Gregor <dgregor@apple.com>2011-12-17 23:38:30 +0000
commita1be278c4f3a234ff61f04018d26c6beecde1654 (patch)
tree417374c22b99d713e9c7dbe093ec987d65cb7374 /include/clang/Serialization/Module.h
parent79cbbdc8affe52591f7ee487a789639aa38331ec (diff)
Completely re-implement (de-)serialization of declaration
chains. The previous implementation relied heavily on the declaration chain being stored as a (circular) linked list on disk, as it is in memory. However, when deserializing from multiple modules, the different chains could get mixed up, leading to broken declaration chains. The new solution keeps track of the first and last declarations in the chain for each module file. When we load a declaration, we search all of the module files for redeclarations of that declaration, then splice together all of the lists into a coherent whole (along with any redeclarations that were actually parsed). As a drive-by fix, (de-)serialize the redeclaration chains of TypedefNameDecls, which had somehow gotten missed previously. Add a test of this serialization. This new scheme creates a redeclaration table that is fairly large in the PCH file (on the order of 400k for Cocoa.h's 12MB PCH file). The table is mmap'd in and searched via a binary search, but it's still quite large. A future tweak will eliminate entries for declarations that have no redeclarations anywhere, and should drastically reduce the size of this table. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146841 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Serialization/Module.h')
-rw-r--r--include/clang/Serialization/Module.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/clang/Serialization/Module.h b/include/clang/Serialization/Module.h
index 16d9779e04..cbac5cd148 100644
--- a/include/clang/Serialization/Module.h
+++ b/include/clang/Serialization/Module.h
@@ -260,6 +260,15 @@ public:
/// \brief Remapping table for declaration IDs in this module.
ContinuousRangeMap<uint32_t, int, 2> DeclRemap;
+ /// \brief Mapping from the module files that this module file depends on
+ /// to the base declaration ID for that module as it is understood within this
+ /// module.
+ ///
+ /// This is effectively a reverse global-to-local mapping for declaration
+ /// IDs, so that we can interpret a true global ID (for this translation unit)
+ /// as a local ID (for this module file).
+ llvm::DenseMap<ModuleFile *, serialization::DeclID> GlobalToLocalDeclIDs;
+
/// \brief The number of C++ base specifier sets in this AST file.
unsigned LocalNumCXXBaseSpecifiers;
@@ -286,6 +295,13 @@ public:
/// \brief Array of file-level DeclIDs sorted by file.
const serialization::DeclID *FileSortedDecls;
+ /// \brief Array of redeclaration information within this module file,
+ /// sorted by the first declaration ID.
+ const serialization::LocalRedeclarationsInfo *RedeclarationsInfo;
+
+ /// \brief The number of redeclaration info entries in RedeclarationsInfo.
+ unsigned LocalNumRedeclarationsInfos;
+
// === Types ===
/// \brief The number of types in this AST file.