• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_FRONTEND_PCHBITCODES_H
18 #define LLVM_CLANG_FRONTEND_PCHBITCODES_H
19 
20 #include "clang/AST/Type.h"
21 #include "llvm/Bitcode/BitCodes.h"
22 #include "llvm/Support/DataTypes.h"
23 #include "llvm/ADT/DenseMap.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 = 4;
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 a declaration in an AST file.
51     ///
52     /// The ID numbers of declarations are consecutive (in order of
53     /// discovery) and start at 2. 0 is reserved for NULL, and 1 is
54     /// reserved for the translation unit declaration.
55     typedef uint32_t DeclID;
56 
57     /// \brief a Decl::Kind/DeclID pair.
58     typedef std::pair<uint32_t, DeclID> KindDeclIDPair;
59 
60     /// \brief An ID number that refers to a type in an AST file.
61     ///
62     /// The ID of a type is partitioned into two parts: the lower
63     /// three bits are used to store the const/volatile/restrict
64     /// qualifiers (as with QualType) and the upper bits provide a
65     /// type index. The type index values are partitioned into two
66     /// sets. The values below NUM_PREDEF_TYPE_IDs are predefined type
67     /// IDs (based on the PREDEF_TYPE_*_ID constants), with 0 as a
68     /// placeholder for "no type". Values from NUM_PREDEF_TYPE_IDs are
69     /// other types that have serialized representations.
70     typedef uint32_t TypeID;
71 
72     /// \brief A type index; the type ID with the qualifier bits removed.
73     class TypeIdx {
74       uint32_t Idx;
75     public:
TypeIdx()76       TypeIdx() : Idx(0) { }
TypeIdx(uint32_t index)77       explicit TypeIdx(uint32_t index) : Idx(index) { }
78 
getIndex()79       uint32_t getIndex() const { return Idx; }
asTypeID(unsigned FastQuals)80       TypeID asTypeID(unsigned FastQuals) const {
81         return (Idx << Qualifiers::FastWidth) | FastQuals;
82       }
fromTypeID(TypeID ID)83       static TypeIdx fromTypeID(TypeID ID) {
84         return TypeIdx(ID >> Qualifiers::FastWidth);
85       }
86     };
87 
88     /// A structure for putting "fast"-unqualified QualTypes into a
89     /// DenseMap.  This uses the standard pointer hash function.
90     struct UnsafeQualTypeDenseMapInfo {
isEqualUnsafeQualTypeDenseMapInfo91       static inline bool isEqual(QualType A, QualType B) { return A == B; }
getEmptyKeyUnsafeQualTypeDenseMapInfo92       static inline QualType getEmptyKey() {
93         return QualType::getFromOpaquePtr((void*) 1);
94       }
getTombstoneKeyUnsafeQualTypeDenseMapInfo95       static inline QualType getTombstoneKey() {
96         return QualType::getFromOpaquePtr((void*) 2);
97       }
getHashValueUnsafeQualTypeDenseMapInfo98       static inline unsigned getHashValue(QualType T) {
99         assert(!T.getLocalFastQualifiers() &&
100                "hash invalid for types with fast quals");
101         uintptr_t v = reinterpret_cast<uintptr_t>(T.getAsOpaquePtr());
102         return (unsigned(v) >> 4) ^ (unsigned(v) >> 9);
103       }
104     };
105 
106     /// \brief Map that provides the ID numbers of each type within the
107     /// output stream, plus those deserialized from a chained PCH.
108     ///
109     /// The ID numbers of types are consecutive (in order of discovery)
110     /// and start at 1. 0 is reserved for NULL. When types are actually
111     /// stored in the stream, the ID number is shifted by 2 bits to
112     /// allow for the const/volatile qualifiers.
113     ///
114     /// Keys in the map never have const/volatile qualifiers.
115     typedef llvm::DenseMap<QualType, TypeIdx, UnsafeQualTypeDenseMapInfo>
116         TypeIdxMap;
117 
118     /// \brief An ID number that refers to an identifier in an AST file.
119     typedef uint32_t IdentID;
120 
121     /// \brief An ID number that refers to a macro in an AST file.
122     typedef uint32_t MacroID;
123 
124     /// \brief An ID number that refers to an ObjC selctor in an AST file.
125     typedef uint32_t SelectorID;
126 
127     /// \brief An ID number that refers to a set of CXXBaseSpecifiers in an
128     /// AST file.
129     typedef uint32_t CXXBaseSpecifiersID;
130 
131     /// \brief Describes the various kinds of blocks that occur within
132     /// an AST file.
133     enum BlockIDs {
134       /// \brief The AST block, which acts as a container around the
135       /// full AST block.
136       AST_BLOCK_ID = llvm::bitc::FIRST_APPLICATION_BLOCKID,
137 
138       /// \brief The block containing information about the source
139       /// manager.
140       SOURCE_MANAGER_BLOCK_ID,
141 
142       /// \brief The block containing information about the
143       /// preprocessor.
144       PREPROCESSOR_BLOCK_ID,
145 
146       /// \brief The block containing the definitions of all of the
147       /// types and decls used within the AST file.
148       DECLTYPES_BLOCK_ID,
149 
150       /// \brief The block containing DECL_UPDATES records.
151       DECL_UPDATES_BLOCK_ID,
152 
153       /// \brief The block containing the detailed preprocessing record.
154       PREPROCESSOR_DETAIL_BLOCK_ID
155     };
156 
157     /// \brief Record types that occur within the AST block itself.
158     enum ASTRecordTypes {
159       /// \brief Record code for the offsets of each type.
160       ///
161       /// The TYPE_OFFSET constant describes the record that occurs
162       /// within the AST block. The record itself is an array of offsets that
163       /// point into the declarations and types block (identified by
164       /// DECLTYPES_BLOCK_ID). The index into the array is based on the ID
165       /// of a type. For a given type ID @c T, the lower three bits of
166       /// @c T are its qualifiers (const, volatile, restrict), as in
167       /// the QualType class. The upper bits, after being shifted and
168       /// subtracting NUM_PREDEF_TYPE_IDS, are used to index into the
169       /// TYPE_OFFSET block to determine the offset of that type's
170       /// corresponding record within the DECLTYPES_BLOCK_ID block.
171       TYPE_OFFSET = 1,
172 
173       /// \brief Record code for the offsets of each decl.
174       ///
175       /// The DECL_OFFSET constant describes the record that occurs
176       /// within the block identified by DECL_OFFSETS_BLOCK_ID within
177       /// the AST block. The record itself is an array of offsets that
178       /// point into the declarations and types block (identified by
179       /// DECLTYPES_BLOCK_ID). The declaration ID is an index into this
180       /// record, after subtracting one to account for the use of
181       /// declaration ID 0 for a NULL declaration pointer. Index 0 is
182       /// reserved for the translation unit declaration.
183       DECL_OFFSET = 2,
184 
185       /// \brief Record code for the language options table.
186       ///
187       /// The record with this code contains the contents of the
188       /// LangOptions structure. We serialize the entire contents of
189       /// the structure, and let the reader decide which options are
190       /// actually important to check.
191       LANGUAGE_OPTIONS = 3,
192 
193       /// \brief AST file metadata, including the AST file version number
194       /// and the target triple used to build the AST file.
195       METADATA = 4,
196 
197       /// \brief Record code for the table of offsets of each
198       /// identifier ID.
199       ///
200       /// The offset table contains offsets into the blob stored in
201       /// the IDENTIFIER_TABLE record. Each offset points to the
202       /// NULL-terminated string that corresponds to that identifier.
203       IDENTIFIER_OFFSET = 5,
204 
205       /// \brief Record code for the identifier table.
206       ///
207       /// The identifier table is a simple blob that contains
208       /// NULL-terminated strings for all of the identifiers
209       /// referenced by the AST file. The IDENTIFIER_OFFSET table
210       /// contains the mapping from identifier IDs to the characters
211       /// in this blob. Note that the starting offsets of all of the
212       /// identifiers are odd, so that, when the identifier offset
213       /// table is loaded in, we can use the low bit to distinguish
214       /// between offsets (for unresolved identifier IDs) and
215       /// IdentifierInfo pointers (for already-resolved identifier
216       /// IDs).
217       IDENTIFIER_TABLE = 6,
218 
219       /// \brief Record code for the array of external definitions.
220       ///
221       /// The AST file contains a list of all of the unnamed external
222       /// definitions present within the parsed headers, stored as an
223       /// array of declaration IDs. These external definitions will be
224       /// reported to the AST consumer after the AST file has been
225       /// read, since their presence can affect the semantics of the
226       /// program (e.g., for code generation).
227       EXTERNAL_DEFINITIONS = 7,
228 
229       /// \brief Record code for the set of non-builtin, special
230       /// types.
231       ///
232       /// This record contains the type IDs for the various type nodes
233       /// that are constructed during semantic analysis (e.g.,
234       /// __builtin_va_list). The SPECIAL_TYPE_* constants provide
235       /// offsets into this record.
236       SPECIAL_TYPES = 8,
237 
238       /// \brief Record code for the extra statistics we gather while
239       /// generating an AST file.
240       STATISTICS = 9,
241 
242       /// \brief Record code for the array of tentative definitions.
243       TENTATIVE_DEFINITIONS = 10,
244 
245       /// \brief Record code for the array of locally-scoped external
246       /// declarations.
247       LOCALLY_SCOPED_EXTERNAL_DECLS = 11,
248 
249       /// \brief Record code for the table of offsets into the
250       /// Objective-C method pool.
251       SELECTOR_OFFSETS = 12,
252 
253       /// \brief Record code for the Objective-C method pool,
254       METHOD_POOL = 13,
255 
256       /// \brief The value of the next __COUNTER__ to dispense.
257       /// [PP_COUNTER_VALUE, Val]
258       PP_COUNTER_VALUE = 14,
259 
260       /// \brief Record code for the table of offsets into the block
261       /// of source-location information.
262       SOURCE_LOCATION_OFFSETS = 15,
263 
264       /// \brief Record code for the set of source location entries
265       /// that need to be preloaded by the AST reader.
266       ///
267       /// This set contains the source location entry for the
268       /// predefines buffer and for any file entries that need to be
269       /// preloaded.
270       SOURCE_LOCATION_PRELOADS = 16,
271 
272       /// \brief Record code for the stat() cache.
273       STAT_CACHE = 17,
274 
275       /// \brief Record code for the set of ext_vector type names.
276       EXT_VECTOR_DECLS = 18,
277 
278       /// \brief Record code for the original file that was used to
279       /// generate the AST file.
280       ORIGINAL_FILE_NAME = 19,
281 
282       /// \brief Record code for the file ID of the original file used to
283       /// generate the AST file.
284       ORIGINAL_FILE_ID = 20,
285 
286       /// \brief Record code for the version control branch and revision
287       /// information of the compiler used to build this AST file.
288       VERSION_CONTROL_BRANCH_REVISION = 21,
289 
290       /// \brief Record code for the array of unused file scoped decls.
291       UNUSED_FILESCOPED_DECLS = 22,
292 
293       /// \brief Record code for the table of offsets to macro definition
294       /// entries in the preprocessing record.
295       MACRO_DEFINITION_OFFSETS = 23,
296 
297       /// \brief Record code for the array of VTable uses.
298       VTABLE_USES = 24,
299 
300       /// \brief Record code for the array of dynamic classes.
301       DYNAMIC_CLASSES = 25,
302 
303       /// \brief Record code for the chained AST metadata, including the
304       /// AST file version and the name of the PCH this depends on.
305       CHAINED_METADATA = 26,
306 
307       /// \brief Record code for referenced selector pool.
308       REFERENCED_SELECTOR_POOL = 27,
309 
310       /// \brief Record code for an update to the TU's lexically contained
311       /// declarations.
312       TU_UPDATE_LEXICAL = 28,
313 
314       /// \brief Record code for an update to first decls pointing to the
315       /// latest redeclarations.
316       REDECLS_UPDATE_LATEST = 29,
317 
318       /// \brief Record code for declarations that Sema keeps references of.
319       SEMA_DECL_REFS = 30,
320 
321       /// \brief Record code for weak undeclared identifiers.
322       WEAK_UNDECLARED_IDENTIFIERS = 31,
323 
324       /// \brief Record code for pending implicit instantiations.
325       PENDING_IMPLICIT_INSTANTIATIONS = 32,
326 
327       /// \brief Record code for a decl replacement block.
328       ///
329       /// If a declaration is modified after having been deserialized, and then
330       /// written to a dependent AST file, its ID and offset must be added to
331       /// the replacement block.
332       DECL_REPLACEMENTS = 33,
333 
334       /// \brief Record code for an update to a decl context's lookup table.
335       ///
336       /// In practice, this should only be used for the TU and namespaces.
337       UPDATE_VISIBLE = 34,
338 
339       /// \brief Record for offsets of DECL_UPDATES records for declarations
340       /// that were modified after being deserialized and need updates.
341       DECL_UPDATE_OFFSETS = 35,
342 
343       /// \brief Record of updates for a declaration that was modified after
344       /// being deserialized.
345       DECL_UPDATES = 36,
346 
347       /// \brief Record code for the table of offsets to CXXBaseSpecifier
348       /// sets.
349       CXX_BASE_SPECIFIER_OFFSETS = 37,
350 
351       /// \brief Record code for #pragma diagnostic mappings.
352       DIAG_PRAGMA_MAPPINGS = 38,
353 
354       /// \brief Record code for special CUDA declarations.
355       CUDA_SPECIAL_DECL_REFS = 39,
356 
357       /// \brief Record code for header search information.
358       HEADER_SEARCH_TABLE = 40,
359 
360       /// \brief The directory that the PCH was originally created in.
361       ORIGINAL_PCH_DIR = 41,
362 
363       /// \brief Record code for floating point #pragma options.
364       FP_PRAGMA_OPTIONS = 42,
365 
366       /// \brief Record code for enabled OpenCL extensions.
367       OPENCL_EXTENSIONS = 43,
368 
369       /// \brief The list of delegating constructor declarations.
370       DELEGATING_CTORS = 44,
371 
372       /// \brief Record code for the table of offsets into the block
373       /// of file source-location information.
374       FILE_SOURCE_LOCATION_OFFSETS = 45,
375 
376       /// \brief Record code for the set of known namespaces, which are used
377       /// for typo correction.
378       KNOWN_NAMESPACES = 46,
379 
380       /// \brief Record code for the source location remapping information.
381       SOURCE_LOCATION_MAP = 47,
382 
383       /// \brief Record code for the source manager line table information,
384       /// which stores information about #line directives.
385       SOURCE_MANAGER_LINE_TABLE = 48
386     };
387 
388     /// \brief Record types used within a source manager block.
389     enum SourceManagerRecordTypes {
390       /// \brief Describes a source location entry (SLocEntry) for a
391       /// file.
392       SM_SLOC_FILE_ENTRY = 1,
393       /// \brief Describes a source location entry (SLocEntry) for a
394       /// buffer.
395       SM_SLOC_BUFFER_ENTRY = 2,
396       /// \brief Describes a blob that contains the data for a buffer
397       /// entry. This kind of record always directly follows a
398       /// SM_SLOC_BUFFER_ENTRY record.
399       SM_SLOC_BUFFER_BLOB = 3,
400       /// \brief Describes a source location entry (SLocEntry) for a
401       /// macro expansion.
402       SM_SLOC_EXPANSION_ENTRY = 4
403     };
404 
405     /// \brief Record types used within a preprocessor block.
406     enum PreprocessorRecordTypes {
407       // The macros in the PP section are a PP_MACRO_* instance followed by a
408       // list of PP_TOKEN instances for each token in the definition.
409 
410       /// \brief An object-like macro definition.
411       /// [PP_MACRO_OBJECT_LIKE, IdentInfoID, SLoc, IsUsed]
412       PP_MACRO_OBJECT_LIKE = 1,
413 
414       /// \brief A function-like macro definition.
415       /// [PP_MACRO_FUNCTION_LIKE, <ObjectLikeStuff>, IsC99Varargs, IsGNUVarars,
416       ///  NumArgs, ArgIdentInfoID* ]
417       PP_MACRO_FUNCTION_LIKE = 2,
418 
419       /// \brief Describes one token.
420       /// [PP_TOKEN, SLoc, Length, IdentInfoID, Kind, Flags]
421       PP_TOKEN = 3
422     };
423 
424     /// \brief Record types used within a preprocessor detail block.
425     enum PreprocessorDetailRecordTypes {
426       /// \brief Describes a macro expansion within the preprocessing record.
427       PPD_MACRO_EXPANSION = 0,
428 
429       /// \brief Describes a macro definition within the preprocessing record.
430       PPD_MACRO_DEFINITION = 1,
431 
432       /// \brief Describes an inclusion directive within the preprocessing
433       /// record.
434       PPD_INCLUSION_DIRECTIVE = 2
435     };
436 
437     /// \defgroup ASTAST AST file AST constants
438     ///
439     /// The constants in this group describe various components of the
440     /// abstract syntax tree within an AST file.
441     ///
442     /// @{
443 
444     /// \brief Predefined type IDs.
445     ///
446     /// These type IDs correspond to predefined types in the AST
447     /// context, such as built-in types (int) and special place-holder
448     /// types (the <overload> and <dependent> type markers). Such
449     /// types are never actually serialized, since they will be built
450     /// by the AST context when it is created.
451     enum PredefinedTypeIDs {
452       /// \brief The NULL type.
453       PREDEF_TYPE_NULL_ID       = 0,
454       /// \brief The void type.
455       PREDEF_TYPE_VOID_ID       = 1,
456       /// \brief The 'bool' or '_Bool' type.
457       PREDEF_TYPE_BOOL_ID       = 2,
458       /// \brief The 'char' type, when it is unsigned.
459       PREDEF_TYPE_CHAR_U_ID     = 3,
460       /// \brief The 'unsigned char' type.
461       PREDEF_TYPE_UCHAR_ID      = 4,
462       /// \brief The 'unsigned short' type.
463       PREDEF_TYPE_USHORT_ID     = 5,
464       /// \brief The 'unsigned int' type.
465       PREDEF_TYPE_UINT_ID       = 6,
466       /// \brief The 'unsigned long' type.
467       PREDEF_TYPE_ULONG_ID      = 7,
468       /// \brief The 'unsigned long long' type.
469       PREDEF_TYPE_ULONGLONG_ID  = 8,
470       /// \brief The 'char' type, when it is signed.
471       PREDEF_TYPE_CHAR_S_ID     = 9,
472       /// \brief The 'signed char' type.
473       PREDEF_TYPE_SCHAR_ID      = 10,
474       /// \brief The C++ 'wchar_t' type.
475       PREDEF_TYPE_WCHAR_ID      = 11,
476       /// \brief The (signed) 'short' type.
477       PREDEF_TYPE_SHORT_ID      = 12,
478       /// \brief The (signed) 'int' type.
479       PREDEF_TYPE_INT_ID        = 13,
480       /// \brief The (signed) 'long' type.
481       PREDEF_TYPE_LONG_ID       = 14,
482       /// \brief The (signed) 'long long' type.
483       PREDEF_TYPE_LONGLONG_ID   = 15,
484       /// \brief The 'float' type.
485       PREDEF_TYPE_FLOAT_ID      = 16,
486       /// \brief The 'double' type.
487       PREDEF_TYPE_DOUBLE_ID     = 17,
488       /// \brief The 'long double' type.
489       PREDEF_TYPE_LONGDOUBLE_ID = 18,
490       /// \brief The placeholder type for overloaded function sets.
491       PREDEF_TYPE_OVERLOAD_ID   = 19,
492       /// \brief The placeholder type for dependent types.
493       PREDEF_TYPE_DEPENDENT_ID  = 20,
494       /// \brief The '__uint128_t' type.
495       PREDEF_TYPE_UINT128_ID    = 21,
496       /// \brief The '__int128_t' type.
497       PREDEF_TYPE_INT128_ID     = 22,
498       /// \brief The type of 'nullptr'.
499       PREDEF_TYPE_NULLPTR_ID    = 23,
500       /// \brief The C++ 'char16_t' type.
501       PREDEF_TYPE_CHAR16_ID     = 24,
502       /// \brief The C++ 'char32_t' type.
503       PREDEF_TYPE_CHAR32_ID     = 25,
504       /// \brief The ObjC 'id' type.
505       PREDEF_TYPE_OBJC_ID       = 26,
506       /// \brief The ObjC 'Class' type.
507       PREDEF_TYPE_OBJC_CLASS    = 27,
508       /// \brief The ObjC 'SEL' type.
509       PREDEF_TYPE_OBJC_SEL      = 28,
510       /// \brief The 'unknown any' placeholder type.
511       PREDEF_TYPE_UNKNOWN_ANY   = 29,
512       /// \brief The placeholder type for bound member functions.
513       PREDEF_TYPE_BOUND_MEMBER  = 30
514     };
515 
516     /// \brief The number of predefined type IDs that are reserved for
517     /// the PREDEF_TYPE_* constants.
518     ///
519     /// Type IDs for non-predefined types will start at
520     /// NUM_PREDEF_TYPE_IDs.
521     const unsigned NUM_PREDEF_TYPE_IDS = 100;
522 
523     /// \brief The number of allowed abbreviations in bits
524     const unsigned NUM_ALLOWED_ABBREVS_SIZE = 4;
525 
526     /// \brief Record codes for each kind of type.
527     ///
528     /// These constants describe the type records that can occur within a
529     /// block identified by DECLTYPES_BLOCK_ID in the AST file. Each
530     /// constant describes a record for a specific type class in the
531     /// AST.
532     enum TypeCode {
533       /// \brief An ExtQualType record.
534       TYPE_EXT_QUAL                 = 1,
535       /// \brief A ComplexType record.
536       TYPE_COMPLEX                  = 3,
537       /// \brief A PointerType record.
538       TYPE_POINTER                  = 4,
539       /// \brief A BlockPointerType record.
540       TYPE_BLOCK_POINTER            = 5,
541       /// \brief An LValueReferenceType record.
542       TYPE_LVALUE_REFERENCE         = 6,
543       /// \brief An RValueReferenceType record.
544       TYPE_RVALUE_REFERENCE         = 7,
545       /// \brief A MemberPointerType record.
546       TYPE_MEMBER_POINTER           = 8,
547       /// \brief A ConstantArrayType record.
548       TYPE_CONSTANT_ARRAY           = 9,
549       /// \brief An IncompleteArrayType record.
550       TYPE_INCOMPLETE_ARRAY         = 10,
551       /// \brief A VariableArrayType record.
552       TYPE_VARIABLE_ARRAY           = 11,
553       /// \brief A VectorType record.
554       TYPE_VECTOR                   = 12,
555       /// \brief An ExtVectorType record.
556       TYPE_EXT_VECTOR               = 13,
557       /// \brief A FunctionNoProtoType record.
558       TYPE_FUNCTION_NO_PROTO        = 14,
559       /// \brief A FunctionProtoType record.
560       TYPE_FUNCTION_PROTO           = 15,
561       /// \brief A TypedefType record.
562       TYPE_TYPEDEF                  = 16,
563       /// \brief A TypeOfExprType record.
564       TYPE_TYPEOF_EXPR              = 17,
565       /// \brief A TypeOfType record.
566       TYPE_TYPEOF                   = 18,
567       /// \brief A RecordType record.
568       TYPE_RECORD                   = 19,
569       /// \brief An EnumType record.
570       TYPE_ENUM                     = 20,
571       /// \brief An ObjCInterfaceType record.
572       TYPE_OBJC_INTERFACE           = 21,
573       /// \brief An ObjCObjectPointerType record.
574       TYPE_OBJC_OBJECT_POINTER      = 22,
575       /// \brief a DecltypeType record.
576       TYPE_DECLTYPE                 = 23,
577       /// \brief An ElaboratedType record.
578       TYPE_ELABORATED               = 24,
579       /// \brief A SubstTemplateTypeParmType record.
580       TYPE_SUBST_TEMPLATE_TYPE_PARM = 25,
581       /// \brief An UnresolvedUsingType record.
582       TYPE_UNRESOLVED_USING         = 26,
583       /// \brief An InjectedClassNameType record.
584       TYPE_INJECTED_CLASS_NAME      = 27,
585       /// \brief An ObjCObjectType record.
586       TYPE_OBJC_OBJECT              = 28,
587       /// \brief An TemplateTypeParmType record.
588       TYPE_TEMPLATE_TYPE_PARM       = 29,
589       /// \brief An TemplateSpecializationType record.
590       TYPE_TEMPLATE_SPECIALIZATION  = 30,
591       /// \brief A DependentNameType record.
592       TYPE_DEPENDENT_NAME           = 31,
593       /// \brief A DependentTemplateSpecializationType record.
594       TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION = 32,
595       /// \brief A DependentSizedArrayType record.
596       TYPE_DEPENDENT_SIZED_ARRAY    = 33,
597       /// \brief A ParenType record.
598       TYPE_PAREN                    = 34,
599       /// \brief A PackExpansionType record.
600       TYPE_PACK_EXPANSION           = 35,
601       /// \brief An AttributedType record.
602       TYPE_ATTRIBUTED               = 36,
603       /// \brief A SubstTemplateTypeParmPackType record.
604       TYPE_SUBST_TEMPLATE_TYPE_PARM_PACK = 37,
605       /// \brief A AutoType record.
606       TYPE_AUTO                  = 38,
607       /// \brief A UnaryTransformType record.
608       TYPE_UNARY_TRANSFORM       = 39
609     };
610 
611     /// \brief The type IDs for special types constructed by semantic
612     /// analysis.
613     ///
614     /// The constants in this enumeration are indices into the
615     /// SPECIAL_TYPES record.
616     enum SpecialTypeIDs {
617       /// \brief __builtin_va_list
618       SPECIAL_TYPE_BUILTIN_VA_LIST             = 0,
619       /// \brief Objective-C "id" type
620       SPECIAL_TYPE_OBJC_ID                     = 1,
621       /// \brief Objective-C selector type
622       SPECIAL_TYPE_OBJC_SELECTOR               = 2,
623       /// \brief Objective-C Protocol type
624       SPECIAL_TYPE_OBJC_PROTOCOL               = 3,
625       /// \brief Objective-C Class type
626       SPECIAL_TYPE_OBJC_CLASS                  = 4,
627       /// \brief CFConstantString type
628       SPECIAL_TYPE_CF_CONSTANT_STRING          = 5,
629       /// \brief Objective-C fast enumeration state type
630       SPECIAL_TYPE_OBJC_FAST_ENUMERATION_STATE = 6,
631       /// \brief C FILE typedef type
632       SPECIAL_TYPE_FILE                        = 7,
633       /// \brief C jmp_buf typedef type
634       SPECIAL_TYPE_jmp_buf                     = 8,
635       /// \brief C sigjmp_buf typedef type
636       SPECIAL_TYPE_sigjmp_buf                  = 9,
637       /// \brief Objective-C "id" redefinition type
638       SPECIAL_TYPE_OBJC_ID_REDEFINITION        = 10,
639       /// \brief Objective-C "Class" redefinition type
640       SPECIAL_TYPE_OBJC_CLASS_REDEFINITION     = 11,
641       /// \brief Block descriptor type for Blocks CodeGen
642       SPECIAL_TYPE_BLOCK_DESCRIPTOR            = 12,
643       /// \brief Block extedned descriptor type for Blocks CodeGen
644       SPECIAL_TYPE_BLOCK_EXTENDED_DESCRIPTOR   = 13,
645       /// \brief Objective-C "SEL" redefinition type
646       SPECIAL_TYPE_OBJC_SEL_REDEFINITION       = 14,
647       /// \brief NSConstantString type
648       SPECIAL_TYPE_NS_CONSTANT_STRING          = 15,
649       /// \brief Whether __[u]int128_t identifier is installed.
650       SPECIAL_TYPE_INT128_INSTALLED            = 16,
651       /// \brief Cached "auto" deduction type.
652       SPECIAL_TYPE_AUTO_DEDUCT                 = 17,
653       /// \brief Cached "auto &&" deduction type.
654       SPECIAL_TYPE_AUTO_RREF_DEDUCT            = 18
655     };
656 
657     /// \brief Record codes for each kind of declaration.
658     ///
659     /// These constants describe the declaration records that can occur within
660     /// a declarations block (identified by DECLS_BLOCK_ID). Each
661     /// constant describes a record for a specific declaration class
662     /// in the AST.
663     enum DeclCode {
664       /// \brief A TranslationUnitDecl record.
665       DECL_TRANSLATION_UNIT = 50,
666       /// \brief A TypedefDecl record.
667       DECL_TYPEDEF,
668       /// \brief A TypeAliasDecl record.
669       DECL_TYPEALIAS,
670       /// \brief An EnumDecl record.
671       DECL_ENUM,
672       /// \brief A RecordDecl record.
673       DECL_RECORD,
674       /// \brief An EnumConstantDecl record.
675       DECL_ENUM_CONSTANT,
676       /// \brief A FunctionDecl record.
677       DECL_FUNCTION,
678       /// \brief A ObjCMethodDecl record.
679       DECL_OBJC_METHOD,
680       /// \brief A ObjCInterfaceDecl record.
681       DECL_OBJC_INTERFACE,
682       /// \brief A ObjCProtocolDecl record.
683       DECL_OBJC_PROTOCOL,
684       /// \brief A ObjCIvarDecl record.
685       DECL_OBJC_IVAR,
686       /// \brief A ObjCAtDefsFieldDecl record.
687       DECL_OBJC_AT_DEFS_FIELD,
688       /// \brief A ObjCClassDecl record.
689       DECL_OBJC_CLASS,
690       /// \brief A ObjCForwardProtocolDecl record.
691       DECL_OBJC_FORWARD_PROTOCOL,
692       /// \brief A ObjCCategoryDecl record.
693       DECL_OBJC_CATEGORY,
694       /// \brief A ObjCCategoryImplDecl record.
695       DECL_OBJC_CATEGORY_IMPL,
696       /// \brief A ObjCImplementationDecl record.
697       DECL_OBJC_IMPLEMENTATION,
698       /// \brief A ObjCCompatibleAliasDecl record.
699       DECL_OBJC_COMPATIBLE_ALIAS,
700       /// \brief A ObjCPropertyDecl record.
701       DECL_OBJC_PROPERTY,
702       /// \brief A ObjCPropertyImplDecl record.
703       DECL_OBJC_PROPERTY_IMPL,
704       /// \brief A FieldDecl record.
705       DECL_FIELD,
706       /// \brief A VarDecl record.
707       DECL_VAR,
708       /// \brief An ImplicitParamDecl record.
709       DECL_IMPLICIT_PARAM,
710       /// \brief A ParmVarDecl record.
711       DECL_PARM_VAR,
712       /// \brief A FileScopeAsmDecl record.
713       DECL_FILE_SCOPE_ASM,
714       /// \brief A BlockDecl record.
715       DECL_BLOCK,
716       /// \brief A record that stores the set of declarations that are
717       /// lexically stored within a given DeclContext.
718       ///
719       /// The record itself is a blob that is an array of declaration IDs,
720       /// in the order in which those declarations were added to the
721       /// declaration context. This data is used when iterating over
722       /// the contents of a DeclContext, e.g., via
723       /// DeclContext::decls_begin()/DeclContext::decls_end().
724       DECL_CONTEXT_LEXICAL,
725       /// \brief A record that stores the set of declarations that are
726       /// visible from a given DeclContext.
727       ///
728       /// The record itself stores a set of mappings, each of which
729       /// associates a declaration name with one or more declaration
730       /// IDs. This data is used when performing qualified name lookup
731       /// into a DeclContext via DeclContext::lookup.
732       DECL_CONTEXT_VISIBLE,
733       /// \brief A LabelDecl record.
734       DECL_LABEL,
735       /// \brief A NamespaceDecl record.
736       DECL_NAMESPACE,
737       /// \brief A NamespaceAliasDecl record.
738       DECL_NAMESPACE_ALIAS,
739       /// \brief A UsingDecl record.
740       DECL_USING,
741       /// \brief A UsingShadowDecl record.
742       DECL_USING_SHADOW,
743       /// \brief A UsingDirecitveDecl record.
744       DECL_USING_DIRECTIVE,
745       /// \brief An UnresolvedUsingValueDecl record.
746       DECL_UNRESOLVED_USING_VALUE,
747       /// \brief An UnresolvedUsingTypenameDecl record.
748       DECL_UNRESOLVED_USING_TYPENAME,
749       /// \brief A LinkageSpecDecl record.
750       DECL_LINKAGE_SPEC,
751       /// \brief A CXXRecordDecl record.
752       DECL_CXX_RECORD,
753       /// \brief A CXXMethodDecl record.
754       DECL_CXX_METHOD,
755       /// \brief A CXXConstructorDecl record.
756       DECL_CXX_CONSTRUCTOR,
757       /// \brief A CXXDestructorDecl record.
758       DECL_CXX_DESTRUCTOR,
759       /// \brief A CXXConversionDecl record.
760       DECL_CXX_CONVERSION,
761       /// \brief An AccessSpecDecl record.
762       DECL_ACCESS_SPEC,
763 
764       /// \brief A FriendDecl record.
765       DECL_FRIEND,
766       /// \brief A FriendTemplateDecl record.
767       DECL_FRIEND_TEMPLATE,
768       /// \brief A ClassTemplateDecl record.
769       DECL_CLASS_TEMPLATE,
770       /// \brief A ClassTemplateSpecializationDecl record.
771       DECL_CLASS_TEMPLATE_SPECIALIZATION,
772       /// \brief A ClassTemplatePartialSpecializationDecl record.
773       DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION,
774       /// \brief A FunctionTemplateDecl record.
775       DECL_FUNCTION_TEMPLATE,
776       /// \brief A TemplateTypeParmDecl record.
777       DECL_TEMPLATE_TYPE_PARM,
778       /// \brief A NonTypeTemplateParmDecl record.
779       DECL_NON_TYPE_TEMPLATE_PARM,
780       /// \brief A TemplateTemplateParmDecl record.
781       DECL_TEMPLATE_TEMPLATE_PARM,
782       /// \brief A TypeAliasTemplateDecl record.
783       DECL_TYPE_ALIAS_TEMPLATE,
784       /// \brief A StaticAssertDecl record.
785       DECL_STATIC_ASSERT,
786       /// \brief A record containing CXXBaseSpecifiers.
787       DECL_CXX_BASE_SPECIFIERS,
788       /// \brief A IndirectFieldDecl record.
789       DECL_INDIRECTFIELD,
790       /// \brief A NonTypeTemplateParmDecl record that stores an expanded
791       /// non-type template parameter pack.
792       DECL_EXPANDED_NON_TYPE_TEMPLATE_PARM_PACK
793     };
794 
795     /// \brief Record codes for each kind of statement or expression.
796     ///
797     /// These constants describe the records that describe statements
798     /// or expressions. These records  occur within type and declarations
799     /// block, so they begin with record values of 100.  Each constant
800     /// describes a record for a specific statement or expression class in the
801     /// AST.
802     enum StmtCode {
803       /// \brief A marker record that indicates that we are at the end
804       /// of an expression.
805       STMT_STOP = 100,
806       /// \brief A NULL expression.
807       STMT_NULL_PTR,
808       /// \brief A NullStmt record.
809       STMT_NULL,
810       /// \brief A CompoundStmt record.
811       STMT_COMPOUND,
812       /// \brief A CaseStmt record.
813       STMT_CASE,
814       /// \brief A DefaultStmt record.
815       STMT_DEFAULT,
816       /// \brief A LabelStmt record.
817       STMT_LABEL,
818       /// \brief An IfStmt record.
819       STMT_IF,
820       /// \brief A SwitchStmt record.
821       STMT_SWITCH,
822       /// \brief A WhileStmt record.
823       STMT_WHILE,
824       /// \brief A DoStmt record.
825       STMT_DO,
826       /// \brief A ForStmt record.
827       STMT_FOR,
828       /// \brief A GotoStmt record.
829       STMT_GOTO,
830       /// \brief An IndirectGotoStmt record.
831       STMT_INDIRECT_GOTO,
832       /// \brief A ContinueStmt record.
833       STMT_CONTINUE,
834       /// \brief A BreakStmt record.
835       STMT_BREAK,
836       /// \brief A ReturnStmt record.
837       STMT_RETURN,
838       /// \brief A DeclStmt record.
839       STMT_DECL,
840       /// \brief An AsmStmt record.
841       STMT_ASM,
842       /// \brief A PredefinedExpr record.
843       EXPR_PREDEFINED,
844       /// \brief A DeclRefExpr record.
845       EXPR_DECL_REF,
846       /// \brief An IntegerLiteral record.
847       EXPR_INTEGER_LITERAL,
848       /// \brief A FloatingLiteral record.
849       EXPR_FLOATING_LITERAL,
850       /// \brief An ImaginaryLiteral record.
851       EXPR_IMAGINARY_LITERAL,
852       /// \brief A StringLiteral record.
853       EXPR_STRING_LITERAL,
854       /// \brief A CharacterLiteral record.
855       EXPR_CHARACTER_LITERAL,
856       /// \brief A ParenExpr record.
857       EXPR_PAREN,
858       /// \brief A ParenListExpr record.
859       EXPR_PAREN_LIST,
860       /// \brief A UnaryOperator record.
861       EXPR_UNARY_OPERATOR,
862       /// \brief An OffsetOfExpr record.
863       EXPR_OFFSETOF,
864       /// \brief A SizefAlignOfExpr record.
865       EXPR_SIZEOF_ALIGN_OF,
866       /// \brief An ArraySubscriptExpr record.
867       EXPR_ARRAY_SUBSCRIPT,
868       /// \brief A CallExpr record.
869       EXPR_CALL,
870       /// \brief A MemberExpr record.
871       EXPR_MEMBER,
872       /// \brief A BinaryOperator record.
873       EXPR_BINARY_OPERATOR,
874       /// \brief A CompoundAssignOperator record.
875       EXPR_COMPOUND_ASSIGN_OPERATOR,
876       /// \brief A ConditionOperator record.
877       EXPR_CONDITIONAL_OPERATOR,
878       /// \brief An ImplicitCastExpr record.
879       EXPR_IMPLICIT_CAST,
880       /// \brief A CStyleCastExpr record.
881       EXPR_CSTYLE_CAST,
882       /// \brief A CompoundLiteralExpr record.
883       EXPR_COMPOUND_LITERAL,
884       /// \brief An ExtVectorElementExpr record.
885       EXPR_EXT_VECTOR_ELEMENT,
886       /// \brief An InitListExpr record.
887       EXPR_INIT_LIST,
888       /// \brief A DesignatedInitExpr record.
889       EXPR_DESIGNATED_INIT,
890       /// \brief An ImplicitValueInitExpr record.
891       EXPR_IMPLICIT_VALUE_INIT,
892       /// \brief A VAArgExpr record.
893       EXPR_VA_ARG,
894       /// \brief An AddrLabelExpr record.
895       EXPR_ADDR_LABEL,
896       /// \brief A StmtExpr record.
897       EXPR_STMT,
898       /// \brief A ChooseExpr record.
899       EXPR_CHOOSE,
900       /// \brief A GNUNullExpr record.
901       EXPR_GNU_NULL,
902       /// \brief A ShuffleVectorExpr record.
903       EXPR_SHUFFLE_VECTOR,
904       /// \brief BlockExpr
905       EXPR_BLOCK,
906       /// \brief A BlockDeclRef record.
907       EXPR_BLOCK_DECL_REF,
908       /// \brief A GenericSelectionExpr record.
909       EXPR_GENERIC_SELECTION,
910 
911       // Objective-C
912 
913       /// \brief An ObjCStringLiteral record.
914       EXPR_OBJC_STRING_LITERAL,
915       /// \brief An ObjCEncodeExpr record.
916       EXPR_OBJC_ENCODE,
917       /// \brief An ObjCSelectorExpr record.
918       EXPR_OBJC_SELECTOR_EXPR,
919       /// \brief An ObjCProtocolExpr record.
920       EXPR_OBJC_PROTOCOL_EXPR,
921       /// \brief An ObjCIvarRefExpr record.
922       EXPR_OBJC_IVAR_REF_EXPR,
923       /// \brief An ObjCPropertyRefExpr record.
924       EXPR_OBJC_PROPERTY_REF_EXPR,
925       /// \brief UNUSED
926       EXPR_OBJC_KVC_REF_EXPR,
927       /// \brief An ObjCMessageExpr record.
928       EXPR_OBJC_MESSAGE_EXPR,
929       /// \brief An ObjCIsa Expr record.
930       EXPR_OBJC_ISA,
931       /// \breif An ObjCIndirectCopyRestoreExpr record.
932       EXPR_OBJC_INDIRECT_COPY_RESTORE,
933 
934       /// \brief An ObjCForCollectionStmt record.
935       STMT_OBJC_FOR_COLLECTION,
936       /// \brief An ObjCAtCatchStmt record.
937       STMT_OBJC_CATCH,
938       /// \brief An ObjCAtFinallyStmt record.
939       STMT_OBJC_FINALLY,
940       /// \brief An ObjCAtTryStmt record.
941       STMT_OBJC_AT_TRY,
942       /// \brief An ObjCAtSynchronizedStmt record.
943       STMT_OBJC_AT_SYNCHRONIZED,
944       /// \brief An ObjCAtThrowStmt record.
945       STMT_OBJC_AT_THROW,
946       /// \brief An ObjCAutoreleasePoolStmt record.
947       STMT_OBJC_AUTORELEASE_POOL,
948 
949       // C++
950 
951       /// \brief A CXXCatchStmt record.
952       STMT_CXX_CATCH,
953       /// \brief A CXXTryStmt record.
954       STMT_CXX_TRY,
955       /// \brief A CXXForRangeStmt record.
956       STMT_CXX_FOR_RANGE,
957 
958       /// \brief A CXXOperatorCallExpr record.
959       EXPR_CXX_OPERATOR_CALL,
960       /// \brief A CXXMemberCallExpr record.
961       EXPR_CXX_MEMBER_CALL,
962       /// \brief A CXXConstructExpr record.
963       EXPR_CXX_CONSTRUCT,
964       /// \brief A CXXTemporaryObjectExpr record.
965       EXPR_CXX_TEMPORARY_OBJECT,
966       /// \brief A CXXStaticCastExpr record.
967       EXPR_CXX_STATIC_CAST,
968       /// \brief A CXXDynamicCastExpr record.
969       EXPR_CXX_DYNAMIC_CAST,
970       /// \brief A CXXReinterpretCastExpr record.
971       EXPR_CXX_REINTERPRET_CAST,
972       /// \brief A CXXConstCastExpr record.
973       EXPR_CXX_CONST_CAST,
974       /// \brief A CXXFunctionalCastExpr record.
975       EXPR_CXX_FUNCTIONAL_CAST,
976       /// \brief A CXXBoolLiteralExpr record.
977       EXPR_CXX_BOOL_LITERAL,
978       EXPR_CXX_NULL_PTR_LITERAL,  // CXXNullPtrLiteralExpr
979       EXPR_CXX_TYPEID_EXPR,       // CXXTypeidExpr (of expr).
980       EXPR_CXX_TYPEID_TYPE,       // CXXTypeidExpr (of type).
981       EXPR_CXX_THIS,              // CXXThisExpr
982       EXPR_CXX_THROW,             // CXXThrowExpr
983       EXPR_CXX_DEFAULT_ARG,       // CXXDefaultArgExpr
984       EXPR_CXX_BIND_TEMPORARY,    // CXXBindTemporaryExpr
985 
986       EXPR_CXX_SCALAR_VALUE_INIT, // CXXScalarValueInitExpr
987       EXPR_CXX_NEW,               // CXXNewExpr
988       EXPR_CXX_DELETE,            // CXXDeleteExpr
989       EXPR_CXX_PSEUDO_DESTRUCTOR, // CXXPseudoDestructorExpr
990 
991       EXPR_EXPR_WITH_CLEANUPS,    // ExprWithCleanups
992 
993       EXPR_CXX_DEPENDENT_SCOPE_MEMBER,   // CXXDependentScopeMemberExpr
994       EXPR_CXX_DEPENDENT_SCOPE_DECL_REF, // DependentScopeDeclRefExpr
995       EXPR_CXX_UNRESOLVED_CONSTRUCT,     // CXXUnresolvedConstructExpr
996       EXPR_CXX_UNRESOLVED_MEMBER,        // UnresolvedMemberExpr
997       EXPR_CXX_UNRESOLVED_LOOKUP,        // UnresolvedLookupExpr
998 
999       EXPR_CXX_UNARY_TYPE_TRAIT,  // UnaryTypeTraitExpr
1000       EXPR_CXX_EXPRESSION_TRAIT,  // ExpressionTraitExpr
1001       EXPR_CXX_NOEXCEPT,          // CXXNoexceptExpr
1002 
1003       EXPR_OPAQUE_VALUE,          // OpaqueValueExpr
1004       EXPR_BINARY_CONDITIONAL_OPERATOR,  // BinaryConditionalOperator
1005       EXPR_BINARY_TYPE_TRAIT,     // BinaryTypeTraitExpr
1006       EXPR_ARRAY_TYPE_TRAIT,      // ArrayTypeTraitIntExpr
1007 
1008       EXPR_PACK_EXPANSION,        // PackExpansionExpr
1009       EXPR_SIZEOF_PACK,           // SizeOfPackExpr
1010       EXPR_SUBST_NON_TYPE_TEMPLATE_PARM, // SubstNonTypeTemplateParmExpr
1011       EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK,// SubstNonTypeTemplateParmPackExpr
1012       EXPR_MATERIALIZE_TEMPORARY, // MaterializeTemporaryExpr
1013 
1014       // CUDA
1015       EXPR_CUDA_KERNEL_CALL,       // CUDAKernelCallExpr
1016 
1017       // OpenCL
1018       EXPR_ASTYPE,                 // AsTypeExpr
1019 
1020       // Microsoft
1021       EXPR_CXX_UUIDOF_EXPR,       // CXXUuidofExpr (of expr).
1022       EXPR_CXX_UUIDOF_TYPE,       // CXXUuidofExpr (of type).
1023       STMT_SEH_EXCEPT,            // SEHExceptStmt
1024       STMT_SEH_FINALLY,           // SEHFinallyStmt
1025       STMT_SEH_TRY,               // SEHTryStmt
1026 
1027       // ARC
1028       EXPR_OBJC_BRIDGED_CAST       // ObjCBridgedCastExpr
1029     };
1030 
1031     /// \brief The kinds of designators that can occur in a
1032     /// DesignatedInitExpr.
1033     enum DesignatorTypes {
1034       /// \brief Field designator where only the field name is known.
1035       DESIG_FIELD_NAME  = 0,
1036       /// \brief Field designator where the field has been resolved to
1037       /// a declaration.
1038       DESIG_FIELD_DECL  = 1,
1039       /// \brief Array designator.
1040       DESIG_ARRAY       = 2,
1041       /// \brief GNU array range designator.
1042       DESIG_ARRAY_RANGE = 3
1043     };
1044 
1045     /// \brief The different kinds of data that can occur in a
1046     /// CtorInitializer.
1047     enum CtorInitializerType {
1048       CTOR_INITIALIZER_BASE,
1049       CTOR_INITIALIZER_DELEGATING,
1050       CTOR_INITIALIZER_MEMBER,
1051       CTOR_INITIALIZER_INDIRECT_MEMBER
1052     };
1053 
1054     /// @}
1055   }
1056 } // end namespace clang
1057 
1058 #endif
1059