ASTBitCodes.h revision 162e1c1b487352434552147967c3dd296ebee2f7
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
25namespace 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      /// \brief The 'unknown any' type.
495      PREDEF_TYPE_UNKNOWN_ANY   = 29
496    };
497
498    /// \brief The number of predefined type IDs that are reserved for
499    /// the PREDEF_TYPE_* constants.
500    ///
501    /// Type IDs for non-predefined types will start at
502    /// NUM_PREDEF_TYPE_IDs.
503    const unsigned NUM_PREDEF_TYPE_IDS = 100;
504
505    /// \brief Record codes for each kind of type.
506    ///
507    /// These constants describe the type records that can occur within a
508    /// block identified by DECLTYPES_BLOCK_ID in the AST file. Each
509    /// constant describes a record for a specific type class in the
510    /// AST.
511    enum TypeCode {
512      /// \brief An ExtQualType record.
513      TYPE_EXT_QUAL                 = 1,
514      /// \brief A ComplexType record.
515      TYPE_COMPLEX                  = 3,
516      /// \brief A PointerType record.
517      TYPE_POINTER                  = 4,
518      /// \brief A BlockPointerType record.
519      TYPE_BLOCK_POINTER            = 5,
520      /// \brief An LValueReferenceType record.
521      TYPE_LVALUE_REFERENCE         = 6,
522      /// \brief An RValueReferenceType record.
523      TYPE_RVALUE_REFERENCE         = 7,
524      /// \brief A MemberPointerType record.
525      TYPE_MEMBER_POINTER           = 8,
526      /// \brief A ConstantArrayType record.
527      TYPE_CONSTANT_ARRAY           = 9,
528      /// \brief An IncompleteArrayType record.
529      TYPE_INCOMPLETE_ARRAY         = 10,
530      /// \brief A VariableArrayType record.
531      TYPE_VARIABLE_ARRAY           = 11,
532      /// \brief A VectorType record.
533      TYPE_VECTOR                   = 12,
534      /// \brief An ExtVectorType record.
535      TYPE_EXT_VECTOR               = 13,
536      /// \brief A FunctionNoProtoType record.
537      TYPE_FUNCTION_NO_PROTO        = 14,
538      /// \brief A FunctionProtoType record.
539      TYPE_FUNCTION_PROTO           = 15,
540      /// \brief A TypedefType record.
541      TYPE_TYPEDEF                  = 16,
542      /// \brief A TypeOfExprType record.
543      TYPE_TYPEOF_EXPR              = 17,
544      /// \brief A TypeOfType record.
545      TYPE_TYPEOF                   = 18,
546      /// \brief A RecordType record.
547      TYPE_RECORD                   = 19,
548      /// \brief An EnumType record.
549      TYPE_ENUM                     = 20,
550      /// \brief An ObjCInterfaceType record.
551      TYPE_OBJC_INTERFACE           = 21,
552      /// \brief An ObjCObjectPointerType record.
553      TYPE_OBJC_OBJECT_POINTER      = 22,
554      /// \brief a DecltypeType record.
555      TYPE_DECLTYPE                 = 23,
556      /// \brief An ElaboratedType record.
557      TYPE_ELABORATED               = 24,
558      /// \brief A SubstTemplateTypeParmType record.
559      TYPE_SUBST_TEMPLATE_TYPE_PARM = 25,
560      /// \brief An UnresolvedUsingType record.
561      TYPE_UNRESOLVED_USING         = 26,
562      /// \brief An InjectedClassNameType record.
563      TYPE_INJECTED_CLASS_NAME      = 27,
564      /// \brief An ObjCObjectType record.
565      TYPE_OBJC_OBJECT              = 28,
566      /// \brief An TemplateTypeParmType record.
567      TYPE_TEMPLATE_TYPE_PARM       = 29,
568      /// \brief An TemplateSpecializationType record.
569      TYPE_TEMPLATE_SPECIALIZATION  = 30,
570      /// \brief A DependentNameType record.
571      TYPE_DEPENDENT_NAME           = 31,
572      /// \brief A DependentTemplateSpecializationType record.
573      TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION = 32,
574      /// \brief A DependentSizedArrayType record.
575      TYPE_DEPENDENT_SIZED_ARRAY    = 33,
576      /// \brief A ParenType record.
577      TYPE_PAREN                    = 34,
578      /// \brief A PackExpansionType record.
579      TYPE_PACK_EXPANSION           = 35,
580      /// \brief An AttributedType record.
581      TYPE_ATTRIBUTED               = 36,
582      /// \brief A SubstTemplateTypeParmPackType record.
583      TYPE_SUBST_TEMPLATE_TYPE_PARM_PACK = 37,
584      /// \brief A AutoType record.
585      TYPE_AUTO                  = 38
586    };
587
588    /// \brief The type IDs for special types constructed by semantic
589    /// analysis.
590    ///
591    /// The constants in this enumeration are indices into the
592    /// SPECIAL_TYPES record.
593    enum SpecialTypeIDs {
594      /// \brief __builtin_va_list
595      SPECIAL_TYPE_BUILTIN_VA_LIST             = 0,
596      /// \brief Objective-C "id" type
597      SPECIAL_TYPE_OBJC_ID                     = 1,
598      /// \brief Objective-C selector type
599      SPECIAL_TYPE_OBJC_SELECTOR               = 2,
600      /// \brief Objective-C Protocol type
601      SPECIAL_TYPE_OBJC_PROTOCOL               = 3,
602      /// \brief Objective-C Class type
603      SPECIAL_TYPE_OBJC_CLASS                  = 4,
604      /// \brief CFConstantString type
605      SPECIAL_TYPE_CF_CONSTANT_STRING          = 5,
606      /// \brief Objective-C fast enumeration state type
607      SPECIAL_TYPE_OBJC_FAST_ENUMERATION_STATE = 6,
608      /// \brief C FILE typedef type
609      SPECIAL_TYPE_FILE                        = 7,
610      /// \brief C jmp_buf typedef type
611      SPECIAL_TYPE_jmp_buf                     = 8,
612      /// \brief C sigjmp_buf typedef type
613      SPECIAL_TYPE_sigjmp_buf                  = 9,
614      /// \brief Objective-C "id" redefinition type
615      SPECIAL_TYPE_OBJC_ID_REDEFINITION        = 10,
616      /// \brief Objective-C "Class" redefinition type
617      SPECIAL_TYPE_OBJC_CLASS_REDEFINITION     = 11,
618      /// \brief Block descriptor type for Blocks CodeGen
619      SPECIAL_TYPE_BLOCK_DESCRIPTOR            = 12,
620      /// \brief Block extedned descriptor type for Blocks CodeGen
621      SPECIAL_TYPE_BLOCK_EXTENDED_DESCRIPTOR   = 13,
622      /// \brief Objective-C "SEL" redefinition type
623      SPECIAL_TYPE_OBJC_SEL_REDEFINITION       = 14,
624      /// \brief NSConstantString type
625      SPECIAL_TYPE_NS_CONSTANT_STRING          = 15,
626      /// \brief Whether __[u]int128_t identifier is installed.
627      SPECIAL_TYPE_INT128_INSTALLED            = 16,
628      /// \brief Cached "auto" deduction type.
629      SPECIAL_TYPE_AUTO_DEDUCT                 = 17,
630      /// \brief Cached "auto &&" deduction type.
631      SPECIAL_TYPE_AUTO_RREF_DEDUCT            = 18
632    };
633
634    /// \brief Record codes for each kind of declaration.
635    ///
636    /// These constants describe the declaration records that can occur within
637    /// a declarations block (identified by DECLS_BLOCK_ID). Each
638    /// constant describes a record for a specific declaration class
639    /// in the AST.
640    enum DeclCode {
641      /// \brief A TranslationUnitDecl record.
642      DECL_TRANSLATION_UNIT = 50,
643      /// \brief A TypedefDecl record.
644      DECL_TYPEDEF,
645      /// \brief A TypeAliasDecl record.
646      DECL_TYPEALIAS,
647      /// \brief An EnumDecl record.
648      DECL_ENUM,
649      /// \brief A RecordDecl record.
650      DECL_RECORD,
651      /// \brief An EnumConstantDecl record.
652      DECL_ENUM_CONSTANT,
653      /// \brief A FunctionDecl record.
654      DECL_FUNCTION,
655      /// \brief A ObjCMethodDecl record.
656      DECL_OBJC_METHOD,
657      /// \brief A ObjCInterfaceDecl record.
658      DECL_OBJC_INTERFACE,
659      /// \brief A ObjCProtocolDecl record.
660      DECL_OBJC_PROTOCOL,
661      /// \brief A ObjCIvarDecl record.
662      DECL_OBJC_IVAR,
663      /// \brief A ObjCAtDefsFieldDecl record.
664      DECL_OBJC_AT_DEFS_FIELD,
665      /// \brief A ObjCClassDecl record.
666      DECL_OBJC_CLASS,
667      /// \brief A ObjCForwardProtocolDecl record.
668      DECL_OBJC_FORWARD_PROTOCOL,
669      /// \brief A ObjCCategoryDecl record.
670      DECL_OBJC_CATEGORY,
671      /// \brief A ObjCCategoryImplDecl record.
672      DECL_OBJC_CATEGORY_IMPL,
673      /// \brief A ObjCImplementationDecl record.
674      DECL_OBJC_IMPLEMENTATION,
675      /// \brief A ObjCCompatibleAliasDecl record.
676      DECL_OBJC_COMPATIBLE_ALIAS,
677      /// \brief A ObjCPropertyDecl record.
678      DECL_OBJC_PROPERTY,
679      /// \brief A ObjCPropertyImplDecl record.
680      DECL_OBJC_PROPERTY_IMPL,
681      /// \brief A FieldDecl record.
682      DECL_FIELD,
683      /// \brief A VarDecl record.
684      DECL_VAR,
685      /// \brief An ImplicitParamDecl record.
686      DECL_IMPLICIT_PARAM,
687      /// \brief A ParmVarDecl record.
688      DECL_PARM_VAR,
689      /// \brief A FileScopeAsmDecl record.
690      DECL_FILE_SCOPE_ASM,
691      /// \brief A BlockDecl record.
692      DECL_BLOCK,
693      /// \brief A record that stores the set of declarations that are
694      /// lexically stored within a given DeclContext.
695      ///
696      /// The record itself is a blob that is an array of declaration IDs,
697      /// in the order in which those declarations were added to the
698      /// declaration context. This data is used when iterating over
699      /// the contents of a DeclContext, e.g., via
700      /// DeclContext::decls_begin()/DeclContext::decls_end().
701      DECL_CONTEXT_LEXICAL,
702      /// \brief A record that stores the set of declarations that are
703      /// visible from a given DeclContext.
704      ///
705      /// The record itself stores a set of mappings, each of which
706      /// associates a declaration name with one or more declaration
707      /// IDs. This data is used when performing qualified name lookup
708      /// into a DeclContext via DeclContext::lookup.
709      DECL_CONTEXT_VISIBLE,
710      /// \brief A LabelDecl record.
711      DECL_LABEL,
712      /// \brief A NamespaceDecl record.
713      DECL_NAMESPACE,
714      /// \brief A NamespaceAliasDecl record.
715      DECL_NAMESPACE_ALIAS,
716      /// \brief A UsingDecl record.
717      DECL_USING,
718      /// \brief A UsingShadowDecl record.
719      DECL_USING_SHADOW,
720      /// \brief A UsingDirecitveDecl record.
721      DECL_USING_DIRECTIVE,
722      /// \brief An UnresolvedUsingValueDecl record.
723      DECL_UNRESOLVED_USING_VALUE,
724      /// \brief An UnresolvedUsingTypenameDecl record.
725      DECL_UNRESOLVED_USING_TYPENAME,
726      /// \brief A LinkageSpecDecl record.
727      DECL_LINKAGE_SPEC,
728      /// \brief A CXXRecordDecl record.
729      DECL_CXX_RECORD,
730      /// \brief A CXXMethodDecl record.
731      DECL_CXX_METHOD,
732      /// \brief A CXXConstructorDecl record.
733      DECL_CXX_CONSTRUCTOR,
734      /// \brief A CXXDestructorDecl record.
735      DECL_CXX_DESTRUCTOR,
736      /// \brief A CXXConversionDecl record.
737      DECL_CXX_CONVERSION,
738      /// \brief An AccessSpecDecl record.
739      DECL_ACCESS_SPEC,
740
741      /// \brief A FriendDecl record.
742      DECL_FRIEND,
743      /// \brief A FriendTemplateDecl record.
744      DECL_FRIEND_TEMPLATE,
745      /// \brief A ClassTemplateDecl record.
746      DECL_CLASS_TEMPLATE,
747      /// \brief A ClassTemplateSpecializationDecl record.
748      DECL_CLASS_TEMPLATE_SPECIALIZATION,
749      /// \brief A ClassTemplatePartialSpecializationDecl record.
750      DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION,
751      /// \brief A FunctionTemplateDecl record.
752      DECL_FUNCTION_TEMPLATE,
753      /// \brief A TemplateTypeParmDecl record.
754      DECL_TEMPLATE_TYPE_PARM,
755      /// \brief A NonTypeTemplateParmDecl record.
756      DECL_NON_TYPE_TEMPLATE_PARM,
757      /// \brief A TemplateTemplateParmDecl record.
758      DECL_TEMPLATE_TEMPLATE_PARM,
759      /// \brief A StaticAssertDecl record.
760      DECL_STATIC_ASSERT,
761      /// \brief A record containing CXXBaseSpecifiers.
762      DECL_CXX_BASE_SPECIFIERS,
763      /// \brief A IndirectFieldDecl record.
764      DECL_INDIRECTFIELD,
765      /// \brief A NonTypeTemplateParmDecl record that stores an expanded
766      /// non-type template parameter pack.
767      DECL_EXPANDED_NON_TYPE_TEMPLATE_PARM_PACK
768    };
769
770    /// \brief Record codes for each kind of statement or expression.
771    ///
772    /// These constants describe the records that describe statements
773    /// or expressions. These records  occur within type and declarations
774    /// block, so they begin with record values of 100.  Each constant
775    /// describes a record for a specific statement or expression class in the
776    /// AST.
777    enum StmtCode {
778      /// \brief A marker record that indicates that we are at the end
779      /// of an expression.
780      STMT_STOP = 100,
781      /// \brief A NULL expression.
782      STMT_NULL_PTR,
783      /// \brief A NullStmt record.
784      STMT_NULL,
785      /// \brief A CompoundStmt record.
786      STMT_COMPOUND,
787      /// \brief A CaseStmt record.
788      STMT_CASE,
789      /// \brief A DefaultStmt record.
790      STMT_DEFAULT,
791      /// \brief A LabelStmt record.
792      STMT_LABEL,
793      /// \brief An IfStmt record.
794      STMT_IF,
795      /// \brief A SwitchStmt record.
796      STMT_SWITCH,
797      /// \brief A WhileStmt record.
798      STMT_WHILE,
799      /// \brief A DoStmt record.
800      STMT_DO,
801      /// \brief A ForStmt record.
802      STMT_FOR,
803      /// \brief A GotoStmt record.
804      STMT_GOTO,
805      /// \brief An IndirectGotoStmt record.
806      STMT_INDIRECT_GOTO,
807      /// \brief A ContinueStmt record.
808      STMT_CONTINUE,
809      /// \brief A BreakStmt record.
810      STMT_BREAK,
811      /// \brief A ReturnStmt record.
812      STMT_RETURN,
813      /// \brief A DeclStmt record.
814      STMT_DECL,
815      /// \brief An AsmStmt record.
816      STMT_ASM,
817      /// \brief A PredefinedExpr record.
818      EXPR_PREDEFINED,
819      /// \brief A DeclRefExpr record.
820      EXPR_DECL_REF,
821      /// \brief An IntegerLiteral record.
822      EXPR_INTEGER_LITERAL,
823      /// \brief A FloatingLiteral record.
824      EXPR_FLOATING_LITERAL,
825      /// \brief An ImaginaryLiteral record.
826      EXPR_IMAGINARY_LITERAL,
827      /// \brief A StringLiteral record.
828      EXPR_STRING_LITERAL,
829      /// \brief A CharacterLiteral record.
830      EXPR_CHARACTER_LITERAL,
831      /// \brief A ParenExpr record.
832      EXPR_PAREN,
833      /// \brief A ParenListExpr record.
834      EXPR_PAREN_LIST,
835      /// \brief A UnaryOperator record.
836      EXPR_UNARY_OPERATOR,
837      /// \brief An OffsetOfExpr record.
838      EXPR_OFFSETOF,
839      /// \brief A SizefAlignOfExpr record.
840      EXPR_SIZEOF_ALIGN_OF,
841      /// \brief An ArraySubscriptExpr record.
842      EXPR_ARRAY_SUBSCRIPT,
843      /// \brief A CallExpr record.
844      EXPR_CALL,
845      /// \brief A MemberExpr record.
846      EXPR_MEMBER,
847      /// \brief A BinaryOperator record.
848      EXPR_BINARY_OPERATOR,
849      /// \brief A CompoundAssignOperator record.
850      EXPR_COMPOUND_ASSIGN_OPERATOR,
851      /// \brief A ConditionOperator record.
852      EXPR_CONDITIONAL_OPERATOR,
853      /// \brief An ImplicitCastExpr record.
854      EXPR_IMPLICIT_CAST,
855      /// \brief A CStyleCastExpr record.
856      EXPR_CSTYLE_CAST,
857      /// \brief A CompoundLiteralExpr record.
858      EXPR_COMPOUND_LITERAL,
859      /// \brief An ExtVectorElementExpr record.
860      EXPR_EXT_VECTOR_ELEMENT,
861      /// \brief An InitListExpr record.
862      EXPR_INIT_LIST,
863      /// \brief A DesignatedInitExpr record.
864      EXPR_DESIGNATED_INIT,
865      /// \brief An ImplicitValueInitExpr record.
866      EXPR_IMPLICIT_VALUE_INIT,
867      /// \brief A VAArgExpr record.
868      EXPR_VA_ARG,
869      /// \brief An AddrLabelExpr record.
870      EXPR_ADDR_LABEL,
871      /// \brief A StmtExpr record.
872      EXPR_STMT,
873      /// \brief A ChooseExpr record.
874      EXPR_CHOOSE,
875      /// \brief A GNUNullExpr record.
876      EXPR_GNU_NULL,
877      /// \brief A ShuffleVectorExpr record.
878      EXPR_SHUFFLE_VECTOR,
879      /// \brief BlockExpr
880      EXPR_BLOCK,
881      /// \brief A BlockDeclRef record.
882      EXPR_BLOCK_DECL_REF,
883      /// \brief A GenericSelectionExpr record.
884      EXPR_GENERIC_SELECTION,
885
886      // Objective-C
887
888      /// \brief An ObjCStringLiteral record.
889      EXPR_OBJC_STRING_LITERAL,
890      /// \brief An ObjCEncodeExpr record.
891      EXPR_OBJC_ENCODE,
892      /// \brief An ObjCSelectorExpr record.
893      EXPR_OBJC_SELECTOR_EXPR,
894      /// \brief An ObjCProtocolExpr record.
895      EXPR_OBJC_PROTOCOL_EXPR,
896      /// \brief An ObjCIvarRefExpr record.
897      EXPR_OBJC_IVAR_REF_EXPR,
898      /// \brief An ObjCPropertyRefExpr record.
899      EXPR_OBJC_PROPERTY_REF_EXPR,
900      /// \brief UNUSED
901      EXPR_OBJC_KVC_REF_EXPR,
902      /// \brief An ObjCMessageExpr record.
903      EXPR_OBJC_MESSAGE_EXPR,
904      /// \brief An ObjCIsa Expr record.
905      EXPR_OBJC_ISA,
906
907      /// \brief An ObjCForCollectionStmt record.
908      STMT_OBJC_FOR_COLLECTION,
909      /// \brief An ObjCAtCatchStmt record.
910      STMT_OBJC_CATCH,
911      /// \brief An ObjCAtFinallyStmt record.
912      STMT_OBJC_FINALLY,
913      /// \brief An ObjCAtTryStmt record.
914      STMT_OBJC_AT_TRY,
915      /// \brief An ObjCAtSynchronizedStmt record.
916      STMT_OBJC_AT_SYNCHRONIZED,
917      /// \brief An ObjCAtThrowStmt record.
918      STMT_OBJC_AT_THROW,
919
920      // C++
921
922      /// \brief A CXXCatchStmt record.
923      STMT_CXX_CATCH,
924      /// \brief A CXXTryStmt record.
925      STMT_CXX_TRY,
926      /// \brief A CXXForRangeStmt record.
927      STMT_CXX_FOR_RANGE,
928
929      /// \brief A CXXOperatorCallExpr record.
930      EXPR_CXX_OPERATOR_CALL,
931      /// \brief A CXXMemberCallExpr record.
932      EXPR_CXX_MEMBER_CALL,
933      /// \brief A CXXConstructExpr record.
934      EXPR_CXX_CONSTRUCT,
935      /// \brief A CXXTemporaryObjectExpr record.
936      EXPR_CXX_TEMPORARY_OBJECT,
937      /// \brief A CXXStaticCastExpr record.
938      EXPR_CXX_STATIC_CAST,
939      /// \brief A CXXDynamicCastExpr record.
940      EXPR_CXX_DYNAMIC_CAST,
941      /// \brief A CXXReinterpretCastExpr record.
942      EXPR_CXX_REINTERPRET_CAST,
943      /// \brief A CXXConstCastExpr record.
944      EXPR_CXX_CONST_CAST,
945      /// \brief A CXXFunctionalCastExpr record.
946      EXPR_CXX_FUNCTIONAL_CAST,
947      /// \brief A CXXBoolLiteralExpr record.
948      EXPR_CXX_BOOL_LITERAL,
949      EXPR_CXX_NULL_PTR_LITERAL,  // CXXNullPtrLiteralExpr
950      EXPR_CXX_TYPEID_EXPR,       // CXXTypeidExpr (of expr).
951      EXPR_CXX_TYPEID_TYPE,       // CXXTypeidExpr (of type).
952      EXPR_CXX_UUIDOF_EXPR,       // CXXUuidofExpr (of expr).
953      EXPR_CXX_UUIDOF_TYPE,       // CXXUuidofExpr (of type).
954      EXPR_CXX_THIS,              // CXXThisExpr
955      EXPR_CXX_THROW,             // CXXThrowExpr
956      EXPR_CXX_DEFAULT_ARG,       // CXXDefaultArgExpr
957      EXPR_CXX_BIND_TEMPORARY,    // CXXBindTemporaryExpr
958
959      EXPR_CXX_SCALAR_VALUE_INIT, // CXXScalarValueInitExpr
960      EXPR_CXX_NEW,               // CXXNewExpr
961      EXPR_CXX_DELETE,            // CXXDeleteExpr
962      EXPR_CXX_PSEUDO_DESTRUCTOR, // CXXPseudoDestructorExpr
963
964      EXPR_EXPR_WITH_CLEANUPS,    // ExprWithCleanups
965
966      EXPR_CXX_DEPENDENT_SCOPE_MEMBER,   // CXXDependentScopeMemberExpr
967      EXPR_CXX_DEPENDENT_SCOPE_DECL_REF, // DependentScopeDeclRefExpr
968      EXPR_CXX_UNRESOLVED_CONSTRUCT,     // CXXUnresolvedConstructExpr
969      EXPR_CXX_UNRESOLVED_MEMBER,        // UnresolvedMemberExpr
970      EXPR_CXX_UNRESOLVED_LOOKUP,        // UnresolvedLookupExpr
971
972      EXPR_CXX_UNARY_TYPE_TRAIT,  // UnaryTypeTraitExpr
973      EXPR_CXX_NOEXCEPT,          // CXXNoexceptExpr
974
975      EXPR_OPAQUE_VALUE,          // OpaqueValueExpr
976      EXPR_BINARY_CONDITIONAL_OPERATOR,  // BinaryConditionalOperator
977      EXPR_BINARY_TYPE_TRAIT,     // BinaryTypeTraitExpr
978
979      EXPR_PACK_EXPANSION,        // PackExpansionExpr
980      EXPR_SIZEOF_PACK,           // SizeOfPackExpr
981      EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK,// SubstNonTypeTemplateParmPackExpr
982
983      // CUDA
984
985      EXPR_CUDA_KERNEL_CALL       // CUDAKernelCallExpr
986    };
987
988    /// \brief The kinds of designators that can occur in a
989    /// DesignatedInitExpr.
990    enum DesignatorTypes {
991      /// \brief Field designator where only the field name is known.
992      DESIG_FIELD_NAME  = 0,
993      /// \brief Field designator where the field has been resolved to
994      /// a declaration.
995      DESIG_FIELD_DECL  = 1,
996      /// \brief Array designator.
997      DESIG_ARRAY       = 2,
998      /// \brief GNU array range designator.
999      DESIG_ARRAY_RANGE = 3
1000    };
1001
1002    /// @}
1003  }
1004} // end namespace clang
1005
1006#endif
1007