]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/clang/Serialization/ASTBitCodes.h
Vendor import of clang trunk r126079:
[FreeBSD/FreeBSD.git] / include / clang / Serialization / ASTBitCodes.h
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:
76       TypeIdx() : Idx(0) { }
77       explicit TypeIdx(uint32_t index) : Idx(index) { }
78
79       uint32_t getIndex() const { return Idx; }
80       TypeID asTypeID(unsigned FastQuals) const {
81         return (Idx << Qualifiers::FastWidth) | FastQuals;
82       }
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 {
91       static inline bool isEqual(QualType A, QualType B) { return A == B; }
92       static inline QualType getEmptyKey() {
93         return QualType::getFromOpaquePtr((void*) 1);
94       }
95       static inline QualType getTombstoneKey() {
96         return QualType::getFromOpaquePtr((void*) 2);
97       }
98       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       /// Record #20 intentionally left blank.
283       
284       /// \brief Record code for the version control branch and revision
285       /// information of the compiler used to build this AST file.
286       VERSION_CONTROL_BRANCH_REVISION = 21,
287       
288       /// \brief Record code for the array of unused file scoped decls.
289       UNUSED_FILESCOPED_DECLS = 22,
290       
291       /// \brief Record code for the table of offsets to macro definition
292       /// entries in the preprocessing record.
293       MACRO_DEFINITION_OFFSETS = 23,
294
295       /// \brief Record code for the array of VTable uses.
296       VTABLE_USES = 24,
297
298       /// \brief Record code for the array of dynamic classes.
299       DYNAMIC_CLASSES = 25,
300
301       /// \brief Record code for the chained AST metadata, including the
302       /// AST file version and the name of the PCH this depends on.
303       CHAINED_METADATA = 26,
304
305       /// \brief Record code for referenced selector pool.
306       REFERENCED_SELECTOR_POOL = 27,
307
308       /// \brief Record code for an update to the TU's lexically contained
309       /// declarations.
310       TU_UPDATE_LEXICAL = 28,
311
312       /// \brief Record code for an update to first decls pointing to the
313       /// latest redeclarations.
314       REDECLS_UPDATE_LATEST = 29,
315
316       /// \brief Record code for declarations that Sema keeps references of.
317       SEMA_DECL_REFS = 30,
318
319       /// \brief Record code for weak undeclared identifiers.
320       WEAK_UNDECLARED_IDENTIFIERS = 31,
321
322       /// \brief Record code for pending implicit instantiations.
323       PENDING_IMPLICIT_INSTANTIATIONS = 32,
324
325       /// \brief Record code for a decl replacement block.
326       ///
327       /// If a declaration is modified after having been deserialized, and then
328       /// written to a dependent AST file, its ID and offset must be added to
329       /// the replacement block.
330       DECL_REPLACEMENTS = 33,
331
332       /// \brief Record code for an update to a decl context's lookup table.
333       ///
334       /// In practice, this should only be used for the TU and namespaces.
335       UPDATE_VISIBLE = 34,
336
337       /// \brief Record for offsets of DECL_UPDATES records for declarations
338       /// that were modified after being deserialized and need updates.
339       DECL_UPDATE_OFFSETS = 35,
340
341       /// \brief Record of updates for a declaration that was modified after
342       /// being deserialized.
343       DECL_UPDATES = 36,
344       
345       /// \brief Record code for the table of offsets to CXXBaseSpecifier
346       /// sets.
347       CXX_BASE_SPECIFIER_OFFSETS = 37,
348
349       /// \brief Record code for #pragma diagnostic mappings.
350       DIAG_PRAGMA_MAPPINGS = 38,
351
352       /// \brief Record code for special CUDA declarations.
353       CUDA_SPECIAL_DECL_REFS = 39,
354       
355       /// \brief Record code for header search information.
356       HEADER_SEARCH_TABLE = 40,
357
358       /// \brief The directory that the PCH was originally created in.
359       ORIGINAL_PCH_DIR = 41,
360
361       /// \brief Record code for floating point #pragma options.
362       FP_PRAGMA_OPTIONS = 42,
363
364       /// \brief Record code for enabled OpenCL extensions.
365       OPENCL_EXTENSIONS = 43
366     };
367
368     /// \brief Record types used within a source manager block.
369     enum SourceManagerRecordTypes {
370       /// \brief Describes a source location entry (SLocEntry) for a
371       /// file.
372       SM_SLOC_FILE_ENTRY = 1,
373       /// \brief Describes a source location entry (SLocEntry) for a
374       /// buffer.
375       SM_SLOC_BUFFER_ENTRY = 2,
376       /// \brief Describes a blob that contains the data for a buffer
377       /// entry. This kind of record always directly follows a
378       /// SM_SLOC_BUFFER_ENTRY record.
379       SM_SLOC_BUFFER_BLOB = 3,
380       /// \brief Describes a source location entry (SLocEntry) for a
381       /// macro instantiation.
382       SM_SLOC_INSTANTIATION_ENTRY = 4,
383       /// \brief Describes the SourceManager's line table, with
384       /// information about #line directives.
385       SM_LINE_TABLE = 5
386     };
387
388     /// \brief Record types used within a preprocessor block.
389     enum PreprocessorRecordTypes {
390       // The macros in the PP section are a PP_MACRO_* instance followed by a
391       // list of PP_TOKEN instances for each token in the definition.
392
393       /// \brief An object-like macro definition.
394       /// [PP_MACRO_OBJECT_LIKE, IdentInfoID, SLoc, IsUsed]
395       PP_MACRO_OBJECT_LIKE = 1,
396
397       /// \brief A function-like macro definition.
398       /// [PP_MACRO_FUNCTION_LIKE, <ObjectLikeStuff>, IsC99Varargs, IsGNUVarars,
399       ///  NumArgs, ArgIdentInfoID* ]
400       PP_MACRO_FUNCTION_LIKE = 2,
401
402       /// \brief Describes one token.
403       /// [PP_TOKEN, SLoc, Length, IdentInfoID, Kind, Flags]
404       PP_TOKEN = 3
405     };
406
407     /// \brief Record types used within a preprocessor detail block.
408     enum PreprocessorDetailRecordTypes {
409       /// \brief Describes a macro instantiation within the preprocessing 
410       /// record.
411       PPD_MACRO_INSTANTIATION = 0,
412       
413       /// \brief Describes a macro definition within the preprocessing record.
414       PPD_MACRO_DEFINITION = 1,
415       
416       /// \brief Describes an inclusion directive within the preprocessing
417       /// record.
418       PPD_INCLUSION_DIRECTIVE = 2
419     };
420     
421     /// \defgroup ASTAST AST file AST constants
422     ///
423     /// The constants in this group describe various components of the
424     /// abstract syntax tree within an AST file.
425     ///
426     /// @{
427
428     /// \brief Predefined type IDs.
429     ///
430     /// These type IDs correspond to predefined types in the AST
431     /// context, such as built-in types (int) and special place-holder
432     /// types (the <overload> and <dependent> type markers). Such
433     /// types are never actually serialized, since they will be built
434     /// by the AST context when it is created.
435     enum PredefinedTypeIDs {
436       /// \brief The NULL type.
437       PREDEF_TYPE_NULL_ID       = 0,
438       /// \brief The void type.
439       PREDEF_TYPE_VOID_ID       = 1,
440       /// \brief The 'bool' or '_Bool' type.
441       PREDEF_TYPE_BOOL_ID       = 2,
442       /// \brief The 'char' type, when it is unsigned.
443       PREDEF_TYPE_CHAR_U_ID     = 3,
444       /// \brief The 'unsigned char' type.
445       PREDEF_TYPE_UCHAR_ID      = 4,
446       /// \brief The 'unsigned short' type.
447       PREDEF_TYPE_USHORT_ID     = 5,
448       /// \brief The 'unsigned int' type.
449       PREDEF_TYPE_UINT_ID       = 6,
450       /// \brief The 'unsigned long' type.
451       PREDEF_TYPE_ULONG_ID      = 7,
452       /// \brief The 'unsigned long long' type.
453       PREDEF_TYPE_ULONGLONG_ID  = 8,
454       /// \brief The 'char' type, when it is signed.
455       PREDEF_TYPE_CHAR_S_ID     = 9,
456       /// \brief The 'signed char' type.
457       PREDEF_TYPE_SCHAR_ID      = 10,
458       /// \brief The C++ 'wchar_t' type.
459       PREDEF_TYPE_WCHAR_ID      = 11,
460       /// \brief The (signed) 'short' type.
461       PREDEF_TYPE_SHORT_ID      = 12,
462       /// \brief The (signed) 'int' type.
463       PREDEF_TYPE_INT_ID        = 13,
464       /// \brief The (signed) 'long' type.
465       PREDEF_TYPE_LONG_ID       = 14,
466       /// \brief The (signed) 'long long' type.
467       PREDEF_TYPE_LONGLONG_ID   = 15,
468       /// \brief The 'float' type.
469       PREDEF_TYPE_FLOAT_ID      = 16,
470       /// \brief The 'double' type.
471       PREDEF_TYPE_DOUBLE_ID     = 17,
472       /// \brief The 'long double' type.
473       PREDEF_TYPE_LONGDOUBLE_ID = 18,
474       /// \brief The placeholder type for overloaded function sets.
475       PREDEF_TYPE_OVERLOAD_ID   = 19,
476       /// \brief The placeholder type for dependent types.
477       PREDEF_TYPE_DEPENDENT_ID  = 20,
478       /// \brief The '__uint128_t' type.
479       PREDEF_TYPE_UINT128_ID    = 21,
480       /// \brief The '__int128_t' type.
481       PREDEF_TYPE_INT128_ID     = 22,
482       /// \brief The type of 'nullptr'.
483       PREDEF_TYPE_NULLPTR_ID    = 23,
484       /// \brief The C++ 'char16_t' type.
485       PREDEF_TYPE_CHAR16_ID     = 24,
486       /// \brief The C++ 'char32_t' type.
487       PREDEF_TYPE_CHAR32_ID     = 25,
488       /// \brief The ObjC 'id' type.
489       PREDEF_TYPE_OBJC_ID       = 26,
490       /// \brief The ObjC 'Class' type.
491       PREDEF_TYPE_OBJC_CLASS    = 27,
492       /// \brief The ObjC 'SEL' type.
493       PREDEF_TYPE_OBJC_SEL    = 28
494     };
495
496     /// \brief The number of predefined type IDs that are reserved for
497     /// the PREDEF_TYPE_* constants.
498     ///
499     /// Type IDs for non-predefined types will start at
500     /// NUM_PREDEF_TYPE_IDs.
501     const unsigned NUM_PREDEF_TYPE_IDS = 100;
502
503     /// \brief Record codes for each kind of type.
504     ///
505     /// These constants describe the type records that can occur within a
506     /// block identified by DECLTYPES_BLOCK_ID in the AST file. Each
507     /// constant describes a record for a specific type class in the
508     /// AST.
509     enum TypeCode {
510       /// \brief An ExtQualType record.
511       TYPE_EXT_QUAL                 = 1,
512       /// \brief A ComplexType record.
513       TYPE_COMPLEX                  = 3,
514       /// \brief A PointerType record.
515       TYPE_POINTER                  = 4,
516       /// \brief A BlockPointerType record.
517       TYPE_BLOCK_POINTER            = 5,
518       /// \brief An LValueReferenceType record.
519       TYPE_LVALUE_REFERENCE         = 6,
520       /// \brief An RValueReferenceType record.
521       TYPE_RVALUE_REFERENCE         = 7,
522       /// \brief A MemberPointerType record.
523       TYPE_MEMBER_POINTER           = 8,
524       /// \brief A ConstantArrayType record.
525       TYPE_CONSTANT_ARRAY           = 9,
526       /// \brief An IncompleteArrayType record.
527       TYPE_INCOMPLETE_ARRAY         = 10,
528       /// \brief A VariableArrayType record.
529       TYPE_VARIABLE_ARRAY           = 11,
530       /// \brief A VectorType record.
531       TYPE_VECTOR                   = 12,
532       /// \brief An ExtVectorType record.
533       TYPE_EXT_VECTOR               = 13,
534       /// \brief A FunctionNoProtoType record.
535       TYPE_FUNCTION_NO_PROTO        = 14,
536       /// \brief A FunctionProtoType record.
537       TYPE_FUNCTION_PROTO           = 15,
538       /// \brief A TypedefType record.
539       TYPE_TYPEDEF                  = 16,
540       /// \brief A TypeOfExprType record.
541       TYPE_TYPEOF_EXPR              = 17,
542       /// \brief A TypeOfType record.
543       TYPE_TYPEOF                   = 18,
544       /// \brief A RecordType record.
545       TYPE_RECORD                   = 19,
546       /// \brief An EnumType record.
547       TYPE_ENUM                     = 20,
548       /// \brief An ObjCInterfaceType record.
549       TYPE_OBJC_INTERFACE           = 21,
550       /// \brief An ObjCObjectPointerType record.
551       TYPE_OBJC_OBJECT_POINTER      = 22,
552       /// \brief a DecltypeType record.
553       TYPE_DECLTYPE                 = 23,
554       /// \brief An ElaboratedType record.
555       TYPE_ELABORATED               = 24,
556       /// \brief A SubstTemplateTypeParmType record.
557       TYPE_SUBST_TEMPLATE_TYPE_PARM = 25,
558       /// \brief An UnresolvedUsingType record.
559       TYPE_UNRESOLVED_USING         = 26,
560       /// \brief An InjectedClassNameType record.
561       TYPE_INJECTED_CLASS_NAME      = 27,
562       /// \brief An ObjCObjectType record.
563       TYPE_OBJC_OBJECT              = 28,
564       /// \brief An TemplateTypeParmType record.
565       TYPE_TEMPLATE_TYPE_PARM       = 29,
566       /// \brief An TemplateSpecializationType record.
567       TYPE_TEMPLATE_SPECIALIZATION  = 30,
568       /// \brief A DependentNameType record.
569       TYPE_DEPENDENT_NAME           = 31,
570       /// \brief A DependentTemplateSpecializationType record.
571       TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION = 32,
572       /// \brief A DependentSizedArrayType record.
573       TYPE_DEPENDENT_SIZED_ARRAY    = 33,
574       /// \brief A ParenType record.
575       TYPE_PAREN                    = 34,
576       /// \brief A PackExpansionType record.
577       TYPE_PACK_EXPANSION           = 35,
578       /// \brief An AttributedType record.
579       TYPE_ATTRIBUTED               = 36,
580       /// \brief A SubstTemplateTypeParmPackType record.
581       TYPE_SUBST_TEMPLATE_TYPE_PARM_PACK = 37,
582       /// \brief A AutoType record.
583       TYPE_AUTO                  = 38
584     };
585
586     /// \brief The type IDs for special types constructed by semantic
587     /// analysis.
588     ///
589     /// The constants in this enumeration are indices into the
590     /// SPECIAL_TYPES record.
591     enum SpecialTypeIDs {
592       /// \brief __builtin_va_list
593       SPECIAL_TYPE_BUILTIN_VA_LIST             = 0,
594       /// \brief Objective-C "id" type
595       SPECIAL_TYPE_OBJC_ID                     = 1,
596       /// \brief Objective-C selector type
597       SPECIAL_TYPE_OBJC_SELECTOR               = 2,
598       /// \brief Objective-C Protocol type
599       SPECIAL_TYPE_OBJC_PROTOCOL               = 3,
600       /// \brief Objective-C Class type
601       SPECIAL_TYPE_OBJC_CLASS                  = 4,
602       /// \brief CFConstantString type
603       SPECIAL_TYPE_CF_CONSTANT_STRING          = 5,
604       /// \brief Objective-C fast enumeration state type
605       SPECIAL_TYPE_OBJC_FAST_ENUMERATION_STATE = 6,
606       /// \brief C FILE typedef type
607       SPECIAL_TYPE_FILE                        = 7,
608       /// \brief C jmp_buf typedef type
609       SPECIAL_TYPE_jmp_buf                     = 8,
610       /// \brief C sigjmp_buf typedef type
611       SPECIAL_TYPE_sigjmp_buf                  = 9,
612       /// \brief Objective-C "id" redefinition type
613       SPECIAL_TYPE_OBJC_ID_REDEFINITION        = 10,
614       /// \brief Objective-C "Class" redefinition type
615       SPECIAL_TYPE_OBJC_CLASS_REDEFINITION     = 11,
616       /// \brief Block descriptor type for Blocks CodeGen
617       SPECIAL_TYPE_BLOCK_DESCRIPTOR            = 12,
618       /// \brief Block extedned descriptor type for Blocks CodeGen
619       SPECIAL_TYPE_BLOCK_EXTENDED_DESCRIPTOR   = 13,
620       /// \brief Objective-C "SEL" redefinition type
621       SPECIAL_TYPE_OBJC_SEL_REDEFINITION       = 14,
622       /// \brief NSConstantString type
623       SPECIAL_TYPE_NS_CONSTANT_STRING          = 15,
624       /// \brief Whether __[u]int128_t identifier is installed.
625       SPECIAL_TYPE_INT128_INSTALLED            = 16
626     };
627
628     /// \brief Record codes for each kind of declaration.
629     ///
630     /// These constants describe the declaration records that can occur within
631     /// a declarations block (identified by DECLS_BLOCK_ID). Each
632     /// constant describes a record for a specific declaration class
633     /// in the AST.
634     enum DeclCode {
635       /// \brief A TranslationUnitDecl record.
636       DECL_TRANSLATION_UNIT = 50,
637       /// \brief A TypedefDecl record.
638       DECL_TYPEDEF,
639       /// \brief An EnumDecl record.
640       DECL_ENUM,
641       /// \brief A RecordDecl record.
642       DECL_RECORD,
643       /// \brief An EnumConstantDecl record.
644       DECL_ENUM_CONSTANT,
645       /// \brief A FunctionDecl record.
646       DECL_FUNCTION,
647       /// \brief A ObjCMethodDecl record.
648       DECL_OBJC_METHOD,
649       /// \brief A ObjCInterfaceDecl record.
650       DECL_OBJC_INTERFACE,
651       /// \brief A ObjCProtocolDecl record.
652       DECL_OBJC_PROTOCOL,
653       /// \brief A ObjCIvarDecl record.
654       DECL_OBJC_IVAR,
655       /// \brief A ObjCAtDefsFieldDecl record.
656       DECL_OBJC_AT_DEFS_FIELD,
657       /// \brief A ObjCClassDecl record.
658       DECL_OBJC_CLASS,
659       /// \brief A ObjCForwardProtocolDecl record.
660       DECL_OBJC_FORWARD_PROTOCOL,
661       /// \brief A ObjCCategoryDecl record.
662       DECL_OBJC_CATEGORY,
663       /// \brief A ObjCCategoryImplDecl record.
664       DECL_OBJC_CATEGORY_IMPL,
665       /// \brief A ObjCImplementationDecl record.
666       DECL_OBJC_IMPLEMENTATION,
667       /// \brief A ObjCCompatibleAliasDecl record.
668       DECL_OBJC_COMPATIBLE_ALIAS,
669       /// \brief A ObjCPropertyDecl record.
670       DECL_OBJC_PROPERTY,
671       /// \brief A ObjCPropertyImplDecl record.
672       DECL_OBJC_PROPERTY_IMPL,
673       /// \brief A FieldDecl record.
674       DECL_FIELD,
675       /// \brief A VarDecl record.
676       DECL_VAR,
677       /// \brief An ImplicitParamDecl record.
678       DECL_IMPLICIT_PARAM,
679       /// \brief A ParmVarDecl record.
680       DECL_PARM_VAR,
681       /// \brief A FileScopeAsmDecl record.
682       DECL_FILE_SCOPE_ASM,
683       /// \brief A BlockDecl record.
684       DECL_BLOCK,
685       /// \brief A record that stores the set of declarations that are
686       /// lexically stored within a given DeclContext.
687       ///
688       /// The record itself is a blob that is an array of declaration IDs,
689       /// in the order in which those declarations were added to the
690       /// declaration context. This data is used when iterating over
691       /// the contents of a DeclContext, e.g., via
692       /// DeclContext::decls_begin()/DeclContext::decls_end().
693       DECL_CONTEXT_LEXICAL,
694       /// \brief A record that stores the set of declarations that are
695       /// visible from a given DeclContext.
696       ///
697       /// The record itself stores a set of mappings, each of which
698       /// associates a declaration name with one or more declaration
699       /// IDs. This data is used when performing qualified name lookup
700       /// into a DeclContext via DeclContext::lookup.
701       DECL_CONTEXT_VISIBLE,
702       /// \brief A LabelDecl record.
703       DECL_LABEL,
704       /// \brief A NamespaceDecl record.
705       DECL_NAMESPACE,
706       /// \brief A NamespaceAliasDecl record.
707       DECL_NAMESPACE_ALIAS,
708       /// \brief A UsingDecl record.
709       DECL_USING,
710       /// \brief A UsingShadowDecl record.
711       DECL_USING_SHADOW,
712       /// \brief A UsingDirecitveDecl record.
713       DECL_USING_DIRECTIVE,
714       /// \brief An UnresolvedUsingValueDecl record.
715       DECL_UNRESOLVED_USING_VALUE,
716       /// \brief An UnresolvedUsingTypenameDecl record.
717       DECL_UNRESOLVED_USING_TYPENAME,
718       /// \brief A LinkageSpecDecl record.
719       DECL_LINKAGE_SPEC,
720       /// \brief A CXXRecordDecl record.
721       DECL_CXX_RECORD,
722       /// \brief A CXXMethodDecl record.
723       DECL_CXX_METHOD,
724       /// \brief A CXXConstructorDecl record.
725       DECL_CXX_CONSTRUCTOR,
726       /// \brief A CXXDestructorDecl record.
727       DECL_CXX_DESTRUCTOR,
728       /// \brief A CXXConversionDecl record.
729       DECL_CXX_CONVERSION,
730       /// \brief An AccessSpecDecl record.
731       DECL_ACCESS_SPEC,
732
733       /// \brief A FriendDecl record.
734       DECL_FRIEND,
735       /// \brief A FriendTemplateDecl record.
736       DECL_FRIEND_TEMPLATE,
737       /// \brief A ClassTemplateDecl record.
738       DECL_CLASS_TEMPLATE,
739       /// \brief A ClassTemplateSpecializationDecl record.
740       DECL_CLASS_TEMPLATE_SPECIALIZATION,
741       /// \brief A ClassTemplatePartialSpecializationDecl record.
742       DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION,
743       /// \brief A FunctionTemplateDecl record.
744       DECL_FUNCTION_TEMPLATE,
745       /// \brief A TemplateTypeParmDecl record.
746       DECL_TEMPLATE_TYPE_PARM,
747       /// \brief A NonTypeTemplateParmDecl record.
748       DECL_NON_TYPE_TEMPLATE_PARM,
749       /// \brief A TemplateTemplateParmDecl record.
750       DECL_TEMPLATE_TEMPLATE_PARM,
751       /// \brief A StaticAssertDecl record.
752       DECL_STATIC_ASSERT,
753       /// \brief A record containing CXXBaseSpecifiers.
754       DECL_CXX_BASE_SPECIFIERS,
755       /// \brief A IndirectFieldDecl record.
756       DECL_INDIRECTFIELD,
757       /// \brief A NonTypeTemplateParmDecl record that stores an expanded
758       /// non-type template parameter pack.
759       DECL_EXPANDED_NON_TYPE_TEMPLATE_PARM_PACK
760     };
761
762     /// \brief Record codes for each kind of statement or expression.
763     ///
764     /// These constants describe the records that describe statements
765     /// or expressions. These records  occur within type and declarations
766     /// block, so they begin with record values of 100.  Each constant 
767     /// describes a record for a specific statement or expression class in the
768     /// AST.
769     enum StmtCode {
770       /// \brief A marker record that indicates that we are at the end
771       /// of an expression.
772       STMT_STOP = 100,
773       /// \brief A NULL expression.
774       STMT_NULL_PTR,
775       /// \brief A NullStmt record.
776       STMT_NULL,
777       /// \brief A CompoundStmt record.
778       STMT_COMPOUND,
779       /// \brief A CaseStmt record.
780       STMT_CASE,
781       /// \brief A DefaultStmt record.
782       STMT_DEFAULT,
783       /// \brief A LabelStmt record.
784       STMT_LABEL,
785       /// \brief An IfStmt record.
786       STMT_IF,
787       /// \brief A SwitchStmt record.
788       STMT_SWITCH,
789       /// \brief A WhileStmt record.
790       STMT_WHILE,
791       /// \brief A DoStmt record.
792       STMT_DO,
793       /// \brief A ForStmt record.
794       STMT_FOR,
795       /// \brief A GotoStmt record.
796       STMT_GOTO,
797       /// \brief An IndirectGotoStmt record.
798       STMT_INDIRECT_GOTO,
799       /// \brief A ContinueStmt record.
800       STMT_CONTINUE,
801       /// \brief A BreakStmt record.
802       STMT_BREAK,
803       /// \brief A ReturnStmt record.
804       STMT_RETURN,
805       /// \brief A DeclStmt record.
806       STMT_DECL,
807       /// \brief An AsmStmt record.
808       STMT_ASM,
809       /// \brief A PredefinedExpr record.
810       EXPR_PREDEFINED,
811       /// \brief A DeclRefExpr record.
812       EXPR_DECL_REF,
813       /// \brief An IntegerLiteral record.
814       EXPR_INTEGER_LITERAL,
815       /// \brief A FloatingLiteral record.
816       EXPR_FLOATING_LITERAL,
817       /// \brief An ImaginaryLiteral record.
818       EXPR_IMAGINARY_LITERAL,
819       /// \brief A StringLiteral record.
820       EXPR_STRING_LITERAL,
821       /// \brief A CharacterLiteral record.
822       EXPR_CHARACTER_LITERAL,
823       /// \brief A ParenExpr record.
824       EXPR_PAREN,
825       /// \brief A ParenListExpr record.
826       EXPR_PAREN_LIST,
827       /// \brief A UnaryOperator record.
828       EXPR_UNARY_OPERATOR,
829       /// \brief An OffsetOfExpr record.
830       EXPR_OFFSETOF,
831       /// \brief A SizefAlignOfExpr record.
832       EXPR_SIZEOF_ALIGN_OF,
833       /// \brief An ArraySubscriptExpr record.
834       EXPR_ARRAY_SUBSCRIPT,
835       /// \brief A CallExpr record.
836       EXPR_CALL,
837       /// \brief A MemberExpr record.
838       EXPR_MEMBER,
839       /// \brief A BinaryOperator record.
840       EXPR_BINARY_OPERATOR,
841       /// \brief A CompoundAssignOperator record.
842       EXPR_COMPOUND_ASSIGN_OPERATOR,
843       /// \brief A ConditionOperator record.
844       EXPR_CONDITIONAL_OPERATOR,
845       /// \brief An ImplicitCastExpr record.
846       EXPR_IMPLICIT_CAST,
847       /// \brief A CStyleCastExpr record.
848       EXPR_CSTYLE_CAST,
849       /// \brief A CompoundLiteralExpr record.
850       EXPR_COMPOUND_LITERAL,
851       /// \brief An ExtVectorElementExpr record.
852       EXPR_EXT_VECTOR_ELEMENT,
853       /// \brief An InitListExpr record.
854       EXPR_INIT_LIST,
855       /// \brief A DesignatedInitExpr record.
856       EXPR_DESIGNATED_INIT,
857       /// \brief An ImplicitValueInitExpr record.
858       EXPR_IMPLICIT_VALUE_INIT,
859       /// \brief A VAArgExpr record.
860       EXPR_VA_ARG,
861       /// \brief An AddrLabelExpr record.
862       EXPR_ADDR_LABEL,
863       /// \brief A StmtExpr record.
864       EXPR_STMT,
865       /// \brief A ChooseExpr record.
866       EXPR_CHOOSE,
867       /// \brief A GNUNullExpr record.
868       EXPR_GNU_NULL,
869       /// \brief A ShuffleVectorExpr record.
870       EXPR_SHUFFLE_VECTOR,
871       /// \brief BlockExpr
872       EXPR_BLOCK,
873       /// \brief A BlockDeclRef record.
874       EXPR_BLOCK_DECL_REF,
875       
876       // Objective-C
877
878       /// \brief An ObjCStringLiteral record.
879       EXPR_OBJC_STRING_LITERAL,
880       /// \brief An ObjCEncodeExpr record.
881       EXPR_OBJC_ENCODE,
882       /// \brief An ObjCSelectorExpr record.
883       EXPR_OBJC_SELECTOR_EXPR,
884       /// \brief An ObjCProtocolExpr record.
885       EXPR_OBJC_PROTOCOL_EXPR,
886       /// \brief An ObjCIvarRefExpr record.
887       EXPR_OBJC_IVAR_REF_EXPR,
888       /// \brief An ObjCPropertyRefExpr record.
889       EXPR_OBJC_PROPERTY_REF_EXPR,
890       /// \brief UNUSED
891       EXPR_OBJC_KVC_REF_EXPR,
892       /// \brief An ObjCMessageExpr record.
893       EXPR_OBJC_MESSAGE_EXPR,
894       /// \brief An ObjCIsa Expr record.
895       EXPR_OBJC_ISA,
896
897       /// \brief An ObjCForCollectionStmt record.
898       STMT_OBJC_FOR_COLLECTION,
899       /// \brief An ObjCAtCatchStmt record.
900       STMT_OBJC_CATCH,
901       /// \brief An ObjCAtFinallyStmt record.
902       STMT_OBJC_FINALLY,
903       /// \brief An ObjCAtTryStmt record.
904       STMT_OBJC_AT_TRY,
905       /// \brief An ObjCAtSynchronizedStmt record.
906       STMT_OBJC_AT_SYNCHRONIZED,
907       /// \brief An ObjCAtThrowStmt record.
908       STMT_OBJC_AT_THROW,
909
910       // C++
911       
912       /// \brief A CXXCatchStmt record.
913       STMT_CXX_CATCH,
914       /// \brief A CXXTryStmt record.
915       STMT_CXX_TRY,
916
917       /// \brief A CXXOperatorCallExpr record.
918       EXPR_CXX_OPERATOR_CALL,
919       /// \brief A CXXMemberCallExpr record.
920       EXPR_CXX_MEMBER_CALL,
921       /// \brief A CXXConstructExpr record.
922       EXPR_CXX_CONSTRUCT,
923       /// \brief A CXXTemporaryObjectExpr record.
924       EXPR_CXX_TEMPORARY_OBJECT,
925       /// \brief A CXXStaticCastExpr record.
926       EXPR_CXX_STATIC_CAST,
927       /// \brief A CXXDynamicCastExpr record.
928       EXPR_CXX_DYNAMIC_CAST,
929       /// \brief A CXXReinterpretCastExpr record.
930       EXPR_CXX_REINTERPRET_CAST,
931       /// \brief A CXXConstCastExpr record.
932       EXPR_CXX_CONST_CAST,
933       /// \brief A CXXFunctionalCastExpr record.
934       EXPR_CXX_FUNCTIONAL_CAST,
935       /// \brief A CXXBoolLiteralExpr record.
936       EXPR_CXX_BOOL_LITERAL,
937       EXPR_CXX_NULL_PTR_LITERAL,  // CXXNullPtrLiteralExpr
938       EXPR_CXX_TYPEID_EXPR,       // CXXTypeidExpr (of expr).
939       EXPR_CXX_TYPEID_TYPE,       // CXXTypeidExpr (of type).
940       EXPR_CXX_UUIDOF_EXPR,       // CXXUuidofExpr (of expr).
941       EXPR_CXX_UUIDOF_TYPE,       // CXXUuidofExpr (of type).
942       EXPR_CXX_THIS,              // CXXThisExpr
943       EXPR_CXX_THROW,             // CXXThrowExpr
944       EXPR_CXX_DEFAULT_ARG,       // CXXDefaultArgExpr
945       EXPR_CXX_BIND_TEMPORARY,    // CXXBindTemporaryExpr
946
947       EXPR_CXX_SCALAR_VALUE_INIT, // CXXScalarValueInitExpr
948       EXPR_CXX_NEW,               // CXXNewExpr
949       EXPR_CXX_DELETE,            // CXXDeleteExpr
950       EXPR_CXX_PSEUDO_DESTRUCTOR, // CXXPseudoDestructorExpr
951       
952       EXPR_EXPR_WITH_CLEANUPS,    // ExprWithCleanups
953       
954       EXPR_CXX_DEPENDENT_SCOPE_MEMBER,   // CXXDependentScopeMemberExpr
955       EXPR_CXX_DEPENDENT_SCOPE_DECL_REF, // DependentScopeDeclRefExpr
956       EXPR_CXX_UNRESOLVED_CONSTRUCT,     // CXXUnresolvedConstructExpr
957       EXPR_CXX_UNRESOLVED_MEMBER,        // UnresolvedMemberExpr
958       EXPR_CXX_UNRESOLVED_LOOKUP,        // UnresolvedLookupExpr
959
960       EXPR_CXX_UNARY_TYPE_TRAIT,  // UnaryTypeTraitExpr
961       EXPR_CXX_NOEXCEPT,          // CXXNoexceptExpr
962
963       EXPR_OPAQUE_VALUE,          // OpaqueValueExpr
964       EXPR_BINARY_CONDITIONAL_OPERATOR,  // BinaryConditionalOperator
965       EXPR_BINARY_TYPE_TRAIT,     // BinaryTypeTraitExpr
966       
967       EXPR_PACK_EXPANSION,        // PackExpansionExpr
968       EXPR_SIZEOF_PACK,           // SizeOfPackExpr
969       EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK,// SubstNonTypeTemplateParmPackExpr
970
971       // CUDA
972
973       EXPR_CUDA_KERNEL_CALL       // CUDAKernelCallExpr
974     };
975
976     /// \brief The kinds of designators that can occur in a
977     /// DesignatedInitExpr.
978     enum DesignatorTypes {
979       /// \brief Field designator where only the field name is known.
980       DESIG_FIELD_NAME  = 0,
981       /// \brief Field designator where the field has been resolved to
982       /// a declaration.
983       DESIG_FIELD_DECL  = 1,
984       /// \brief Array designator.
985       DESIG_ARRAY       = 2,
986       /// \brief GNU array range designator.
987       DESIG_ARRAY_RANGE = 3
988     };
989
990     /// @}
991   }
992 } // end namespace clang
993
994 #endif