diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-12-13 21:38:23 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-12-13 21:38:23 +0000 |
commit | 5e24f2d83099bb557b1d39c6420787eeaf072a81 (patch) | |
tree | f5d84c95c272df59f339ee4d63878468359a5999 /include/clang/Serialization | |
parent | de39d1752f1559060237f158e47af6527d5e4abe (diff) |
[PCH] Make the new PCH format (control block) backwards compatible and
don't crash when loading a PCH with the older format.
The introduction of the control block broke compatibility with PCHs from
older versions. This patch allows loading (and rejecting) PCHs from an older
version and allows newer PCHs to be rejected from older clang versions as well.
rdar://12821386
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170150 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Serialization')
-rw-r--r-- | include/clang/Serialization/ASTBitCodes.h | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h index ce9009fd78..4273e14787 100644 --- a/include/clang/Serialization/ASTBitCodes.h +++ b/include/clang/Serialization/ASTBitCodes.h @@ -35,7 +35,7 @@ namespace clang { /// Version 4 of AST files also requires that the version control branch and /// revision match exactly, since there is no backward compatibility of /// AST files at this time. - const unsigned VERSION_MAJOR = 4; + const unsigned VERSION_MAJOR = 5; /// \brief AST file minor version number supported by this version of /// Clang. @@ -323,6 +323,11 @@ namespace clang { /// NULL-terminated string that corresponds to that identifier. IDENTIFIER_OFFSET = 3, + /// \brief This is so that older clang versions, before the introduction + /// of the control block, can read and reject the newer PCH format. + /// *DON"T CHANGE THIS NUMBER*. + METADATA_OLD_FORMAT = 4, + /// \brief Record code for the identifier table. /// /// The identifier table is a simple blob that contains @@ -335,7 +340,7 @@ namespace clang { /// between offsets (for unresolved identifier IDs) and /// IdentifierInfo pointers (for already-resolved identifier /// IDs). - IDENTIFIER_TABLE = 4, + IDENTIFIER_TABLE = 5, /// \brief Record code for the array of external definitions. /// @@ -345,7 +350,7 @@ namespace clang { /// reported to the AST consumer after the AST file has been /// read, since their presence can affect the semantics of the /// program (e.g., for code generation). - EXTERNAL_DEFINITIONS = 5, + EXTERNAL_DEFINITIONS = 6, /// \brief Record code for the set of non-builtin, special /// types. @@ -354,33 +359,33 @@ namespace clang { /// that are constructed during semantic analysis (e.g., /// __builtin_va_list). The SPECIAL_TYPE_* constants provide /// offsets into this record. - SPECIAL_TYPES = 6, + SPECIAL_TYPES = 7, /// \brief Record code for the extra statistics we gather while /// generating an AST file. - STATISTICS = 7, + STATISTICS = 8, /// \brief Record code for the array of tentative definitions. - TENTATIVE_DEFINITIONS = 8, + TENTATIVE_DEFINITIONS = 9, /// \brief Record code for the array of locally-scoped external /// declarations. - LOCALLY_SCOPED_EXTERNAL_DECLS = 9, + LOCALLY_SCOPED_EXTERNAL_DECLS = 10, /// \brief Record code for the table of offsets into the /// Objective-C method pool. - SELECTOR_OFFSETS = 10, + SELECTOR_OFFSETS = 11, /// \brief Record code for the Objective-C method pool, - METHOD_POOL = 11, + METHOD_POOL = 12, /// \brief The value of the next __COUNTER__ to dispense. /// [PP_COUNTER_VALUE, Val] - PP_COUNTER_VALUE = 12, + PP_COUNTER_VALUE = 13, /// \brief Record code for the table of offsets into the block /// of source-location information. - SOURCE_LOCATION_OFFSETS = 13, + SOURCE_LOCATION_OFFSETS = 14, /// \brief Record code for the set of source location entries /// that need to be preloaded by the AST reader. @@ -388,7 +393,7 @@ namespace clang { /// This set contains the source location entry for the /// predefines buffer and for any file entries that need to be /// preloaded. - SOURCE_LOCATION_PRELOADS = 14, + SOURCE_LOCATION_PRELOADS = 15, /// \brief Record code for the set of ext_vector type names. EXT_VECTOR_DECLS = 16, |