Home | History | Annotate | Download | only in Serialization
      1 //===- ASTBitCodes.h - Enum values for the PCH bitcode format ---*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // This header defines Bitcode enum values for Clang serialized AST files.
     11 //
     12 // The enum values defined in this file should be considered permanent.  If
     13 // new features are added, they should have values added at the end of the
     14 // respective lists.
     15 //
     16 //===----------------------------------------------------------------------===//
     17 #ifndef LLVM_CLANG_SERIALIZATION_ASTBITCODES_H
     18 #define LLVM_CLANG_SERIALIZATION_ASTBITCODES_H
     19 
     20 #include "clang/AST/DeclarationName.h"
     21 #include "clang/AST/Type.h"
     22 #include "llvm/ADT/DenseMap.h"
     23 #include "llvm/Bitcode/BitCodes.h"
     24 #include "llvm/Support/DataTypes.h"
     25 
     26 namespace clang {
     27   namespace serialization {
     28     /// \brief AST file major version number supported by this version of
     29     /// Clang.
     30     ///
     31     /// Whenever the AST file format changes in a way that makes it
     32     /// incompatible with previous versions (such that a reader
     33     /// designed for the previous version could not support reading
     34     /// the new version), this number should be increased.
     35     ///
     36     /// Version 4 of AST files also requires that the version control branch and
     37     /// revision match exactly, since there is no backward compatibility of
     38     /// AST files at this time.
     39     const unsigned VERSION_MAJOR = 6;
     40 
     41     /// \brief AST file minor version number supported by this version of
     42     /// Clang.
     43     ///
     44     /// Whenever the AST format changes in a way that is still
     45     /// compatible with previous versions (such that a reader designed
     46     /// for the previous version could still support reading the new
     47     /// version by ignoring new kinds of subblocks), this number
     48     /// should be increased.
     49     const unsigned VERSION_MINOR = 0;
     50 
     51     /// \brief An ID number that refers to an identifier in an AST file.
     52     ///
     53     /// The ID numbers of identifiers are consecutive (in order of discovery)
     54     /// and start at 1. 0 is reserved for NULL.
     55     typedef uint32_t IdentifierID;
     56 
     57     /// \brief An ID number that refers to a declaration in an AST file.
     58     ///
     59     /// The ID numbers of declarations are consecutive (in order of
     60     /// discovery), with values below NUM_PREDEF_DECL_IDS being reserved.
     61     /// At the start of a chain of precompiled headers, declaration ID 1 is
     62     /// used for the translation unit declaration.
     63     typedef uint32_t DeclID;
     64 
     65     // FIXME: Turn these into classes so we can have some type safety when
     66     // we go from local ID to global and vice-versa.
     67     typedef DeclID LocalDeclID;
     68     typedef DeclID GlobalDeclID;
     69 
     70     /// \brief An ID number that refers to a type in an AST file.
     71     ///
     72     /// The ID of a type is partitioned into two parts: the lower
     73     /// three bits are used to store the const/volatile/restrict
     74     /// qualifiers (as with QualType) and the upper bits provide a
     75     /// type index. The type index values are partitioned into two
     76     /// sets. The values below NUM_PREDEF_TYPE_IDs are predefined type
     77     /// IDs (based on the PREDEF_TYPE_*_ID constants), with 0 as a
     78     /// placeholder for "no type". Values from NUM_PREDEF_TYPE_IDs are
     79     /// other types that have serialized representations.
     80     typedef uint32_t TypeID;
     81 
     82     /// \brief A type index; the type ID with the qualifier bits removed.
     83     class TypeIdx {
     84       uint32_t Idx;
     85     public:
     86       TypeIdx() : Idx(0) { }
     87       explicit TypeIdx(uint32_t index) : Idx(index) { }
     88 
     89       uint32_t getIndex() const { return Idx; }
     90       TypeID asTypeID(unsigned FastQuals) const {
     91         if (Idx == uint32_t(-1))
     92           return TypeID(-1);
     93 
     94         return (Idx << Qualifiers::FastWidth) | FastQuals;
     95       }
     96       static TypeIdx fromTypeID(TypeID ID) {
     97         if (ID == TypeID(-1))
     98           return TypeIdx(-1);
     99 
    100         return TypeIdx(ID >> Qualifiers::FastWidth);
    101       }
    102     };
    103 
    104     /// A structure for putting "fast"-unqualified QualTypes into a
    105     /// DenseMap.  This uses the standard pointer hash function.
    106     struct UnsafeQualTypeDenseMapInfo {
    107       static inline bool isEqual(QualType A, QualType B) { return A == B; }
    108       static inline QualType getEmptyKey() {
    109         return QualType::getFromOpaquePtr((void*) 1);
    110       }
    111       static inline QualType getTombstoneKey() {
    112         return QualType::getFromOpaquePtr((void*) 2);
    113       }
    114       static inline unsigned getHashValue(QualType T) {
    115         assert(!T.getLocalFastQualifiers() &&
    116                "hash invalid for types with fast quals");
    117         uintptr_t v = reinterpret_cast<uintptr_t>(T.getAsOpaquePtr());
    118         return (unsigned(v) >> 4) ^ (unsigned(v) >> 9);
    119       }
    120     };
    121 
    122     /// \brief An ID number that refers to an identifier in an AST file.
    123     typedef uint32_t IdentID;
    124 
    125     /// \brief The number of predefined identifier IDs.
    126     const unsigned int NUM_PREDEF_IDENT_IDS = 1;
    127 
    128     /// \brief An ID number that refers to a macro in an AST file.
    129     typedef uint32_t MacroID;
    130 
    131     /// \brief A global ID number that refers to a macro in an AST file.
    132     typedef uint32_t GlobalMacroID;
    133 
    134     /// \brief A local to a module ID number that refers to a macro in an
    135     /// AST file.
    136     typedef uint32_t LocalMacroID;
    137 
    138     /// \brief The number of predefined macro IDs.
    139     const unsigned int NUM_PREDEF_MACRO_IDS = 1;
    140 
    141     /// \brief An ID number that refers to an ObjC selector in an AST file.
    142     typedef uint32_t SelectorID;
    143 
    144     /// \brief The number of predefined selector IDs.
    145     const unsigned int NUM_PREDEF_SELECTOR_IDS = 1;
    146 
    147     /// \brief An ID number that refers to a set of CXXBaseSpecifiers in an
    148     /// AST file.
    149     typedef uint32_t CXXBaseSpecifiersID;
    150 
    151     /// \brief An ID number that refers to a list of CXXCtorInitializers in an
    152     /// AST file.
    153     typedef uint32_t CXXCtorInitializersID;
    154 
    155     /// \brief An ID number that refers to an entity in the detailed
    156     /// preprocessing record.
    157     typedef uint32_t PreprocessedEntityID;
    158 
    159     /// \brief An ID number that refers to a submodule in a module file.
    160     typedef uint32_t SubmoduleID;
    161 
    162     /// \brief The number of predefined submodule IDs.
    163     const unsigned int NUM_PREDEF_SUBMODULE_IDS = 1;
    164 
    165     /// \brief Source range/offset of a preprocessed entity.
    166     struct PPEntityOffset {
    167       /// \brief Raw source location of beginning of range.
    168       unsigned Begin;
    169       /// \brief Raw source location of end of range.
    170       unsigned End;
    171       /// \brief Offset in the AST file.
    172       uint32_t BitOffset;
    173 
    174       PPEntityOffset(SourceRange R, uint32_t BitOffset)
    175         : Begin(R.getBegin().getRawEncoding()),
    176           End(R.getEnd().getRawEncoding()),
    177           BitOffset(BitOffset) { }
    178       SourceLocation getBegin() const {
    179         return SourceLocation::getFromRawEncoding(Begin);
    180       }
    181       SourceLocation getEnd() const {
    182         return SourceLocation::getFromRawEncoding(End);
    183       }
    184     };
    185 
    186     /// \brief Source range/offset of a preprocessed entity.
    187     struct DeclOffset {
    188       /// \brief Raw source location.
    189       unsigned Loc;
    190       /// \brief Offset in the AST file.
    191       uint32_t BitOffset;
    192 
    193       DeclOffset() : Loc(0), BitOffset(0) { }
    194       DeclOffset(SourceLocation Loc, uint32_t BitOffset)
    195         : Loc(Loc.getRawEncoding()),
    196           BitOffset(BitOffset) { }
    197       void setLocation(SourceLocation L) {
    198         Loc = L.getRawEncoding();
    199       }
    200       SourceLocation getLocation() const {
    201         return SourceLocation::getFromRawEncoding(Loc);
    202       }
    203     };
    204 
    205     /// \brief The number of predefined preprocessed entity IDs.
    206     const unsigned int NUM_PREDEF_PP_ENTITY_IDS = 1;
    207 
    208     /// \brief Describes the various kinds of blocks that occur within
    209     /// an AST file.
    210     enum BlockIDs {
    211       /// \brief The AST block, which acts as a container around the
    212       /// full AST block.
    213       AST_BLOCK_ID = llvm::bitc::FIRST_APPLICATION_BLOCKID,
    214 
    215       /// \brief The block containing information about the source
    216       /// manager.
    217       SOURCE_MANAGER_BLOCK_ID,
    218 
    219       /// \brief The block containing information about the
    220       /// preprocessor.
    221       PREPROCESSOR_BLOCK_ID,
    222 
    223       /// \brief The block containing the definitions of all of the
    224       /// types and decls used within the AST file.
    225       DECLTYPES_BLOCK_ID,
    226 
    227       /// \brief The block containing the detailed preprocessing record.
    228       PREPROCESSOR_DETAIL_BLOCK_ID,
    229 
    230       /// \brief The block containing the submodule structure.
    231       SUBMODULE_BLOCK_ID,
    232 
    233       /// \brief The block containing comments.
    234       COMMENTS_BLOCK_ID,
    235 
    236       /// \brief The control block, which contains all of the
    237       /// information that needs to be validated prior to committing
    238       /// to loading the AST file.
    239       CONTROL_BLOCK_ID,
    240 
    241       /// \brief The block of input files, which were used as inputs
    242       /// to create this AST file.
    243       ///
    244       /// This block is part of the control block.
    245       INPUT_FILES_BLOCK_ID,
    246 
    247       /// \brief The block of configuration options, used to check that
    248       /// a module is being used in a configuration compatible with the
    249       /// configuration in which it was built.
    250       ///
    251       /// This block is part of the control block.
    252       OPTIONS_BLOCK_ID,
    253 
    254       /// \brief A block containing a module file extension.
    255       EXTENSION_BLOCK_ID,
    256     };
    257 
    258     /// \brief Record types that occur within the control block.
    259     enum ControlRecordTypes {
    260       /// \brief AST file metadata, including the AST file version number
    261       /// and information about the compiler used to build this AST file.
    262       METADATA = 1,
    263 
    264       /// \brief Record code for the list of other AST files imported by
    265       /// this AST file.
    266       IMPORTS,
    267 
    268       /// \brief Record code for the original file that was used to
    269       /// generate the AST file, including both its file ID and its
    270       /// name.
    271       ORIGINAL_FILE,
    272 
    273       /// \brief The directory that the PCH was originally created in.
    274       ORIGINAL_PCH_DIR,
    275 
    276       /// \brief Record code for file ID of the file or buffer that was used to
    277       /// generate the AST file.
    278       ORIGINAL_FILE_ID,
    279 
    280       /// \brief Offsets into the input-files block where input files
    281       /// reside.
    282       INPUT_FILE_OFFSETS,
    283 
    284       /// \brief Record code for the module name.
    285       MODULE_NAME,
    286 
    287       /// \brief Record code for the module map file that was used to build this
    288       /// AST file.
    289       MODULE_MAP_FILE,
    290 
    291       /// \brief Record code for the signature that identifiers this AST file.
    292       SIGNATURE,
    293 
    294       /// \brief Record code for the module build directory.
    295       MODULE_DIRECTORY,
    296     };
    297 
    298     /// \brief Record types that occur within the options block inside
    299     /// the control block.
    300     enum OptionsRecordTypes {
    301       /// \brief Record code for the language options table.
    302       ///
    303       /// The record with this code contains the contents of the
    304       /// LangOptions structure. We serialize the entire contents of
    305       /// the structure, and let the reader decide which options are
    306       /// actually important to check.
    307       LANGUAGE_OPTIONS = 1,
    308 
    309       /// \brief Record code for the target options table.
    310       TARGET_OPTIONS,
    311 
    312       /// \brief Record code for the diagnostic options table.
    313       DIAGNOSTIC_OPTIONS,
    314 
    315       /// \brief Record code for the filesystem options table.
    316       FILE_SYSTEM_OPTIONS,
    317 
    318       /// \brief Record code for the headers search options table.
    319       HEADER_SEARCH_OPTIONS,
    320 
    321       /// \brief Record code for the preprocessor options table.
    322       PREPROCESSOR_OPTIONS,
    323     };
    324 
    325     /// \brief Record code for extension blocks.
    326     enum ExtensionBlockRecordTypes {
    327       /// Metadata describing this particular extension.
    328       EXTENSION_METADATA = 1,
    329 
    330       /// The first record ID allocated to the extensions themselves.
    331       FIRST_EXTENSION_RECORD_ID = 4
    332     };
    333 
    334     /// \brief Record types that occur within the input-files block
    335     /// inside the control block.
    336     enum InputFileRecordTypes {
    337       /// \brief An input file.
    338       INPUT_FILE = 1
    339     };
    340 
    341     /// \brief Record types that occur within the AST block itself.
    342     enum ASTRecordTypes {
    343       /// \brief Record code for the offsets of each type.
    344       ///
    345       /// The TYPE_OFFSET constant describes the record that occurs
    346       /// within the AST block. The record itself is an array of offsets that
    347       /// point into the declarations and types block (identified by
    348       /// DECLTYPES_BLOCK_ID). The index into the array is based on the ID
    349       /// of a type. For a given type ID @c T, the lower three bits of
    350       /// @c T are its qualifiers (const, volatile, restrict), as in
    351       /// the QualType class. The upper bits, after being shifted and
    352       /// subtracting NUM_PREDEF_TYPE_IDS, are used to index into the
    353       /// TYPE_OFFSET block to determine the offset of that type's
    354       /// corresponding record within the DECLTYPES_BLOCK_ID block.
    355       TYPE_OFFSET = 1,
    356 
    357       /// \brief Record code for the offsets of each decl.
    358       ///
    359       /// The DECL_OFFSET constant describes the record that occurs
    360       /// within the block identified by DECL_OFFSETS_BLOCK_ID within
    361       /// the AST block. The record itself is an array of offsets that
    362       /// point into the declarations and types block (identified by
    363       /// DECLTYPES_BLOCK_ID). The declaration ID is an index into this
    364       /// record, after subtracting one to account for the use of
    365       /// declaration ID 0 for a NULL declaration pointer. Index 0 is
    366       /// reserved for the translation unit declaration.
    367       DECL_OFFSET = 2,
    368 
    369       /// \brief Record code for the table of offsets of each
    370       /// identifier ID.
    371       ///
    372       /// The offset table contains offsets into the blob stored in
    373       /// the IDENTIFIER_TABLE record. Each offset points to the
    374       /// NULL-terminated string that corresponds to that identifier.
    375       IDENTIFIER_OFFSET = 3,
    376 
    377       /// \brief This is so that older clang versions, before the introduction
    378       /// of the control block, can read and reject the newer PCH format.
    379       /// *DON'T CHANGE THIS NUMBER*.
    380       METADATA_OLD_FORMAT = 4,
    381 
    382       /// \brief Record code for the identifier table.
    383       ///
    384       /// The identifier table is a simple blob that contains
    385       /// NULL-terminated strings for all of the identifiers
    386       /// referenced by the AST file. The IDENTIFIER_OFFSET table
    387       /// contains the mapping from identifier IDs to the characters
    388       /// in this blob. Note that the starting offsets of all of the
    389       /// identifiers are odd, so that, when the identifier offset
    390       /// table is loaded in, we can use the low bit to distinguish
    391       /// between offsets (for unresolved identifier IDs) and
    392       /// IdentifierInfo pointers (for already-resolved identifier
    393       /// IDs).
    394       IDENTIFIER_TABLE = 5,
    395 
    396       /// \brief Record code for the array of eagerly deserialized decls.
    397       ///
    398       /// The AST file contains a list of all of the declarations that should be
    399       /// eagerly deserialized present within the parsed headers, stored as an
    400       /// array of declaration IDs. These declarations will be
    401       /// reported to the AST consumer after the AST file has been
    402       /// read, since their presence can affect the semantics of the
    403       /// program (e.g., for code generation).
    404       EAGERLY_DESERIALIZED_DECLS = 6,
    405 
    406       /// \brief Record code for the set of non-builtin, special
    407       /// types.
    408       ///
    409       /// This record contains the type IDs for the various type nodes
    410       /// that are constructed during semantic analysis (e.g.,
    411       /// __builtin_va_list). The SPECIAL_TYPE_* constants provide
    412       /// offsets into this record.
    413       SPECIAL_TYPES = 7,
    414 
    415       /// \brief Record code for the extra statistics we gather while
    416       /// generating an AST file.
    417       STATISTICS = 8,
    418 
    419       /// \brief Record code for the array of tentative definitions.
    420       TENTATIVE_DEFINITIONS = 9,
    421 
    422       // ID 10 used to be for a list of extern "C" declarations.
    423 
    424       /// \brief Record code for the table of offsets into the
    425       /// Objective-C method pool.
    426       SELECTOR_OFFSETS = 11,
    427 
    428       /// \brief Record code for the Objective-C method pool,
    429       METHOD_POOL = 12,
    430 
    431       /// \brief The value of the next __COUNTER__ to dispense.
    432       /// [PP_COUNTER_VALUE, Val]
    433       PP_COUNTER_VALUE = 13,
    434 
    435       /// \brief Record code for the table of offsets into the block
    436       /// of source-location information.
    437       SOURCE_LOCATION_OFFSETS = 14,
    438 
    439       /// \brief Record code for the set of source location entries
    440       /// that need to be preloaded by the AST reader.
    441       ///
    442       /// This set contains the source location entry for the
    443       /// predefines buffer and for any file entries that need to be
    444       /// preloaded.
    445       SOURCE_LOCATION_PRELOADS = 15,
    446 
    447       /// \brief Record code for the set of ext_vector type names.
    448       EXT_VECTOR_DECLS = 16,
    449 
    450       /// \brief Record code for the array of unused file scoped decls.
    451       UNUSED_FILESCOPED_DECLS = 17,
    452 
    453       /// \brief Record code for the table of offsets to entries in the
    454       /// preprocessing record.
    455       PPD_ENTITIES_OFFSETS = 18,
    456 
    457       /// \brief Record code for the array of VTable uses.
    458       VTABLE_USES = 19,
    459 
    460       // ID 20 used to be for a list of dynamic classes.
    461 
    462       /// \brief Record code for referenced selector pool.
    463       REFERENCED_SELECTOR_POOL = 21,
    464 
    465       /// \brief Record code for an update to the TU's lexically contained
    466       /// declarations.
    467       TU_UPDATE_LEXICAL = 22,
    468 
    469       // ID 23 used to be for a list of local redeclarations.
    470 
    471       /// \brief Record code for declarations that Sema keeps references of.
    472       SEMA_DECL_REFS = 24,
    473 
    474       /// \brief Record code for weak undeclared identifiers.
    475       WEAK_UNDECLARED_IDENTIFIERS = 25,
    476 
    477       /// \brief Record code for pending implicit instantiations.
    478       PENDING_IMPLICIT_INSTANTIATIONS = 26,
    479 
    480       // ID 27 used to be for a list of replacement decls.
    481 
    482       /// \brief Record code for an update to a decl context's lookup table.
    483       ///
    484       /// In practice, this should only be used for the TU and namespaces.
    485       UPDATE_VISIBLE = 28,
    486 
    487       /// \brief Record for offsets of DECL_UPDATES records for declarations
    488       /// that were modified after being deserialized and need updates.
    489       DECL_UPDATE_OFFSETS = 29,
    490 
    491       // ID 30 used to be a decl update record. These are now in the DECLTYPES
    492       // block.
    493 
    494       // ID 31 used to be a list of offsets to DECL_CXX_BASE_SPECIFIERS records.
    495 
    496       /// \brief Record code for \#pragma diagnostic mappings.
    497       DIAG_PRAGMA_MAPPINGS = 32,
    498 
    499       /// \brief Record code for special CUDA declarations.
    500       CUDA_SPECIAL_DECL_REFS = 33,
    501 
    502       /// \brief Record code for header search information.
    503       HEADER_SEARCH_TABLE = 34,
    504 
    505       /// \brief Record code for floating point \#pragma options.
    506       FP_PRAGMA_OPTIONS = 35,
    507 
    508       /// \brief Record code for enabled OpenCL extensions.
    509       OPENCL_EXTENSIONS = 36,
    510 
    511       /// \brief The list of delegating constructor declarations.
    512       DELEGATING_CTORS = 37,
    513 
    514       /// \brief Record code for the set of known namespaces, which are used
    515       /// for typo correction.
    516       KNOWN_NAMESPACES = 38,
    517 
    518       /// \brief Record code for the remapping information used to relate
    519       /// loaded modules to the various offsets and IDs(e.g., source location
    520       /// offests, declaration and type IDs) that are used in that module to
    521       /// refer to other modules.
    522       MODULE_OFFSET_MAP = 39,
    523 
    524       /// \brief Record code for the source manager line table information,
    525       /// which stores information about \#line directives.
    526       SOURCE_MANAGER_LINE_TABLE = 40,
    527 
    528       /// \brief Record code for map of Objective-C class definition IDs to the
    529       /// ObjC categories in a module that are attached to that class.
    530       OBJC_CATEGORIES_MAP = 41,
    531 
    532       /// \brief Record code for a file sorted array of DeclIDs in a module.
    533       FILE_SORTED_DECLS = 42,
    534 
    535       /// \brief Record code for an array of all of the (sub)modules that were
    536       /// imported by the AST file.
    537       IMPORTED_MODULES = 43,
    538 
    539       // ID 44 used to be a table of merged canonical declarations.
    540       // ID 45 used to be a list of declaration IDs of local redeclarations.
    541 
    542       /// \brief Record code for the array of Objective-C categories (including
    543       /// extensions).
    544       ///
    545       /// This array can only be interpreted properly using the Objective-C
    546       /// categories map.
    547       OBJC_CATEGORIES = 46,
    548 
    549       /// \brief Record code for the table of offsets of each macro ID.
    550       ///
    551       /// The offset table contains offsets into the blob stored in
    552       /// the preprocessor block. Each offset points to the corresponding
    553       /// macro definition.
    554       MACRO_OFFSET = 47,
    555 
    556       /// \brief A list of "interesting" identifiers. Only used in C++ (where we
    557       /// don't normally do lookups into the serialized identifier table). These
    558       /// are eagerly deserialized.
    559       INTERESTING_IDENTIFIERS = 48,
    560 
    561       /// \brief Record code for undefined but used functions and variables that
    562       /// need a definition in this TU.
    563       UNDEFINED_BUT_USED = 49,
    564 
    565       /// \brief Record code for late parsed template functions.
    566       LATE_PARSED_TEMPLATE = 50,
    567 
    568       /// \brief Record code for \#pragma optimize options.
    569       OPTIMIZE_PRAGMA_OPTIONS = 51,
    570 
    571       /// \brief Record code for potentially unused local typedef names.
    572       UNUSED_LOCAL_TYPEDEF_NAME_CANDIDATES = 52,
    573 
    574       // ID 53 used to be a table of constructor initializer records.
    575 
    576       /// \brief Delete expressions that will be analyzed later.
    577       DELETE_EXPRS_TO_ANALYZE = 54,
    578 
    579       /// \brief Record code for \#pragma ms_struct options.
    580       MSSTRUCT_PRAGMA_OPTIONS = 55,
    581 
    582       /// \brief Record code for \#pragma ms_struct options.
    583       POINTERS_TO_MEMBERS_PRAGMA_OPTIONS = 56
    584     };
    585 
    586     /// \brief Record types used within a source manager block.
    587     enum SourceManagerRecordTypes {
    588       /// \brief Describes a source location entry (SLocEntry) for a
    589       /// file.
    590       SM_SLOC_FILE_ENTRY = 1,
    591       /// \brief Describes a source location entry (SLocEntry) for a
    592       /// buffer.
    593       SM_SLOC_BUFFER_ENTRY = 2,
    594       /// \brief Describes a blob that contains the data for a buffer
    595       /// entry. This kind of record always directly follows a
    596       /// SM_SLOC_BUFFER_ENTRY record or a SM_SLOC_FILE_ENTRY with an
    597       /// overridden buffer.
    598       SM_SLOC_BUFFER_BLOB = 3,
    599       /// \brief Describes a zlib-compressed blob that contains the data for
    600       /// a buffer entry.
    601       SM_SLOC_BUFFER_BLOB_COMPRESSED = 4,
    602       /// \brief Describes a source location entry (SLocEntry) for a
    603       /// macro expansion.
    604       SM_SLOC_EXPANSION_ENTRY = 5
    605     };
    606 
    607     /// \brief Record types used within a preprocessor block.
    608     enum PreprocessorRecordTypes {
    609       // The macros in the PP section are a PP_MACRO_* instance followed by a
    610       // list of PP_TOKEN instances for each token in the definition.
    611 
    612       /// \brief An object-like macro definition.
    613       /// [PP_MACRO_OBJECT_LIKE, IdentInfoID, SLoc, IsUsed]
    614       PP_MACRO_OBJECT_LIKE = 1,
    615 
    616       /// \brief A function-like macro definition.
    617       /// [PP_MACRO_FUNCTION_LIKE, \<ObjectLikeStuff>, IsC99Varargs,
    618       /// IsGNUVarars, NumArgs, ArgIdentInfoID* ]
    619       PP_MACRO_FUNCTION_LIKE = 2,
    620 
    621       /// \brief Describes one token.
    622       /// [PP_TOKEN, SLoc, Length, IdentInfoID, Kind, Flags]
    623       PP_TOKEN = 3,
    624 
    625       /// \brief The macro directives history for a particular identifier.
    626       PP_MACRO_DIRECTIVE_HISTORY = 4,
    627 
    628       /// \brief A macro directive exported by a module.
    629       /// [PP_MODULE_MACRO, SubmoduleID, MacroID, (Overridden SubmoduleID)*]
    630       PP_MODULE_MACRO = 5,
    631     };
    632 
    633     /// \brief Record types used within a preprocessor detail block.
    634     enum PreprocessorDetailRecordTypes {
    635       /// \brief Describes a macro expansion within the preprocessing record.
    636       PPD_MACRO_EXPANSION = 0,
    637 
    638       /// \brief Describes a macro definition within the preprocessing record.
    639       PPD_MACRO_DEFINITION = 1,
    640 
    641       /// \brief Describes an inclusion directive within the preprocessing
    642       /// record.
    643       PPD_INCLUSION_DIRECTIVE = 2
    644     };
    645 
    646     /// \brief Record types used within a submodule description block.
    647     enum SubmoduleRecordTypes {
    648       /// \brief Metadata for submodules as a whole.
    649       SUBMODULE_METADATA = 0,
    650       /// \brief Defines the major attributes of a submodule, including its
    651       /// name and parent.
    652       SUBMODULE_DEFINITION = 1,
    653       /// \brief Specifies the umbrella header used to create this module,
    654       /// if any.
    655       SUBMODULE_UMBRELLA_HEADER = 2,
    656       /// \brief Specifies a header that falls into this (sub)module.
    657       SUBMODULE_HEADER = 3,
    658       /// \brief Specifies a top-level header that falls into this (sub)module.
    659       SUBMODULE_TOPHEADER = 4,
    660       /// \brief Specifies an umbrella directory.
    661       SUBMODULE_UMBRELLA_DIR = 5,
    662       /// \brief Specifies the submodules that are imported by this
    663       /// submodule.
    664       SUBMODULE_IMPORTS = 6,
    665       /// \brief Specifies the submodules that are re-exported from this
    666       /// submodule.
    667       SUBMODULE_EXPORTS = 7,
    668       /// \brief Specifies a required feature.
    669       SUBMODULE_REQUIRES = 8,
    670       /// \brief Specifies a header that has been explicitly excluded
    671       /// from this submodule.
    672       SUBMODULE_EXCLUDED_HEADER = 9,
    673       /// \brief Specifies a library or framework to link against.
    674       SUBMODULE_LINK_LIBRARY = 10,
    675       /// \brief Specifies a configuration macro for this module.
    676       SUBMODULE_CONFIG_MACRO = 11,
    677       /// \brief Specifies a conflict with another module.
    678       SUBMODULE_CONFLICT = 12,
    679       /// \brief Specifies a header that is private to this submodule.
    680       SUBMODULE_PRIVATE_HEADER = 13,
    681       /// \brief Specifies a header that is part of the module but must be
    682       /// textually included.
    683       SUBMODULE_TEXTUAL_HEADER = 14,
    684       /// \brief Specifies a header that is private to this submodule but
    685       /// must be textually included.
    686       SUBMODULE_PRIVATE_TEXTUAL_HEADER = 15,
    687     };
    688 
    689     /// \brief Record types used within a comments block.
    690     enum CommentRecordTypes {
    691       COMMENTS_RAW_COMMENT = 0
    692     };
    693 
    694     /// \defgroup ASTAST AST file AST constants
    695     ///
    696     /// The constants in this group describe various components of the
    697     /// abstract syntax tree within an AST file.
    698     ///
    699     /// @{
    700 
    701     /// \brief Predefined type IDs.
    702     ///
    703     /// These type IDs correspond to predefined types in the AST
    704     /// context, such as built-in types (int) and special place-holder
    705     /// types (the \<overload> and \<dependent> type markers). Such
    706     /// types are never actually serialized, since they will be built
    707     /// by the AST context when it is created.
    708     enum PredefinedTypeIDs {
    709       /// \brief The NULL type.
    710       PREDEF_TYPE_NULL_ID       = 0,
    711       /// \brief The void type.
    712       PREDEF_TYPE_VOID_ID       = 1,
    713       /// \brief The 'bool' or '_Bool' type.
    714       PREDEF_TYPE_BOOL_ID       = 2,
    715       /// \brief The 'char' type, when it is unsigned.
    716       PREDEF_TYPE_CHAR_U_ID     = 3,
    717       /// \brief The 'unsigned char' type.
    718       PREDEF_TYPE_UCHAR_ID      = 4,
    719       /// \brief The 'unsigned short' type.
    720       PREDEF_TYPE_USHORT_ID     = 5,
    721       /// \brief The 'unsigned int' type.
    722       PREDEF_TYPE_UINT_ID       = 6,
    723       /// \brief The 'unsigned long' type.
    724       PREDEF_TYPE_ULONG_ID      = 7,
    725       /// \brief The 'unsigned long long' type.
    726       PREDEF_TYPE_ULONGLONG_ID  = 8,
    727       /// \brief The 'char' type, when it is signed.
    728       PREDEF_TYPE_CHAR_S_ID     = 9,
    729       /// \brief The 'signed char' type.
    730       PREDEF_TYPE_SCHAR_ID      = 10,
    731       /// \brief The C++ 'wchar_t' type.
    732       PREDEF_TYPE_WCHAR_ID      = 11,
    733       /// \brief The (signed) 'short' type.
    734       PREDEF_TYPE_SHORT_ID      = 12,
    735       /// \brief The (signed) 'int' type.
    736       PREDEF_TYPE_INT_ID        = 13,
    737       /// \brief The (signed) 'long' type.
    738       PREDEF_TYPE_LONG_ID       = 14,
    739       /// \brief The (signed) 'long long' type.
    740       PREDEF_TYPE_LONGLONG_ID   = 15,
    741       /// \brief The 'float' type.
    742       PREDEF_TYPE_FLOAT_ID      = 16,
    743       /// \brief The 'double' type.
    744       PREDEF_TYPE_DOUBLE_ID     = 17,
    745       /// \brief The 'long double' type.
    746       PREDEF_TYPE_LONGDOUBLE_ID = 18,
    747       /// \brief The placeholder type for overloaded function sets.
    748       PREDEF_TYPE_OVERLOAD_ID   = 19,
    749       /// \brief The placeholder type for dependent types.
    750       PREDEF_TYPE_DEPENDENT_ID  = 20,
    751       /// \brief The '__uint128_t' type.
    752       PREDEF_TYPE_UINT128_ID    = 21,
    753       /// \brief The '__int128_t' type.
    754       PREDEF_TYPE_INT128_ID     = 22,
    755       /// \brief The type of 'nullptr'.
    756       PREDEF_TYPE_NULLPTR_ID    = 23,
    757       /// \brief The C++ 'char16_t' type.
    758       PREDEF_TYPE_CHAR16_ID     = 24,
    759       /// \brief The C++ 'char32_t' type.
    760       PREDEF_TYPE_CHAR32_ID     = 25,
    761       /// \brief The ObjC 'id' type.
    762       PREDEF_TYPE_OBJC_ID       = 26,
    763       /// \brief The ObjC 'Class' type.
    764       PREDEF_TYPE_OBJC_CLASS    = 27,
    765       /// \brief The ObjC 'SEL' type.
    766       PREDEF_TYPE_OBJC_SEL      = 28,
    767       /// \brief The 'unknown any' placeholder type.
    768       PREDEF_TYPE_UNKNOWN_ANY   = 29,
    769       /// \brief The placeholder type for bound member functions.
    770       PREDEF_TYPE_BOUND_MEMBER  = 30,
    771       /// \brief The "auto" deduction type.
    772       PREDEF_TYPE_AUTO_DEDUCT   = 31,
    773       /// \brief The "auto &&" deduction type.
    774       PREDEF_TYPE_AUTO_RREF_DEDUCT = 32,
    775       /// \brief The OpenCL 'half' / ARM NEON __fp16 type.
    776       PREDEF_TYPE_HALF_ID       = 33,
    777       /// \brief ARC's unbridged-cast placeholder type.
    778       PREDEF_TYPE_ARC_UNBRIDGED_CAST = 34,
    779       /// \brief The pseudo-object placeholder type.
    780       PREDEF_TYPE_PSEUDO_OBJECT = 35,
    781       /// \brief The placeholder type for builtin functions.
    782       PREDEF_TYPE_BUILTIN_FN = 36,
    783       /// \brief OpenCL event type.
    784       PREDEF_TYPE_EVENT_ID      = 37,
    785       /// \brief OpenCL clk event type.
    786       PREDEF_TYPE_CLK_EVENT_ID  = 38,
    787       /// \brief OpenCL sampler type.
    788       PREDEF_TYPE_SAMPLER_ID    = 39,
    789       /// \brief OpenCL queue type.
    790       PREDEF_TYPE_QUEUE_ID      = 40,
    791       /// \brief OpenCL ndrange type.
    792       PREDEF_TYPE_NDRANGE_ID    = 41,
    793       /// \brief OpenCL reserve_id type.
    794       PREDEF_TYPE_RESERVE_ID_ID = 42,
    795       /// \brief The placeholder type for OpenMP array section.
    796       PREDEF_TYPE_OMP_ARRAY_SECTION = 43,
    797       /// \brief The '__float128' type
    798       PREDEF_TYPE_FLOAT128_ID = 44,
    799       /// \brief OpenCL image types with auto numeration
    800 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
    801       PREDEF_TYPE_##Id##_ID,
    802 #include "clang/Basic/OpenCLImageTypes.def"
    803     };
    804 
    805     /// \brief The number of predefined type IDs that are reserved for
    806     /// the PREDEF_TYPE_* constants.
    807     ///
    808     /// Type IDs for non-predefined types will start at
    809     /// NUM_PREDEF_TYPE_IDs.
    810     const unsigned NUM_PREDEF_TYPE_IDS = 100;
    811 
    812     /// \brief Record codes for each kind of type.
    813     ///
    814     /// These constants describe the type records that can occur within a
    815     /// block identified by DECLTYPES_BLOCK_ID in the AST file. Each
    816     /// constant describes a record for a specific type class in the
    817     /// AST. Note that DeclCode values share this code space.
    818     enum TypeCode {
    819       /// \brief An ExtQualType record.
    820       TYPE_EXT_QUAL                 = 1,
    821       /// \brief A ComplexType record.
    822       TYPE_COMPLEX                  = 3,
    823       /// \brief A PointerType record.
    824       TYPE_POINTER                  = 4,
    825       /// \brief A BlockPointerType record.
    826       TYPE_BLOCK_POINTER            = 5,
    827       /// \brief An LValueReferenceType record.
    828       TYPE_LVALUE_REFERENCE         = 6,
    829       /// \brief An RValueReferenceType record.
    830       TYPE_RVALUE_REFERENCE         = 7,
    831       /// \brief A MemberPointerType record.
    832       TYPE_MEMBER_POINTER           = 8,
    833       /// \brief A ConstantArrayType record.
    834       TYPE_CONSTANT_ARRAY           = 9,
    835       /// \brief An IncompleteArrayType record.
    836       TYPE_INCOMPLETE_ARRAY         = 10,
    837       /// \brief A VariableArrayType record.
    838       TYPE_VARIABLE_ARRAY           = 11,
    839       /// \brief A VectorType record.
    840       TYPE_VECTOR                   = 12,
    841       /// \brief An ExtVectorType record.
    842       TYPE_EXT_VECTOR               = 13,
    843       /// \brief A FunctionNoProtoType record.
    844       TYPE_FUNCTION_NO_PROTO        = 14,
    845       /// \brief A FunctionProtoType record.
    846       TYPE_FUNCTION_PROTO           = 15,
    847       /// \brief A TypedefType record.
    848       TYPE_TYPEDEF                  = 16,
    849       /// \brief A TypeOfExprType record.
    850       TYPE_TYPEOF_EXPR              = 17,
    851       /// \brief A TypeOfType record.
    852       TYPE_TYPEOF                   = 18,
    853       /// \brief A RecordType record.
    854       TYPE_RECORD                   = 19,
    855       /// \brief An EnumType record.
    856       TYPE_ENUM                     = 20,
    857       /// \brief An ObjCInterfaceType record.
    858       TYPE_OBJC_INTERFACE           = 21,
    859       /// \brief An ObjCObjectPointerType record.
    860       TYPE_OBJC_OBJECT_POINTER      = 22,
    861       /// \brief a DecltypeType record.
    862       TYPE_DECLTYPE                 = 23,
    863       /// \brief An ElaboratedType record.
    864       TYPE_ELABORATED               = 24,
    865       /// \brief A SubstTemplateTypeParmType record.
    866       TYPE_SUBST_TEMPLATE_TYPE_PARM = 25,
    867       /// \brief An UnresolvedUsingType record.
    868       TYPE_UNRESOLVED_USING         = 26,
    869       /// \brief An InjectedClassNameType record.
    870       TYPE_INJECTED_CLASS_NAME      = 27,
    871       /// \brief An ObjCObjectType record.
    872       TYPE_OBJC_OBJECT              = 28,
    873       /// \brief An TemplateTypeParmType record.
    874       TYPE_TEMPLATE_TYPE_PARM       = 29,
    875       /// \brief An TemplateSpecializationType record.
    876       TYPE_TEMPLATE_SPECIALIZATION  = 30,
    877       /// \brief A DependentNameType record.
    878       TYPE_DEPENDENT_NAME           = 31,
    879       /// \brief A DependentTemplateSpecializationType record.
    880       TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION = 32,
    881       /// \brief A DependentSizedArrayType record.
    882       TYPE_DEPENDENT_SIZED_ARRAY    = 33,
    883       /// \brief A ParenType record.
    884       TYPE_PAREN                    = 34,
    885       /// \brief A PackExpansionType record.
    886       TYPE_PACK_EXPANSION           = 35,
    887       /// \brief An AttributedType record.
    888       TYPE_ATTRIBUTED               = 36,
    889       /// \brief A SubstTemplateTypeParmPackType record.
    890       TYPE_SUBST_TEMPLATE_TYPE_PARM_PACK = 37,
    891       /// \brief A AutoType record.
    892       TYPE_AUTO                  = 38,
    893       /// \brief A UnaryTransformType record.
    894       TYPE_UNARY_TRANSFORM       = 39,
    895       /// \brief An AtomicType record.
    896       TYPE_ATOMIC                = 40,
    897       /// \brief A DecayedType record.
    898       TYPE_DECAYED               = 41,
    899       /// \brief An AdjustedType record.
    900       TYPE_ADJUSTED              = 42,
    901       /// \brief A PipeType record.
    902       TYPE_PIPE                  = 43
    903     };
    904 
    905     /// \brief The type IDs for special types constructed by semantic
    906     /// analysis.
    907     ///
    908     /// The constants in this enumeration are indices into the
    909     /// SPECIAL_TYPES record.
    910     enum SpecialTypeIDs {
    911       /// \brief CFConstantString type
    912       SPECIAL_TYPE_CF_CONSTANT_STRING          = 0,
    913       /// \brief C FILE typedef type
    914       SPECIAL_TYPE_FILE                        = 1,
    915       /// \brief C jmp_buf typedef type
    916       SPECIAL_TYPE_JMP_BUF                     = 2,
    917       /// \brief C sigjmp_buf typedef type
    918       SPECIAL_TYPE_SIGJMP_BUF                  = 3,
    919       /// \brief Objective-C "id" redefinition type
    920       SPECIAL_TYPE_OBJC_ID_REDEFINITION        = 4,
    921       /// \brief Objective-C "Class" redefinition type
    922       SPECIAL_TYPE_OBJC_CLASS_REDEFINITION     = 5,
    923       /// \brief Objective-C "SEL" redefinition type
    924       SPECIAL_TYPE_OBJC_SEL_REDEFINITION       = 6,
    925       /// \brief C ucontext_t typedef type
    926       SPECIAL_TYPE_UCONTEXT_T                  = 7
    927     };
    928 
    929     /// \brief The number of special type IDs.
    930     const unsigned NumSpecialTypeIDs = 8;
    931 
    932     /// \brief Predefined declaration IDs.
    933     ///
    934     /// These declaration IDs correspond to predefined declarations in the AST
    935     /// context, such as the NULL declaration ID. Such declarations are never
    936     /// actually serialized, since they will be built by the AST context when
    937     /// it is created.
    938     enum PredefinedDeclIDs {
    939       /// \brief The NULL declaration.
    940       PREDEF_DECL_NULL_ID = 0,
    941 
    942       /// \brief The translation unit.
    943       PREDEF_DECL_TRANSLATION_UNIT_ID = 1,
    944 
    945       /// \brief The Objective-C 'id' type.
    946       PREDEF_DECL_OBJC_ID_ID = 2,
    947 
    948       /// \brief The Objective-C 'SEL' type.
    949       PREDEF_DECL_OBJC_SEL_ID = 3,
    950 
    951       /// \brief The Objective-C 'Class' type.
    952       PREDEF_DECL_OBJC_CLASS_ID = 4,
    953 
    954       /// \brief The Objective-C 'Protocol' type.
    955       PREDEF_DECL_OBJC_PROTOCOL_ID = 5,
    956 
    957       /// \brief The signed 128-bit integer type.
    958       PREDEF_DECL_INT_128_ID = 6,
    959 
    960       /// \brief The unsigned 128-bit integer type.
    961       PREDEF_DECL_UNSIGNED_INT_128_ID = 7,
    962 
    963       /// \brief The internal 'instancetype' typedef.
    964       PREDEF_DECL_OBJC_INSTANCETYPE_ID = 8,
    965 
    966       /// \brief The internal '__builtin_va_list' typedef.
    967       PREDEF_DECL_BUILTIN_VA_LIST_ID = 9,
    968 
    969       /// \brief The internal '__va_list_tag' struct, if any.
    970       PREDEF_DECL_VA_LIST_TAG = 10,
    971 
    972       /// \brief The internal '__builtin_ms_va_list' typedef.
    973       PREDEF_DECL_BUILTIN_MS_VA_LIST_ID = 11,
    974 
    975       /// \brief The extern "C" context.
    976       PREDEF_DECL_EXTERN_C_CONTEXT_ID = 12,
    977 
    978       /// \brief The internal '__make_integer_seq' template.
    979       PREDEF_DECL_MAKE_INTEGER_SEQ_ID = 13,
    980 
    981       /// \brief The internal '__NSConstantString' typedef.
    982       PREDEF_DECL_CF_CONSTANT_STRING_ID = 14,
    983 
    984       /// \brief The internal '__NSConstantString' tag type.
    985       PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID = 15,
    986 
    987       /// \brief The internal '__type_pack_element' template.
    988       PREDEF_DECL_TYPE_PACK_ELEMENT_ID = 16,
    989     };
    990 
    991     /// \brief The number of declaration IDs that are predefined.
    992     ///
    993     /// For more information about predefined declarations, see the
    994     /// \c PredefinedDeclIDs type and the PREDEF_DECL_*_ID constants.
    995     const unsigned int NUM_PREDEF_DECL_IDS = 17;
    996 
    997     /// \brief Record of updates for a declaration that was modified after
    998     /// being deserialized. This can occur within DECLTYPES_BLOCK_ID.
    999     const unsigned int DECL_UPDATES = 49;
   1000 
   1001     /// \brief Record code for a list of local redeclarations of a declaration.
   1002     /// This can occur within DECLTYPES_BLOCK_ID.
   1003     const unsigned int LOCAL_REDECLARATIONS = 50;
   1004 
   1005     /// \brief Record codes for each kind of declaration.
   1006     ///
   1007     /// These constants describe the declaration records that can occur within
   1008     /// a declarations block (identified by DECLTYPES_BLOCK_ID). Each
   1009     /// constant describes a record for a specific declaration class
   1010     /// in the AST. Note that TypeCode values share this code space.
   1011     enum DeclCode {
   1012       /// \brief A TypedefDecl record.
   1013       DECL_TYPEDEF = 51,
   1014       /// \brief A TypeAliasDecl record.
   1015       DECL_TYPEALIAS,
   1016       /// \brief An EnumDecl record.
   1017       DECL_ENUM,
   1018       /// \brief A RecordDecl record.
   1019       DECL_RECORD,
   1020       /// \brief An EnumConstantDecl record.
   1021       DECL_ENUM_CONSTANT,
   1022       /// \brief A FunctionDecl record.
   1023       DECL_FUNCTION,
   1024       /// \brief A ObjCMethodDecl record.
   1025       DECL_OBJC_METHOD,
   1026       /// \brief A ObjCInterfaceDecl record.
   1027       DECL_OBJC_INTERFACE,
   1028       /// \brief A ObjCProtocolDecl record.
   1029       DECL_OBJC_PROTOCOL,
   1030       /// \brief A ObjCIvarDecl record.
   1031       DECL_OBJC_IVAR,
   1032       /// \brief A ObjCAtDefsFieldDecl record.
   1033       DECL_OBJC_AT_DEFS_FIELD,
   1034       /// \brief A ObjCCategoryDecl record.
   1035       DECL_OBJC_CATEGORY,
   1036       /// \brief A ObjCCategoryImplDecl record.
   1037       DECL_OBJC_CATEGORY_IMPL,
   1038       /// \brief A ObjCImplementationDecl record.
   1039       DECL_OBJC_IMPLEMENTATION,
   1040       /// \brief A ObjCCompatibleAliasDecl record.
   1041       DECL_OBJC_COMPATIBLE_ALIAS,
   1042       /// \brief A ObjCPropertyDecl record.
   1043       DECL_OBJC_PROPERTY,
   1044       /// \brief A ObjCPropertyImplDecl record.
   1045       DECL_OBJC_PROPERTY_IMPL,
   1046       /// \brief A FieldDecl record.
   1047       DECL_FIELD,
   1048       /// \brief A MSPropertyDecl record.
   1049       DECL_MS_PROPERTY,
   1050       /// \brief A VarDecl record.
   1051       DECL_VAR,
   1052       /// \brief An ImplicitParamDecl record.
   1053       DECL_IMPLICIT_PARAM,
   1054       /// \brief A ParmVarDecl record.
   1055       DECL_PARM_VAR,
   1056       /// \brief A FileScopeAsmDecl record.
   1057       DECL_FILE_SCOPE_ASM,
   1058       /// \brief A BlockDecl record.
   1059       DECL_BLOCK,
   1060       /// \brief A CapturedDecl record.
   1061       DECL_CAPTURED,
   1062       /// \brief A record that stores the set of declarations that are
   1063       /// lexically stored within a given DeclContext.
   1064       ///
   1065       /// The record itself is a blob that is an array of declaration IDs,
   1066       /// in the order in which those declarations were added to the
   1067       /// declaration context. This data is used when iterating over
   1068       /// the contents of a DeclContext, e.g., via
   1069       /// DeclContext::decls_begin() and DeclContext::decls_end().
   1070       DECL_CONTEXT_LEXICAL,
   1071       /// \brief A record that stores the set of declarations that are
   1072       /// visible from a given DeclContext.
   1073       ///
   1074       /// The record itself stores a set of mappings, each of which
   1075       /// associates a declaration name with one or more declaration
   1076       /// IDs. This data is used when performing qualified name lookup
   1077       /// into a DeclContext via DeclContext::lookup.
   1078       DECL_CONTEXT_VISIBLE,
   1079       /// \brief A LabelDecl record.
   1080       DECL_LABEL,
   1081       /// \brief A NamespaceDecl record.
   1082       DECL_NAMESPACE,
   1083       /// \brief A NamespaceAliasDecl record.
   1084       DECL_NAMESPACE_ALIAS,
   1085       /// \brief A UsingDecl record.
   1086       DECL_USING,
   1087       /// \brief A UsingShadowDecl record.
   1088       DECL_USING_SHADOW,
   1089       /// \brief A ConstructorUsingShadowDecl record.
   1090       DECL_CONSTRUCTOR_USING_SHADOW,
   1091       /// \brief A UsingDirecitveDecl record.
   1092       DECL_USING_DIRECTIVE,
   1093       /// \brief An UnresolvedUsingValueDecl record.
   1094       DECL_UNRESOLVED_USING_VALUE,
   1095       /// \brief An UnresolvedUsingTypenameDecl record.
   1096       DECL_UNRESOLVED_USING_TYPENAME,
   1097       /// \brief A LinkageSpecDecl record.
   1098       DECL_LINKAGE_SPEC,
   1099       /// \brief A CXXRecordDecl record.
   1100       DECL_CXX_RECORD,
   1101       /// \brief A CXXMethodDecl record.
   1102       DECL_CXX_METHOD,
   1103       /// \brief A CXXConstructorDecl record.
   1104       DECL_CXX_CONSTRUCTOR,
   1105       /// \brief A CXXConstructorDecl record for an inherited constructor.
   1106       DECL_CXX_INHERITED_CONSTRUCTOR,
   1107       /// \brief A CXXDestructorDecl record.
   1108       DECL_CXX_DESTRUCTOR,
   1109       /// \brief A CXXConversionDecl record.
   1110       DECL_CXX_CONVERSION,
   1111       /// \brief An AccessSpecDecl record.
   1112       DECL_ACCESS_SPEC,
   1113 
   1114       /// \brief A FriendDecl record.
   1115       DECL_FRIEND,
   1116       /// \brief A FriendTemplateDecl record.
   1117       DECL_FRIEND_TEMPLATE,
   1118       /// \brief A ClassTemplateDecl record.
   1119       DECL_CLASS_TEMPLATE,
   1120       /// \brief A ClassTemplateSpecializationDecl record.
   1121       DECL_CLASS_TEMPLATE_SPECIALIZATION,
   1122       /// \brief A ClassTemplatePartialSpecializationDecl record.
   1123       DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION,
   1124       /// \brief A VarTemplateDecl record.
   1125       DECL_VAR_TEMPLATE,
   1126       /// \brief A VarTemplateSpecializationDecl record.
   1127       DECL_VAR_TEMPLATE_SPECIALIZATION,
   1128       /// \brief A VarTemplatePartialSpecializationDecl record.
   1129       DECL_VAR_TEMPLATE_PARTIAL_SPECIALIZATION,
   1130       /// \brief A FunctionTemplateDecl record.
   1131       DECL_FUNCTION_TEMPLATE,
   1132       /// \brief A TemplateTypeParmDecl record.
   1133       DECL_TEMPLATE_TYPE_PARM,
   1134       /// \brief A NonTypeTemplateParmDecl record.
   1135       DECL_NON_TYPE_TEMPLATE_PARM,
   1136       /// \brief A TemplateTemplateParmDecl record.
   1137       DECL_TEMPLATE_TEMPLATE_PARM,
   1138       /// \brief A TypeAliasTemplateDecl record.
   1139       DECL_TYPE_ALIAS_TEMPLATE,
   1140       /// \brief A StaticAssertDecl record.
   1141       DECL_STATIC_ASSERT,
   1142       /// \brief A record containing CXXBaseSpecifiers.
   1143       DECL_CXX_BASE_SPECIFIERS,
   1144       /// \brief A record containing CXXCtorInitializers.
   1145       DECL_CXX_CTOR_INITIALIZERS,
   1146       /// \brief A IndirectFieldDecl record.
   1147       DECL_INDIRECTFIELD,
   1148       /// \brief A NonTypeTemplateParmDecl record that stores an expanded
   1149       /// non-type template parameter pack.
   1150       DECL_EXPANDED_NON_TYPE_TEMPLATE_PARM_PACK,
   1151       /// \brief A TemplateTemplateParmDecl record that stores an expanded
   1152       /// template template parameter pack.
   1153       DECL_EXPANDED_TEMPLATE_TEMPLATE_PARM_PACK,
   1154       /// \brief A ClassScopeFunctionSpecializationDecl record a class scope
   1155       /// function specialization. (Microsoft extension).
   1156       DECL_CLASS_SCOPE_FUNCTION_SPECIALIZATION,
   1157       /// \brief An ImportDecl recording a module import.
   1158       DECL_IMPORT,
   1159       /// \brief An OMPThreadPrivateDecl record.
   1160       DECL_OMP_THREADPRIVATE,
   1161       /// \brief An EmptyDecl record.
   1162       DECL_EMPTY,
   1163       /// \brief An ObjCTypeParamDecl record.
   1164       DECL_OBJC_TYPE_PARAM,
   1165       /// \brief An OMPCapturedExprDecl record.
   1166       DECL_OMP_CAPTUREDEXPR,
   1167       /// \brief A PragmaCommentDecl record.
   1168       DECL_PRAGMA_COMMENT,
   1169       /// \brief A PragmaDetectMismatchDecl record.
   1170       DECL_PRAGMA_DETECT_MISMATCH,
   1171       /// \brief An OMPDeclareReductionDecl record.
   1172       DECL_OMP_DECLARE_REDUCTION,
   1173     };
   1174 
   1175     /// \brief Record codes for each kind of statement or expression.
   1176     ///
   1177     /// These constants describe the records that describe statements
   1178     /// or expressions. These records  occur within type and declarations
   1179     /// block, so they begin with record values of 128.  Each constant
   1180     /// describes a record for a specific statement or expression class in the
   1181     /// AST.
   1182     enum StmtCode {
   1183       /// \brief A marker record that indicates that we are at the end
   1184       /// of an expression.
   1185       STMT_STOP = 128,
   1186       /// \brief A NULL expression.
   1187       STMT_NULL_PTR,
   1188       /// \brief A reference to a previously [de]serialized Stmt record.
   1189       STMT_REF_PTR,
   1190       /// \brief A NullStmt record.
   1191       STMT_NULL,
   1192       /// \brief A CompoundStmt record.
   1193       STMT_COMPOUND,
   1194       /// \brief A CaseStmt record.
   1195       STMT_CASE,
   1196       /// \brief A DefaultStmt record.
   1197       STMT_DEFAULT,
   1198       /// \brief A LabelStmt record.
   1199       STMT_LABEL,
   1200       /// \brief An AttributedStmt record.
   1201       STMT_ATTRIBUTED,
   1202       /// \brief An IfStmt record.
   1203       STMT_IF,
   1204       /// \brief A SwitchStmt record.
   1205       STMT_SWITCH,
   1206       /// \brief A WhileStmt record.
   1207       STMT_WHILE,
   1208       /// \brief A DoStmt record.
   1209       STMT_DO,
   1210       /// \brief A ForStmt record.
   1211       STMT_FOR,
   1212       /// \brief A GotoStmt record.
   1213       STMT_GOTO,
   1214       /// \brief An IndirectGotoStmt record.
   1215       STMT_INDIRECT_GOTO,
   1216       /// \brief A ContinueStmt record.
   1217       STMT_CONTINUE,
   1218       /// \brief A BreakStmt record.
   1219       STMT_BREAK,
   1220       /// \brief A ReturnStmt record.
   1221       STMT_RETURN,
   1222       /// \brief A DeclStmt record.
   1223       STMT_DECL,
   1224       /// \brief A CapturedStmt record.
   1225       STMT_CAPTURED,
   1226       /// \brief A GCC-style AsmStmt record.
   1227       STMT_GCCASM,
   1228       /// \brief A MS-style AsmStmt record.
   1229       STMT_MSASM,
   1230       /// \brief A PredefinedExpr record.
   1231       EXPR_PREDEFINED,
   1232       /// \brief A DeclRefExpr record.
   1233       EXPR_DECL_REF,
   1234       /// \brief An IntegerLiteral record.
   1235       EXPR_INTEGER_LITERAL,
   1236       /// \brief A FloatingLiteral record.
   1237       EXPR_FLOATING_LITERAL,
   1238       /// \brief An ImaginaryLiteral record.
   1239       EXPR_IMAGINARY_LITERAL,
   1240       /// \brief A StringLiteral record.
   1241       EXPR_STRING_LITERAL,
   1242       /// \brief A CharacterLiteral record.
   1243       EXPR_CHARACTER_LITERAL,
   1244       /// \brief A ParenExpr record.
   1245       EXPR_PAREN,
   1246       /// \brief A ParenListExpr record.
   1247       EXPR_PAREN_LIST,
   1248       /// \brief A UnaryOperator record.
   1249       EXPR_UNARY_OPERATOR,
   1250       /// \brief An OffsetOfExpr record.
   1251       EXPR_OFFSETOF,
   1252       /// \brief A SizefAlignOfExpr record.
   1253       EXPR_SIZEOF_ALIGN_OF,
   1254       /// \brief An ArraySubscriptExpr record.
   1255       EXPR_ARRAY_SUBSCRIPT,
   1256       /// \brief A CallExpr record.
   1257       EXPR_CALL,
   1258       /// \brief A MemberExpr record.
   1259       EXPR_MEMBER,
   1260       /// \brief A BinaryOperator record.
   1261       EXPR_BINARY_OPERATOR,
   1262       /// \brief A CompoundAssignOperator record.
   1263       EXPR_COMPOUND_ASSIGN_OPERATOR,
   1264       /// \brief A ConditionOperator record.
   1265       EXPR_CONDITIONAL_OPERATOR,
   1266       /// \brief An ImplicitCastExpr record.
   1267       EXPR_IMPLICIT_CAST,
   1268       /// \brief A CStyleCastExpr record.
   1269       EXPR_CSTYLE_CAST,
   1270       /// \brief A CompoundLiteralExpr record.
   1271       EXPR_COMPOUND_LITERAL,
   1272       /// \brief An ExtVectorElementExpr record.
   1273       EXPR_EXT_VECTOR_ELEMENT,
   1274       /// \brief An InitListExpr record.
   1275       EXPR_INIT_LIST,
   1276       /// \brief A DesignatedInitExpr record.
   1277       EXPR_DESIGNATED_INIT,
   1278       /// \brief A DesignatedInitUpdateExpr record.
   1279       EXPR_DESIGNATED_INIT_UPDATE,
   1280       /// \brief An ImplicitValueInitExpr record.
   1281       EXPR_IMPLICIT_VALUE_INIT,
   1282       /// \brief An NoInitExpr record.
   1283       EXPR_NO_INIT,
   1284       /// \brief A VAArgExpr record.
   1285       EXPR_VA_ARG,
   1286       /// \brief An AddrLabelExpr record.
   1287       EXPR_ADDR_LABEL,
   1288       /// \brief A StmtExpr record.
   1289       EXPR_STMT,
   1290       /// \brief A ChooseExpr record.
   1291       EXPR_CHOOSE,
   1292       /// \brief A GNUNullExpr record.
   1293       EXPR_GNU_NULL,
   1294       /// \brief A ShuffleVectorExpr record.
   1295       EXPR_SHUFFLE_VECTOR,
   1296       /// \brief A ConvertVectorExpr record.
   1297       EXPR_CONVERT_VECTOR,
   1298       /// \brief BlockExpr
   1299       EXPR_BLOCK,
   1300       /// \brief A GenericSelectionExpr record.
   1301       EXPR_GENERIC_SELECTION,
   1302       /// \brief A PseudoObjectExpr record.
   1303       EXPR_PSEUDO_OBJECT,
   1304       /// \brief An AtomicExpr record.
   1305       EXPR_ATOMIC,
   1306 
   1307       // Objective-C
   1308 
   1309       /// \brief An ObjCStringLiteral record.
   1310       EXPR_OBJC_STRING_LITERAL,
   1311 
   1312       EXPR_OBJC_BOXED_EXPRESSION,
   1313       EXPR_OBJC_ARRAY_LITERAL,
   1314       EXPR_OBJC_DICTIONARY_LITERAL,
   1315 
   1316 
   1317       /// \brief An ObjCEncodeExpr record.
   1318       EXPR_OBJC_ENCODE,
   1319       /// \brief An ObjCSelectorExpr record.
   1320       EXPR_OBJC_SELECTOR_EXPR,
   1321       /// \brief An ObjCProtocolExpr record.
   1322       EXPR_OBJC_PROTOCOL_EXPR,
   1323       /// \brief An ObjCIvarRefExpr record.
   1324       EXPR_OBJC_IVAR_REF_EXPR,
   1325       /// \brief An ObjCPropertyRefExpr record.
   1326       EXPR_OBJC_PROPERTY_REF_EXPR,
   1327       /// \brief An ObjCSubscriptRefExpr record.
   1328       EXPR_OBJC_SUBSCRIPT_REF_EXPR,
   1329       /// \brief UNUSED
   1330       EXPR_OBJC_KVC_REF_EXPR,
   1331       /// \brief An ObjCMessageExpr record.
   1332       EXPR_OBJC_MESSAGE_EXPR,
   1333       /// \brief An ObjCIsa Expr record.
   1334       EXPR_OBJC_ISA,
   1335       /// \brief An ObjCIndirectCopyRestoreExpr record.
   1336       EXPR_OBJC_INDIRECT_COPY_RESTORE,
   1337 
   1338       /// \brief An ObjCForCollectionStmt record.
   1339       STMT_OBJC_FOR_COLLECTION,
   1340       /// \brief An ObjCAtCatchStmt record.
   1341       STMT_OBJC_CATCH,
   1342       /// \brief An ObjCAtFinallyStmt record.
   1343       STMT_OBJC_FINALLY,
   1344       /// \brief An ObjCAtTryStmt record.
   1345       STMT_OBJC_AT_TRY,
   1346       /// \brief An ObjCAtSynchronizedStmt record.
   1347       STMT_OBJC_AT_SYNCHRONIZED,
   1348       /// \brief An ObjCAtThrowStmt record.
   1349       STMT_OBJC_AT_THROW,
   1350       /// \brief An ObjCAutoreleasePoolStmt record.
   1351       STMT_OBJC_AUTORELEASE_POOL,
   1352       /// \brief A ObjCBoolLiteralExpr record.
   1353       EXPR_OBJC_BOOL_LITERAL,
   1354 
   1355       // C++
   1356 
   1357       /// \brief A CXXCatchStmt record.
   1358       STMT_CXX_CATCH,
   1359       /// \brief A CXXTryStmt record.
   1360       STMT_CXX_TRY,
   1361       /// \brief A CXXForRangeStmt record.
   1362       STMT_CXX_FOR_RANGE,
   1363 
   1364       /// \brief A CXXOperatorCallExpr record.
   1365       EXPR_CXX_OPERATOR_CALL,
   1366       /// \brief A CXXMemberCallExpr record.
   1367       EXPR_CXX_MEMBER_CALL,
   1368       /// \brief A CXXConstructExpr record.
   1369       EXPR_CXX_CONSTRUCT,
   1370       /// \brief A CXXInheritedCtorInitExpr record.
   1371       EXPR_CXX_INHERITED_CTOR_INIT,
   1372       /// \brief A CXXTemporaryObjectExpr record.
   1373       EXPR_CXX_TEMPORARY_OBJECT,
   1374       /// \brief A CXXStaticCastExpr record.
   1375       EXPR_CXX_STATIC_CAST,
   1376       /// \brief A CXXDynamicCastExpr record.
   1377       EXPR_CXX_DYNAMIC_CAST,
   1378       /// \brief A CXXReinterpretCastExpr record.
   1379       EXPR_CXX_REINTERPRET_CAST,
   1380       /// \brief A CXXConstCastExpr record.
   1381       EXPR_CXX_CONST_CAST,
   1382       /// \brief A CXXFunctionalCastExpr record.
   1383       EXPR_CXX_FUNCTIONAL_CAST,
   1384       /// \brief A UserDefinedLiteral record.
   1385       EXPR_USER_DEFINED_LITERAL,
   1386       /// \brief A CXXStdInitializerListExpr record.
   1387       EXPR_CXX_STD_INITIALIZER_LIST,
   1388       /// \brief A CXXBoolLiteralExpr record.
   1389       EXPR_CXX_BOOL_LITERAL,
   1390       EXPR_CXX_NULL_PTR_LITERAL,  // CXXNullPtrLiteralExpr
   1391       EXPR_CXX_TYPEID_EXPR,       // CXXTypeidExpr (of expr).
   1392       EXPR_CXX_TYPEID_TYPE,       // CXXTypeidExpr (of type).
   1393       EXPR_CXX_THIS,              // CXXThisExpr
   1394       EXPR_CXX_THROW,             // CXXThrowExpr
   1395       EXPR_CXX_DEFAULT_ARG,       // CXXDefaultArgExpr
   1396       EXPR_CXX_DEFAULT_INIT,      // CXXDefaultInitExpr
   1397       EXPR_CXX_BIND_TEMPORARY,    // CXXBindTemporaryExpr
   1398 
   1399       EXPR_CXX_SCALAR_VALUE_INIT, // CXXScalarValueInitExpr
   1400       EXPR_CXX_NEW,               // CXXNewExpr
   1401       EXPR_CXX_DELETE,            // CXXDeleteExpr
   1402       EXPR_CXX_PSEUDO_DESTRUCTOR, // CXXPseudoDestructorExpr
   1403 
   1404       EXPR_EXPR_WITH_CLEANUPS,    // ExprWithCleanups
   1405 
   1406       EXPR_CXX_DEPENDENT_SCOPE_MEMBER,   // CXXDependentScopeMemberExpr
   1407       EXPR_CXX_DEPENDENT_SCOPE_DECL_REF, // DependentScopeDeclRefExpr
   1408       EXPR_CXX_UNRESOLVED_CONSTRUCT,     // CXXUnresolvedConstructExpr
   1409       EXPR_CXX_UNRESOLVED_MEMBER,        // UnresolvedMemberExpr
   1410       EXPR_CXX_UNRESOLVED_LOOKUP,        // UnresolvedLookupExpr
   1411 
   1412       EXPR_CXX_EXPRESSION_TRAIT,  // ExpressionTraitExpr
   1413       EXPR_CXX_NOEXCEPT,          // CXXNoexceptExpr
   1414 
   1415       EXPR_OPAQUE_VALUE,          // OpaqueValueExpr
   1416       EXPR_BINARY_CONDITIONAL_OPERATOR,  // BinaryConditionalOperator
   1417       EXPR_TYPE_TRAIT,            // TypeTraitExpr
   1418       EXPR_ARRAY_TYPE_TRAIT,      // ArrayTypeTraitIntExpr
   1419 
   1420       EXPR_PACK_EXPANSION,        // PackExpansionExpr
   1421       EXPR_SIZEOF_PACK,           // SizeOfPackExpr
   1422       EXPR_SUBST_NON_TYPE_TEMPLATE_PARM, // SubstNonTypeTemplateParmExpr
   1423       EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK,// SubstNonTypeTemplateParmPackExpr
   1424       EXPR_FUNCTION_PARM_PACK,    // FunctionParmPackExpr
   1425       EXPR_MATERIALIZE_TEMPORARY, // MaterializeTemporaryExpr
   1426       EXPR_CXX_FOLD,              // CXXFoldExpr
   1427 
   1428       // CUDA
   1429       EXPR_CUDA_KERNEL_CALL,       // CUDAKernelCallExpr
   1430 
   1431       // OpenCL
   1432       EXPR_ASTYPE,                 // AsTypeExpr
   1433 
   1434       // Microsoft
   1435       EXPR_CXX_PROPERTY_REF_EXPR, // MSPropertyRefExpr
   1436       EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR, // MSPropertySubscriptExpr
   1437       EXPR_CXX_UUIDOF_EXPR,       // CXXUuidofExpr (of expr).
   1438       EXPR_CXX_UUIDOF_TYPE,       // CXXUuidofExpr (of type).
   1439       STMT_SEH_LEAVE,             // SEHLeaveStmt
   1440       STMT_SEH_EXCEPT,            // SEHExceptStmt
   1441       STMT_SEH_FINALLY,           // SEHFinallyStmt
   1442       STMT_SEH_TRY,               // SEHTryStmt
   1443 
   1444       // OpenMP directives
   1445       STMT_OMP_PARALLEL_DIRECTIVE,
   1446       STMT_OMP_SIMD_DIRECTIVE,
   1447       STMT_OMP_FOR_DIRECTIVE,
   1448       STMT_OMP_FOR_SIMD_DIRECTIVE,
   1449       STMT_OMP_SECTIONS_DIRECTIVE,
   1450       STMT_OMP_SECTION_DIRECTIVE,
   1451       STMT_OMP_SINGLE_DIRECTIVE,
   1452       STMT_OMP_MASTER_DIRECTIVE,
   1453       STMT_OMP_CRITICAL_DIRECTIVE,
   1454       STMT_OMP_PARALLEL_FOR_DIRECTIVE,
   1455       STMT_OMP_PARALLEL_FOR_SIMD_DIRECTIVE,
   1456       STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE,
   1457       STMT_OMP_TASK_DIRECTIVE,
   1458       STMT_OMP_TASKYIELD_DIRECTIVE,
   1459       STMT_OMP_BARRIER_DIRECTIVE,
   1460       STMT_OMP_TASKWAIT_DIRECTIVE,
   1461       STMT_OMP_FLUSH_DIRECTIVE,
   1462       STMT_OMP_ORDERED_DIRECTIVE,
   1463       STMT_OMP_ATOMIC_DIRECTIVE,
   1464       STMT_OMP_TARGET_DIRECTIVE,
   1465       STMT_OMP_TARGET_DATA_DIRECTIVE,
   1466       STMT_OMP_TARGET_ENTER_DATA_DIRECTIVE,
   1467       STMT_OMP_TARGET_EXIT_DATA_DIRECTIVE,
   1468       STMT_OMP_TARGET_PARALLEL_DIRECTIVE,
   1469       STMT_OMP_TARGET_PARALLEL_FOR_DIRECTIVE,
   1470       STMT_OMP_TEAMS_DIRECTIVE,
   1471       STMT_OMP_TASKGROUP_DIRECTIVE,
   1472       STMT_OMP_CANCELLATION_POINT_DIRECTIVE,
   1473       STMT_OMP_CANCEL_DIRECTIVE,
   1474       STMT_OMP_TASKLOOP_DIRECTIVE,
   1475       STMT_OMP_TASKLOOP_SIMD_DIRECTIVE,
   1476       STMT_OMP_DISTRIBUTE_DIRECTIVE,
   1477       STMT_OMP_TARGET_UPDATE_DIRECTIVE,
   1478       STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE,
   1479       STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE,
   1480       STMT_OMP_DISTRIBUTE_SIMD_DIRECTIVE,
   1481       STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE,
   1482       EXPR_OMP_ARRAY_SECTION,
   1483 
   1484       // ARC
   1485       EXPR_OBJC_BRIDGED_CAST,     // ObjCBridgedCastExpr
   1486 
   1487       STMT_MS_DEPENDENT_EXISTS,   // MSDependentExistsStmt
   1488       EXPR_LAMBDA                 // LambdaExpr
   1489     };
   1490 
   1491     /// \brief The kinds of designators that can occur in a
   1492     /// DesignatedInitExpr.
   1493     enum DesignatorTypes {
   1494       /// \brief Field designator where only the field name is known.
   1495       DESIG_FIELD_NAME  = 0,
   1496       /// \brief Field designator where the field has been resolved to
   1497       /// a declaration.
   1498       DESIG_FIELD_DECL  = 1,
   1499       /// \brief Array designator.
   1500       DESIG_ARRAY       = 2,
   1501       /// \brief GNU array range designator.
   1502       DESIG_ARRAY_RANGE = 3
   1503     };
   1504 
   1505     /// \brief The different kinds of data that can occur in a
   1506     /// CtorInitializer.
   1507     enum CtorInitializerType {
   1508       CTOR_INITIALIZER_BASE,
   1509       CTOR_INITIALIZER_DELEGATING,
   1510       CTOR_INITIALIZER_MEMBER,
   1511       CTOR_INITIALIZER_INDIRECT_MEMBER
   1512     };
   1513 
   1514     /// \brief Describes the redeclarations of a declaration.
   1515     struct LocalRedeclarationsInfo {
   1516       DeclID FirstID;      // The ID of the first declaration
   1517       unsigned Offset;     // Offset into the array of redeclaration chains.
   1518 
   1519       friend bool operator<(const LocalRedeclarationsInfo &X,
   1520                             const LocalRedeclarationsInfo &Y) {
   1521         return X.FirstID < Y.FirstID;
   1522       }
   1523 
   1524       friend bool operator>(const LocalRedeclarationsInfo &X,
   1525                             const LocalRedeclarationsInfo &Y) {
   1526         return X.FirstID > Y.FirstID;
   1527       }
   1528 
   1529       friend bool operator<=(const LocalRedeclarationsInfo &X,
   1530                              const LocalRedeclarationsInfo &Y) {
   1531         return X.FirstID <= Y.FirstID;
   1532       }
   1533 
   1534       friend bool operator>=(const LocalRedeclarationsInfo &X,
   1535                              const LocalRedeclarationsInfo &Y) {
   1536         return X.FirstID >= Y.FirstID;
   1537       }
   1538     };
   1539 
   1540     /// \brief Describes the categories of an Objective-C class.
   1541     struct ObjCCategoriesInfo {
   1542       DeclID DefinitionID; // The ID of the definition
   1543       unsigned Offset;     // Offset into the array of category lists.
   1544 
   1545       friend bool operator<(const ObjCCategoriesInfo &X,
   1546                             const ObjCCategoriesInfo &Y) {
   1547         return X.DefinitionID < Y.DefinitionID;
   1548       }
   1549 
   1550       friend bool operator>(const ObjCCategoriesInfo &X,
   1551                             const ObjCCategoriesInfo &Y) {
   1552         return X.DefinitionID > Y.DefinitionID;
   1553       }
   1554 
   1555       friend bool operator<=(const ObjCCategoriesInfo &X,
   1556                              const ObjCCategoriesInfo &Y) {
   1557         return X.DefinitionID <= Y.DefinitionID;
   1558       }
   1559 
   1560       friend bool operator>=(const ObjCCategoriesInfo &X,
   1561                              const ObjCCategoriesInfo &Y) {
   1562         return X.DefinitionID >= Y.DefinitionID;
   1563       }
   1564     };
   1565 
   1566     /// \brief A key used when looking up entities by \ref DeclarationName.
   1567     ///
   1568     /// Different \ref DeclarationNames are mapped to different keys, but the
   1569     /// same key can occasionally represent multiple names (for names that
   1570     /// contain types, in particular).
   1571     class DeclarationNameKey {
   1572       typedef unsigned NameKind;
   1573 
   1574       NameKind Kind;
   1575       uint64_t Data;
   1576 
   1577     public:
   1578       DeclarationNameKey() : Kind(), Data() {}
   1579       DeclarationNameKey(DeclarationName Name);
   1580 
   1581       DeclarationNameKey(NameKind Kind, uint64_t Data)
   1582           : Kind(Kind), Data(Data) {}
   1583 
   1584       NameKind getKind() const { return Kind; }
   1585 
   1586       IdentifierInfo *getIdentifier() const {
   1587         assert(Kind == DeclarationName::Identifier ||
   1588                Kind == DeclarationName::CXXLiteralOperatorName);
   1589         return (IdentifierInfo *)Data;
   1590       }
   1591       Selector getSelector() const {
   1592         assert(Kind == DeclarationName::ObjCZeroArgSelector ||
   1593                Kind == DeclarationName::ObjCOneArgSelector ||
   1594                Kind == DeclarationName::ObjCMultiArgSelector);
   1595         return Selector(Data);
   1596       }
   1597       OverloadedOperatorKind getOperatorKind() const {
   1598         assert(Kind == DeclarationName::CXXOperatorName);
   1599         return (OverloadedOperatorKind)Data;
   1600       }
   1601 
   1602       /// Compute a fingerprint of this key for use in on-disk hash table.
   1603       unsigned getHash() const;
   1604 
   1605       friend bool operator==(const DeclarationNameKey &A,
   1606                              const DeclarationNameKey &B) {
   1607         return A.Kind == B.Kind && A.Data == B.Data;
   1608       }
   1609     };
   1610 
   1611     /// @}
   1612   }
   1613 } // end namespace clang
   1614 
   1615 namespace llvm {
   1616   template <> struct DenseMapInfo<clang::serialization::DeclarationNameKey> {
   1617     static clang::serialization::DeclarationNameKey getEmptyKey() {
   1618       return clang::serialization::DeclarationNameKey(-1, 1);
   1619     }
   1620     static clang::serialization::DeclarationNameKey getTombstoneKey() {
   1621       return clang::serialization::DeclarationNameKey(-1, 2);
   1622     }
   1623     static unsigned
   1624     getHashValue(const clang::serialization::DeclarationNameKey &Key) {
   1625       return Key.getHash();
   1626     }
   1627     static bool isEqual(const clang::serialization::DeclarationNameKey &L,
   1628                         const clang::serialization::DeclarationNameKey &R) {
   1629       return L == R;
   1630     }
   1631   };
   1632 }
   1633 
   1634 #endif
   1635