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