diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-01-15 16:58:34 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-01-15 16:58:34 +0000 |
commit | 2171bf1caba4d4b9eeb6a91efac4300b41f38b07 (patch) | |
tree | 98cfad2375715b064a068eb3cf8a527a1e88946e /include/clang/Serialization/ASTBitCodes.h | |
parent | 3419d7cd2e4a4dcd2a88381deb5d83eb946a2b93 (diff) |
Completely re-implement (de-)serialization of redeclaration
chains, again. The prior implementation was very linked-list oriented, and
the list-splicing logic was both fairly convoluted (when loading from
multiple modules) and failed to preserve a reasonable ordering for the
redeclaration chains.
This new implementation uses a simpler strategy, where we store the
ordered redeclaration chains in an array-like structure (indexed based
on the first declaration), and use that ordering to add individual
deserialized declarations to the end of the existing chain. That way,
the chain mimics the ordering from its modules, and a bug somewhere is
far less likely to result in a broken linked list.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148222 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Serialization/ASTBitCodes.h')
-rw-r--r-- | include/clang/Serialization/ASTBitCodes.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h index 5d9e86cb08..32ac64e47b 100644 --- a/include/clang/Serialization/ASTBitCodes.h +++ b/include/clang/Serialization/ASTBitCodes.h @@ -367,9 +367,10 @@ namespace clang { /// declarations. TU_UPDATE_LEXICAL = 28, - /// \brief Record code for the array describing the first/last local - /// redeclarations of each entity. - LOCAL_REDECLARATIONS = 29, + /// \brief Record code for the array describing the locations (in the + /// LOCAL_REDECLARATIONS record) of the redeclaration chains, indexed by + /// the first known ID. + LOCAL_REDECLARATIONS_MAP = 29, /// \brief Record code for declarations that Sema keeps references of. SEMA_DECL_REFS = 30, @@ -455,7 +456,13 @@ namespace clang { IMPORTED_MODULES = 51, /// \brief Record code for the set of merged declarations in an AST file. - MERGED_DECLARATIONS = 52 + MERGED_DECLARATIONS = 52, + + /// \brief Record code for the array of redeclaration chains. + /// + /// This array can only be interpreted properly using the local + /// redeclarations map. + LOCAL_REDECLARATIONS = 53 }; /// \brief Record types used within a source manager block. @@ -1194,8 +1201,7 @@ namespace clang { /// \brief Describes the redeclarations of a declaration. struct LocalRedeclarationsInfo { DeclID FirstID; // The ID of the first declaration - DeclID FirstLocalID; // The ID of the first local declaration - DeclID LastLocalID; // The ID of the last local declaration + unsigned Offset; // Offset into the array of redeclaration chains. friend bool operator<(const LocalRedeclarationsInfo &X, const LocalRedeclarationsInfo &Y) { |