]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/blob - contrib/llvm/tools/clang/include/clang/Serialization/ASTBitCodes.h
Copy head to stable/9 as part of 9.0-RELEASE release cycle.
[FreeBSD/stable/9.git] / contrib / llvm / tools / clang / 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       /// \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     };
381
382     /// \brief Record types used within a source manager block.
383     enum SourceManagerRecordTypes {
384       /// \brief Describes a source location entry (SLocEntry) for a
385       /// file.
386       SM_SLOC_FILE_ENTRY = 1,
387       /// \brief Describes a source location entry (SLocEntry) for a
388       /// buffer.
389       SM_SLOC_BUFFER_ENTRY = 2,
390       /// \brief Describes a blob that contains the data for a buffer
391       /// entry. This kind of record always directly follows a
392       /// SM_SLOC_BUFFER_ENTRY record.
393       SM_SLOC_BUFFER_BLOB = 3,
394       /// \brief Describes a source location entry (SLocEntry) for a
395       /// macro expansion.
396       SM_SLOC_EXPANSION_ENTRY = 4,
397       /// \brief Describes the SourceManager's line table, with
398       /// information about #line directives.
399       SM_LINE_TABLE = 5
400     };
401
402     /// \brief Record types used within a preprocessor block.
403     enum PreprocessorRecordTypes {
404       // The macros in the PP section are a PP_MACRO_* instance followed by a
405       // list of PP_TOKEN instances for each token in the definition.
406
407       /// \brief An object-like macro definition.
408       /// [PP_MACRO_OBJECT_LIKE, IdentInfoID, SLoc, IsUsed]
409       PP_MACRO_OBJECT_LIKE = 1,
410
411       /// \brief A function-like macro definition.
412       /// [PP_MACRO_FUNCTION_LIKE, <ObjectLikeStuff>, IsC99Varargs, IsGNUVarars,
413       ///  NumArgs, ArgIdentInfoID* ]
414       PP_MACRO_FUNCTION_LIKE = 2,
415
416       /// \brief Describes one token.
417       /// [PP_TOKEN, SLoc, Length, IdentInfoID, Kind, Flags]
418       PP_TOKEN = 3
419     };
420
421     /// \brief Record types used within a preprocessor detail block.
422     enum PreprocessorDetailRecordTypes {
423       /// \brief Describes a macro expansion within the preprocessing record.
424       PPD_MACRO_EXPANSION = 0,
425       
426       /// \brief Describes a macro definition within the preprocessing record.
427       PPD_MACRO_DEFINITION = 1,
428       
429       /// \brief Describes an inclusion directive within the preprocessing
430       /// record.
431       PPD_INCLUSION_DIRECTIVE = 2
432     };
433     
434     /// \defgroup ASTAST AST file AST constants
435     ///
436     /// The constants in this group describe various components of the
437     /// abstract syntax tree within an AST file.
438     ///
439     /// @{
440
441     /// \brief Predefined type IDs.
442     ///
443     /// These type IDs correspond to predefined types in the AST
444     /// context, such as built-in types (int) and special place-holder
445     /// types (the <overload> and <dependent> type markers). Such
446     /// types are never actually serialized, since they will be built
447     /// by the AST context when it is created.
448     enum PredefinedTypeIDs {
449       /// \brief The NULL type.
450       PREDEF_TYPE_NULL_ID       = 0,
451       /// \brief The void type.
452       PREDEF_TYPE_VOID_ID       = 1,
453       /// \brief The 'bool' or '_Bool' type.
454       PREDEF_TYPE_BOOL_ID       = 2,
455       /// \brief The 'char' type, when it is unsigned.
456       PREDEF_TYPE_CHAR_U_ID     = 3,
457       /// \brief The 'unsigned char' type.
458       PREDEF_TYPE_UCHAR_ID      = 4,
459       /// \brief The 'unsigned short' type.
460       PREDEF_TYPE_USHORT_ID     = 5,
461       /// \brief The 'unsigned int' type.
462       PREDEF_TYPE_UINT_ID       = 6,
463       /// \brief The 'unsigned long' type.
464       PREDEF_TYPE_ULONG_ID      = 7,
465       /// \brief The 'unsigned long long' type.
466       PREDEF_TYPE_ULONGLONG_ID  = 8,
467       /// \brief The 'char' type, when it is signed.
468       PREDEF_TYPE_CHAR_S_ID     = 9,
469       /// \brief The 'signed char' type.
470       PREDEF_TYPE_SCHAR_ID      = 10,
471       /// \brief The C++ 'wchar_t' type.
472       PREDEF_TYPE_WCHAR_ID      = 11,
473       /// \brief The (signed) 'short' type.
474       PREDEF_TYPE_SHORT_ID      = 12,
475       /// \brief The (signed) 'int' type.
476       PREDEF_TYPE_INT_ID        = 13,
477       /// \brief The (signed) 'long' type.
478       PREDEF_TYPE_LONG_ID       = 14,
479       /// \brief The (signed) 'long long' type.
480       PREDEF_TYPE_LONGLONG_ID   = 15,
481       /// \brief The 'float' type.
482       PREDEF_TYPE_FLOAT_ID      = 16,
483       /// \brief The 'double' type.
484       PREDEF_TYPE_DOUBLE_ID     = 17,
485       /// \brief The 'long double' type.
486       PREDEF_TYPE_LONGDOUBLE_ID = 18,
487       /// \brief The placeholder type for overloaded function sets.
488       PREDEF_TYPE_OVERLOAD_ID   = 19,
489       /// \brief The placeholder type for dependent types.
490       PREDEF_TYPE_DEPENDENT_ID  = 20,
491       /// \brief The '__uint128_t' type.
492       PREDEF_TYPE_UINT128_ID    = 21,
493       /// \brief The '__int128_t' type.
494       PREDEF_TYPE_INT128_ID     = 22,
495       /// \brief The type of 'nullptr'.
496       PREDEF_TYPE_NULLPTR_ID    = 23,
497       /// \brief The C++ 'char16_t' type.
498       PREDEF_TYPE_CHAR16_ID     = 24,
499       /// \brief The C++ 'char32_t' type.
500       PREDEF_TYPE_CHAR32_ID     = 25,
501       /// \brief The ObjC 'id' type.
502       PREDEF_TYPE_OBJC_ID       = 26,
503       /// \brief The ObjC 'Class' type.
504       PREDEF_TYPE_OBJC_CLASS    = 27,
505       /// \brief The ObjC 'SEL' type.
506       PREDEF_TYPE_OBJC_SEL      = 28,
507       /// \brief The 'unknown any' placeholder type.
508       PREDEF_TYPE_UNKNOWN_ANY   = 29,
509       /// \brief The placeholder type for bound member functions.
510       PREDEF_TYPE_BOUND_MEMBER  = 30
511     };
512
513     /// \brief The number of predefined type IDs that are reserved for
514     /// the PREDEF_TYPE_* constants.
515     ///
516     /// Type IDs for non-predefined types will start at
517     /// NUM_PREDEF_TYPE_IDs.
518     const unsigned NUM_PREDEF_TYPE_IDS = 100;
519
520     /// \brief The number of allowed abbreviations in bits
521     const unsigned NUM_ALLOWED_ABBREVS_SIZE = 4;
522
523     /// \brief Record codes for each kind of type.
524     ///
525     /// These constants describe the type records that can occur within a
526     /// block identified by DECLTYPES_BLOCK_ID in the AST file. Each
527     /// constant describes a record for a specific type class in the
528     /// AST.
529     enum TypeCode {
530       /// \brief An ExtQualType record.
531       TYPE_EXT_QUAL                 = 1,
532       /// \brief A ComplexType record.
533       TYPE_COMPLEX                  = 3,
534       /// \brief A PointerType record.
535       TYPE_POINTER                  = 4,
536       /// \brief A BlockPointerType record.
537       TYPE_BLOCK_POINTER            = 5,
538       /// \brief An LValueReferenceType record.
539       TYPE_LVALUE_REFERENCE         = 6,
540       /// \brief An RValueReferenceType record.
541       TYPE_RVALUE_REFERENCE         = 7,
542       /// \brief A MemberPointerType record.
543       TYPE_MEMBER_POINTER           = 8,
544       /// \brief A ConstantArrayType record.
545       TYPE_CONSTANT_ARRAY           = 9,
546       /// \brief An IncompleteArrayType record.
547       TYPE_INCOMPLETE_ARRAY         = 10,
548       /// \brief A VariableArrayType record.
549       TYPE_VARIABLE_ARRAY           = 11,
550       /// \brief A VectorType record.
551       TYPE_VECTOR                   = 12,
552       /// \brief An ExtVectorType record.
553       TYPE_EXT_VECTOR               = 13,
554       /// \brief A FunctionNoProtoType record.
555       TYPE_FUNCTION_NO_PROTO        = 14,
556       /// \brief A FunctionProtoType record.
557       TYPE_FUNCTION_PROTO           = 15,
558       /// \brief A TypedefType record.
559       TYPE_TYPEDEF                  = 16,
560       /// \brief A TypeOfExprType record.
561       TYPE_TYPEOF_EXPR              = 17,
562       /// \brief A TypeOfType record.
563       TYPE_TYPEOF                   = 18,
564       /// \brief A RecordType record.
565       TYPE_RECORD                   = 19,
566       /// \brief An EnumType record.
567       TYPE_ENUM                     = 20,
568       /// \brief An ObjCInterfaceType record.
569       TYPE_OBJC_INTERFACE           = 21,
570       /// \brief An ObjCObjectPointerType record.
571       TYPE_OBJC_OBJECT_POINTER      = 22,
572       /// \brief a DecltypeType record.
573       TYPE_DECLTYPE                 = 23,
574       /// \brief An ElaboratedType record.
575       TYPE_ELABORATED               = 24,
576       /// \brief A SubstTemplateTypeParmType record.
577       TYPE_SUBST_TEMPLATE_TYPE_PARM = 25,
578       /// \brief An UnresolvedUsingType record.
579       TYPE_UNRESOLVED_USING         = 26,
580       /// \brief An InjectedClassNameType record.
581       TYPE_INJECTED_CLASS_NAME      = 27,
582       /// \brief An ObjCObjectType record.
583       TYPE_OBJC_OBJECT              = 28,
584       /// \brief An TemplateTypeParmType record.
585       TYPE_TEMPLATE_TYPE_PARM       = 29,
586       /// \brief An TemplateSpecializationType record.
587       TYPE_TEMPLATE_SPECIALIZATION  = 30,
588       /// \brief A DependentNameType record.
589       TYPE_DEPENDENT_NAME           = 31,
590       /// \brief A DependentTemplateSpecializationType record.
591       TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION = 32,
592       /// \brief A DependentSizedArrayType record.
593       TYPE_DEPENDENT_SIZED_ARRAY    = 33,
594       /// \brief A ParenType record.
595       TYPE_PAREN                    = 34,
596       /// \brief A PackExpansionType record.
597       TYPE_PACK_EXPANSION           = 35,
598       /// \brief An AttributedType record.
599       TYPE_ATTRIBUTED               = 36,
600       /// \brief A SubstTemplateTypeParmPackType record.
601       TYPE_SUBST_TEMPLATE_TYPE_PARM_PACK = 37,
602       /// \brief A AutoType record.
603       TYPE_AUTO                  = 38,
604       /// \brief A UnaryTransformType record.
605       TYPE_UNARY_TRANSFORM       = 39
606     };
607
608     /// \brief The type IDs for special types constructed by semantic
609     /// analysis.
610     ///
611     /// The constants in this enumeration are indices into the
612     /// SPECIAL_TYPES record.
613     enum SpecialTypeIDs {
614       /// \brief __builtin_va_list
615       SPECIAL_TYPE_BUILTIN_VA_LIST             = 0,
616       /// \brief Objective-C "id" type
617       SPECIAL_TYPE_OBJC_ID                     = 1,
618       /// \brief Objective-C selector type
619       SPECIAL_TYPE_OBJC_SELECTOR               = 2,
620       /// \brief Objective-C Protocol type
621       SPECIAL_TYPE_OBJC_PROTOCOL               = 3,
622       /// \brief Objective-C Class type
623       SPECIAL_TYPE_OBJC_CLASS                  = 4,
624       /// \brief CFConstantString type
625       SPECIAL_TYPE_CF_CONSTANT_STRING          = 5,
626       /// \brief Objective-C fast enumeration state type
627       SPECIAL_TYPE_OBJC_FAST_ENUMERATION_STATE = 6,
628       /// \brief C FILE typedef type
629       SPECIAL_TYPE_FILE                        = 7,
630       /// \brief C jmp_buf typedef type
631       SPECIAL_TYPE_jmp_buf                     = 8,
632       /// \brief C sigjmp_buf typedef type
633       SPECIAL_TYPE_sigjmp_buf                  = 9,
634       /// \brief Objective-C "id" redefinition type
635       SPECIAL_TYPE_OBJC_ID_REDEFINITION        = 10,
636       /// \brief Objective-C "Class" redefinition type
637       SPECIAL_TYPE_OBJC_CLASS_REDEFINITION     = 11,
638       /// \brief Block descriptor type for Blocks CodeGen
639       SPECIAL_TYPE_BLOCK_DESCRIPTOR            = 12,
640       /// \brief Block extedned descriptor type for Blocks CodeGen
641       SPECIAL_TYPE_BLOCK_EXTENDED_DESCRIPTOR   = 13,
642       /// \brief Objective-C "SEL" redefinition type
643       SPECIAL_TYPE_OBJC_SEL_REDEFINITION       = 14,
644       /// \brief NSConstantString type
645       SPECIAL_TYPE_NS_CONSTANT_STRING          = 15,
646       /// \brief Whether __[u]int128_t identifier is installed.
647       SPECIAL_TYPE_INT128_INSTALLED            = 16,
648       /// \brief Cached "auto" deduction type.
649       SPECIAL_TYPE_AUTO_DEDUCT                 = 17,
650       /// \brief Cached "auto &&" deduction type.
651       SPECIAL_TYPE_AUTO_RREF_DEDUCT            = 18
652     };
653
654     /// \brief Record codes for each kind of declaration.
655     ///
656     /// These constants describe the declaration records that can occur within
657     /// a declarations block (identified by DECLS_BLOCK_ID). Each
658     /// constant describes a record for a specific declaration class
659     /// in the AST.
660     enum DeclCode {
661       /// \brief A TranslationUnitDecl record.
662       DECL_TRANSLATION_UNIT = 50,
663       /// \brief A TypedefDecl record.
664       DECL_TYPEDEF,
665       /// \brief A TypeAliasDecl record.
666       DECL_TYPEALIAS,
667       /// \brief An EnumDecl record.
668       DECL_ENUM,
669       /// \brief A RecordDecl record.
670       DECL_RECORD,
671       /// \brief An EnumConstantDecl record.
672       DECL_ENUM_CONSTANT,
673       /// \brief A FunctionDecl record.
674       DECL_FUNCTION,
675       /// \brief A ObjCMethodDecl record.
676       DECL_OBJC_METHOD,
677       /// \brief A ObjCInterfaceDecl record.
678       DECL_OBJC_INTERFACE,
679       /// \brief A ObjCProtocolDecl record.
680       DECL_OBJC_PROTOCOL,
681       /// \brief A ObjCIvarDecl record.
682       DECL_OBJC_IVAR,
683       /// \brief A ObjCAtDefsFieldDecl record.
684       DECL_OBJC_AT_DEFS_FIELD,
685       /// \brief A ObjCClassDecl record.
686       DECL_OBJC_CLASS,
687       /// \brief A ObjCForwardProtocolDecl record.
688       DECL_OBJC_FORWARD_PROTOCOL,
689       /// \brief A ObjCCategoryDecl record.
690       DECL_OBJC_CATEGORY,
691       /// \brief A ObjCCategoryImplDecl record.
692       DECL_OBJC_CATEGORY_IMPL,
693       /// \brief A ObjCImplementationDecl record.
694       DECL_OBJC_IMPLEMENTATION,
695       /// \brief A ObjCCompatibleAliasDecl record.
696       DECL_OBJC_COMPATIBLE_ALIAS,
697       /// \brief A ObjCPropertyDecl record.
698       DECL_OBJC_PROPERTY,
699       /// \brief A ObjCPropertyImplDecl record.
700       DECL_OBJC_PROPERTY_IMPL,
701       /// \brief A FieldDecl record.
702       DECL_FIELD,
703       /// \brief A VarDecl record.
704       DECL_VAR,
705       /// \brief An ImplicitParamDecl record.
706       DECL_IMPLICIT_PARAM,
707       /// \brief A ParmVarDecl record.
708       DECL_PARM_VAR,
709       /// \brief A FileScopeAsmDecl record.
710       DECL_FILE_SCOPE_ASM,
711       /// \brief A BlockDecl record.
712       DECL_BLOCK,
713       /// \brief A record that stores the set of declarations that are
714       /// lexically stored within a given DeclContext.
715       ///
716       /// The record itself is a blob that is an array of declaration IDs,
717       /// in the order in which those declarations were added to the
718       /// declaration context. This data is used when iterating over
719       /// the contents of a DeclContext, e.g., via
720       /// DeclContext::decls_begin()/DeclContext::decls_end().
721       DECL_CONTEXT_LEXICAL,
722       /// \brief A record that stores the set of declarations that are
723       /// visible from a given DeclContext.
724       ///
725       /// The record itself stores a set of mappings, each of which
726       /// associates a declaration name with one or more declaration
727       /// IDs. This data is used when performing qualified name lookup
728       /// into a DeclContext via DeclContext::lookup.
729       DECL_CONTEXT_VISIBLE,
730       /// \brief A LabelDecl record.
731       DECL_LABEL,
732       /// \brief A NamespaceDecl record.
733       DECL_NAMESPACE,
734       /// \brief A NamespaceAliasDecl record.
735       DECL_NAMESPACE_ALIAS,
736       /// \brief A UsingDecl record.
737       DECL_USING,
738       /// \brief A UsingShadowDecl record.
739       DECL_USING_SHADOW,
740       /// \brief A UsingDirecitveDecl record.
741       DECL_USING_DIRECTIVE,
742       /// \brief An UnresolvedUsingValueDecl record.
743       DECL_UNRESOLVED_USING_VALUE,
744       /// \brief An UnresolvedUsingTypenameDecl record.
745       DECL_UNRESOLVED_USING_TYPENAME,
746       /// \brief A LinkageSpecDecl record.
747       DECL_LINKAGE_SPEC,
748       /// \brief A CXXRecordDecl record.
749       DECL_CXX_RECORD,
750       /// \brief A CXXMethodDecl record.
751       DECL_CXX_METHOD,
752       /// \brief A CXXConstructorDecl record.
753       DECL_CXX_CONSTRUCTOR,
754       /// \brief A CXXDestructorDecl record.
755       DECL_CXX_DESTRUCTOR,
756       /// \brief A CXXConversionDecl record.
757       DECL_CXX_CONVERSION,
758       /// \brief An AccessSpecDecl record.
759       DECL_ACCESS_SPEC,
760
761       /// \brief A FriendDecl record.
762       DECL_FRIEND,
763       /// \brief A FriendTemplateDecl record.
764       DECL_FRIEND_TEMPLATE,
765       /// \brief A ClassTemplateDecl record.
766       DECL_CLASS_TEMPLATE,
767       /// \brief A ClassTemplateSpecializationDecl record.
768       DECL_CLASS_TEMPLATE_SPECIALIZATION,
769       /// \brief A ClassTemplatePartialSpecializationDecl record.
770       DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION,
771       /// \brief A FunctionTemplateDecl record.
772       DECL_FUNCTION_TEMPLATE,
773       /// \brief A TemplateTypeParmDecl record.
774       DECL_TEMPLATE_TYPE_PARM,
775       /// \brief A NonTypeTemplateParmDecl record.
776       DECL_NON_TYPE_TEMPLATE_PARM,
777       /// \brief A TemplateTemplateParmDecl record.
778       DECL_TEMPLATE_TEMPLATE_PARM,
779       /// \brief A TypeAliasTemplateDecl record.
780       DECL_TYPE_ALIAS_TEMPLATE,
781       /// \brief A StaticAssertDecl record.
782       DECL_STATIC_ASSERT,
783       /// \brief A record containing CXXBaseSpecifiers.
784       DECL_CXX_BASE_SPECIFIERS,
785       /// \brief A IndirectFieldDecl record.
786       DECL_INDIRECTFIELD,
787       /// \brief A NonTypeTemplateParmDecl record that stores an expanded
788       /// non-type template parameter pack.
789       DECL_EXPANDED_NON_TYPE_TEMPLATE_PARM_PACK
790     };
791
792     /// \brief Record codes for each kind of statement or expression.
793     ///
794     /// These constants describe the records that describe statements
795     /// or expressions. These records  occur within type and declarations
796     /// block, so they begin with record values of 100.  Each constant 
797     /// describes a record for a specific statement or expression class in the
798     /// AST.
799     enum StmtCode {
800       /// \brief A marker record that indicates that we are at the end
801       /// of an expression.
802       STMT_STOP = 100,
803       /// \brief A NULL expression.
804       STMT_NULL_PTR,
805       /// \brief A NullStmt record.
806       STMT_NULL,
807       /// \brief A CompoundStmt record.
808       STMT_COMPOUND,
809       /// \brief A CaseStmt record.
810       STMT_CASE,
811       /// \brief A DefaultStmt record.
812       STMT_DEFAULT,
813       /// \brief A LabelStmt record.
814       STMT_LABEL,
815       /// \brief An IfStmt record.
816       STMT_IF,
817       /// \brief A SwitchStmt record.
818       STMT_SWITCH,
819       /// \brief A WhileStmt record.
820       STMT_WHILE,
821       /// \brief A DoStmt record.
822       STMT_DO,
823       /// \brief A ForStmt record.
824       STMT_FOR,
825       /// \brief A GotoStmt record.
826       STMT_GOTO,
827       /// \brief An IndirectGotoStmt record.
828       STMT_INDIRECT_GOTO,
829       /// \brief A ContinueStmt record.
830       STMT_CONTINUE,
831       /// \brief A BreakStmt record.
832       STMT_BREAK,
833       /// \brief A ReturnStmt record.
834       STMT_RETURN,
835       /// \brief A DeclStmt record.
836       STMT_DECL,
837       /// \brief An AsmStmt record.
838       STMT_ASM,
839       /// \brief A PredefinedExpr record.
840       EXPR_PREDEFINED,
841       /// \brief A DeclRefExpr record.
842       EXPR_DECL_REF,
843       /// \brief An IntegerLiteral record.
844       EXPR_INTEGER_LITERAL,
845       /// \brief A FloatingLiteral record.
846       EXPR_FLOATING_LITERAL,
847       /// \brief An ImaginaryLiteral record.
848       EXPR_IMAGINARY_LITERAL,
849       /// \brief A StringLiteral record.
850       EXPR_STRING_LITERAL,
851       /// \brief A CharacterLiteral record.
852       EXPR_CHARACTER_LITERAL,
853       /// \brief A ParenExpr record.
854       EXPR_PAREN,
855       /// \brief A ParenListExpr record.
856       EXPR_PAREN_LIST,
857       /// \brief A UnaryOperator record.
858       EXPR_UNARY_OPERATOR,
859       /// \brief An OffsetOfExpr record.
860       EXPR_OFFSETOF,
861       /// \brief A SizefAlignOfExpr record.
862       EXPR_SIZEOF_ALIGN_OF,
863       /// \brief An ArraySubscriptExpr record.
864       EXPR_ARRAY_SUBSCRIPT,
865       /// \brief A CallExpr record.
866       EXPR_CALL,
867       /// \brief A MemberExpr record.
868       EXPR_MEMBER,
869       /// \brief A BinaryOperator record.
870       EXPR_BINARY_OPERATOR,
871       /// \brief A CompoundAssignOperator record.
872       EXPR_COMPOUND_ASSIGN_OPERATOR,
873       /// \brief A ConditionOperator record.
874       EXPR_CONDITIONAL_OPERATOR,
875       /// \brief An ImplicitCastExpr record.
876       EXPR_IMPLICIT_CAST,
877       /// \brief A CStyleCastExpr record.
878       EXPR_CSTYLE_CAST,
879       /// \brief A CompoundLiteralExpr record.
880       EXPR_COMPOUND_LITERAL,
881       /// \brief An ExtVectorElementExpr record.
882       EXPR_EXT_VECTOR_ELEMENT,
883       /// \brief An InitListExpr record.
884       EXPR_INIT_LIST,
885       /// \brief A DesignatedInitExpr record.
886       EXPR_DESIGNATED_INIT,
887       /// \brief An ImplicitValueInitExpr record.
888       EXPR_IMPLICIT_VALUE_INIT,
889       /// \brief A VAArgExpr record.
890       EXPR_VA_ARG,
891       /// \brief An AddrLabelExpr record.
892       EXPR_ADDR_LABEL,
893       /// \brief A StmtExpr record.
894       EXPR_STMT,
895       /// \brief A ChooseExpr record.
896       EXPR_CHOOSE,
897       /// \brief A GNUNullExpr record.
898       EXPR_GNU_NULL,
899       /// \brief A ShuffleVectorExpr record.
900       EXPR_SHUFFLE_VECTOR,
901       /// \brief BlockExpr
902       EXPR_BLOCK,
903       /// \brief A BlockDeclRef record.
904       EXPR_BLOCK_DECL_REF,
905       /// \brief A GenericSelectionExpr record.
906       EXPR_GENERIC_SELECTION,
907       
908       // Objective-C
909
910       /// \brief An ObjCStringLiteral record.
911       EXPR_OBJC_STRING_LITERAL,
912       /// \brief An ObjCEncodeExpr record.
913       EXPR_OBJC_ENCODE,
914       /// \brief An ObjCSelectorExpr record.
915       EXPR_OBJC_SELECTOR_EXPR,
916       /// \brief An ObjCProtocolExpr record.
917       EXPR_OBJC_PROTOCOL_EXPR,
918       /// \brief An ObjCIvarRefExpr record.
919       EXPR_OBJC_IVAR_REF_EXPR,
920       /// \brief An ObjCPropertyRefExpr record.
921       EXPR_OBJC_PROPERTY_REF_EXPR,
922       /// \brief UNUSED
923       EXPR_OBJC_KVC_REF_EXPR,
924       /// \brief An ObjCMessageExpr record.
925       EXPR_OBJC_MESSAGE_EXPR,
926       /// \brief An ObjCIsa Expr record.
927       EXPR_OBJC_ISA,
928       /// \breif An ObjCIndirectCopyRestoreExpr record.
929       EXPR_OBJC_INDIRECT_COPY_RESTORE,
930
931       /// \brief An ObjCForCollectionStmt record.
932       STMT_OBJC_FOR_COLLECTION,
933       /// \brief An ObjCAtCatchStmt record.
934       STMT_OBJC_CATCH,
935       /// \brief An ObjCAtFinallyStmt record.
936       STMT_OBJC_FINALLY,
937       /// \brief An ObjCAtTryStmt record.
938       STMT_OBJC_AT_TRY,
939       /// \brief An ObjCAtSynchronizedStmt record.
940       STMT_OBJC_AT_SYNCHRONIZED,
941       /// \brief An ObjCAtThrowStmt record.
942       STMT_OBJC_AT_THROW,
943       /// \brief An ObjCAutoreleasePoolStmt record.
944       STMT_OBJC_AUTORELEASE_POOL,
945
946       // C++
947       
948       /// \brief A CXXCatchStmt record.
949       STMT_CXX_CATCH,
950       /// \brief A CXXTryStmt record.
951       STMT_CXX_TRY,
952       /// \brief A CXXForRangeStmt record.
953       STMT_CXX_FOR_RANGE,
954
955       /// \brief A CXXOperatorCallExpr record.
956       EXPR_CXX_OPERATOR_CALL,
957       /// \brief A CXXMemberCallExpr record.
958       EXPR_CXX_MEMBER_CALL,
959       /// \brief A CXXConstructExpr record.
960       EXPR_CXX_CONSTRUCT,
961       /// \brief A CXXTemporaryObjectExpr record.
962       EXPR_CXX_TEMPORARY_OBJECT,
963       /// \brief A CXXStaticCastExpr record.
964       EXPR_CXX_STATIC_CAST,
965       /// \brief A CXXDynamicCastExpr record.
966       EXPR_CXX_DYNAMIC_CAST,
967       /// \brief A CXXReinterpretCastExpr record.
968       EXPR_CXX_REINTERPRET_CAST,
969       /// \brief A CXXConstCastExpr record.
970       EXPR_CXX_CONST_CAST,
971       /// \brief A CXXFunctionalCastExpr record.
972       EXPR_CXX_FUNCTIONAL_CAST,
973       /// \brief A CXXBoolLiteralExpr record.
974       EXPR_CXX_BOOL_LITERAL,
975       EXPR_CXX_NULL_PTR_LITERAL,  // CXXNullPtrLiteralExpr
976       EXPR_CXX_TYPEID_EXPR,       // CXXTypeidExpr (of expr).
977       EXPR_CXX_TYPEID_TYPE,       // CXXTypeidExpr (of type).
978       EXPR_CXX_THIS,              // CXXThisExpr
979       EXPR_CXX_THROW,             // CXXThrowExpr
980       EXPR_CXX_DEFAULT_ARG,       // CXXDefaultArgExpr
981       EXPR_CXX_BIND_TEMPORARY,    // CXXBindTemporaryExpr
982
983       EXPR_CXX_SCALAR_VALUE_INIT, // CXXScalarValueInitExpr
984       EXPR_CXX_NEW,               // CXXNewExpr
985       EXPR_CXX_DELETE,            // CXXDeleteExpr
986       EXPR_CXX_PSEUDO_DESTRUCTOR, // CXXPseudoDestructorExpr
987       
988       EXPR_EXPR_WITH_CLEANUPS,    // ExprWithCleanups
989       
990       EXPR_CXX_DEPENDENT_SCOPE_MEMBER,   // CXXDependentScopeMemberExpr
991       EXPR_CXX_DEPENDENT_SCOPE_DECL_REF, // DependentScopeDeclRefExpr
992       EXPR_CXX_UNRESOLVED_CONSTRUCT,     // CXXUnresolvedConstructExpr
993       EXPR_CXX_UNRESOLVED_MEMBER,        // UnresolvedMemberExpr
994       EXPR_CXX_UNRESOLVED_LOOKUP,        // UnresolvedLookupExpr
995
996       EXPR_CXX_UNARY_TYPE_TRAIT,  // UnaryTypeTraitExpr
997       EXPR_CXX_EXPRESSION_TRAIT,  // ExpressionTraitExpr
998       EXPR_CXX_NOEXCEPT,          // CXXNoexceptExpr
999
1000       EXPR_OPAQUE_VALUE,          // OpaqueValueExpr
1001       EXPR_BINARY_CONDITIONAL_OPERATOR,  // BinaryConditionalOperator
1002       EXPR_BINARY_TYPE_TRAIT,     // BinaryTypeTraitExpr
1003       EXPR_ARRAY_TYPE_TRAIT,      // ArrayTypeTraitIntExpr
1004       
1005       EXPR_PACK_EXPANSION,        // PackExpansionExpr
1006       EXPR_SIZEOF_PACK,           // SizeOfPackExpr
1007       EXPR_SUBST_NON_TYPE_TEMPLATE_PARM, // SubstNonTypeTemplateParmExpr
1008       EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK,// SubstNonTypeTemplateParmPackExpr
1009       EXPR_MATERIALIZE_TEMPORARY, // MaterializeTemporaryExpr
1010       
1011       // CUDA
1012       EXPR_CUDA_KERNEL_CALL,       // CUDAKernelCallExpr      
1013
1014       // OpenCL
1015       EXPR_ASTYPE,                 // AsTypeExpr
1016
1017       // Microsoft
1018       EXPR_CXX_UUIDOF_EXPR,       // CXXUuidofExpr (of expr).
1019       EXPR_CXX_UUIDOF_TYPE,       // CXXUuidofExpr (of type).
1020       STMT_SEH_EXCEPT,            // SEHExceptStmt
1021       STMT_SEH_FINALLY,           // SEHFinallyStmt
1022       STMT_SEH_TRY,               // SEHTryStmt
1023       
1024       // ARC
1025       EXPR_OBJC_BRIDGED_CAST       // ObjCBridgedCastExpr
1026     };
1027
1028     /// \brief The kinds of designators that can occur in a
1029     /// DesignatedInitExpr.
1030     enum DesignatorTypes {
1031       /// \brief Field designator where only the field name is known.
1032       DESIG_FIELD_NAME  = 0,
1033       /// \brief Field designator where the field has been resolved to
1034       /// a declaration.
1035       DESIG_FIELD_DECL  = 1,
1036       /// \brief Array designator.
1037       DESIG_ARRAY       = 2,
1038       /// \brief GNU array range designator.
1039       DESIG_ARRAY_RANGE = 3
1040     };
1041
1042     /// \brief The different kinds of data that can occur in a
1043     /// CtorInitializer.
1044     enum CtorInitializerType {
1045       CTOR_INITIALIZER_BASE,
1046       CTOR_INITIALIZER_DELEGATING,
1047       CTOR_INITIALIZER_MEMBER,
1048       CTOR_INITIALIZER_INDIRECT_MEMBER
1049     };
1050
1051     /// @}
1052   }
1053 } // end namespace clang
1054
1055 #endif