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