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