ASTBitCodes.h revision 360784
1//===- ASTBitCodes.h - Enum values for the PCH bitcode format ---*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This header defines Bitcode enum values for Clang serialized AST files.
10//
11// The enum values defined in this file should be considered permanent.  If
12// new features are added, they should have values added at the end of the
13// respective lists.
14//
15//===----------------------------------------------------------------------===//
16
17#ifndef LLVM_CLANG_SERIALIZATION_ASTBITCODES_H
18#define LLVM_CLANG_SERIALIZATION_ASTBITCODES_H
19
20#include "clang/AST/DeclarationName.h"
21#include "clang/AST/Type.h"
22#include "clang/Basic/IdentifierTable.h"
23#include "clang/Basic/OperatorKinds.h"
24#include "clang/Basic/SourceLocation.h"
25#include "llvm/ADT/DenseMapInfo.h"
26#include "llvm/Bitstream/BitCodes.h"
27#include <cassert>
28#include <cstdint>
29
30namespace clang {
31namespace serialization {
32
33    /// AST file major version number supported by this version of
34    /// Clang.
35    ///
36    /// Whenever the AST file format changes in a way that makes it
37    /// incompatible with previous versions (such that a reader
38    /// designed for the previous version could not support reading
39    /// the new version), this number should be increased.
40    ///
41    /// Version 4 of AST files also requires that the version control branch and
42    /// revision match exactly, since there is no backward compatibility of
43    /// AST files at this time.
44    const unsigned VERSION_MAJOR = 8;
45
46    /// AST file minor version number supported by this version of
47    /// Clang.
48    ///
49    /// Whenever the AST format changes in a way that is still
50    /// compatible with previous versions (such that a reader designed
51    /// for the previous version could still support reading the new
52    /// version by ignoring new kinds of subblocks), this number
53    /// should be increased.
54    const unsigned VERSION_MINOR = 0;
55
56    /// An ID number that refers to an identifier in an AST file.
57    ///
58    /// The ID numbers of identifiers are consecutive (in order of discovery)
59    /// and start at 1. 0 is reserved for NULL.
60    using IdentifierID = uint32_t;
61
62    /// An ID number that refers to a declaration in an AST file.
63    ///
64    /// The ID numbers of declarations are consecutive (in order of
65    /// discovery), with values below NUM_PREDEF_DECL_IDS being reserved.
66    /// At the start of a chain of precompiled headers, declaration ID 1 is
67    /// used for the translation unit declaration.
68    using DeclID = uint32_t;
69
70    // FIXME: Turn these into classes so we can have some type safety when
71    // we go from local ID to global and vice-versa.
72    using LocalDeclID = DeclID;
73    using GlobalDeclID = DeclID;
74
75    /// An ID number that refers to a type in an AST file.
76    ///
77    /// The ID of a type is partitioned into two parts: the lower
78    /// three bits are used to store the const/volatile/restrict
79    /// qualifiers (as with QualType) and the upper bits provide a
80    /// type index. The type index values are partitioned into two
81    /// sets. The values below NUM_PREDEF_TYPE_IDs are predefined type
82    /// IDs (based on the PREDEF_TYPE_*_ID constants), with 0 as a
83    /// placeholder for "no type". Values from NUM_PREDEF_TYPE_IDs are
84    /// other types that have serialized representations.
85    using TypeID = uint32_t;
86
87    /// A type index; the type ID with the qualifier bits removed.
88    class TypeIdx {
89      uint32_t Idx = 0;
90
91    public:
92      TypeIdx() = default;
93      explicit TypeIdx(uint32_t index) : Idx(index) {}
94
95      uint32_t getIndex() const { return Idx; }
96
97      TypeID asTypeID(unsigned FastQuals) const {
98        if (Idx == uint32_t(-1))
99          return TypeID(-1);
100
101        return (Idx << Qualifiers::FastWidth) | FastQuals;
102      }
103
104      static TypeIdx fromTypeID(TypeID ID) {
105        if (ID == TypeID(-1))
106          return TypeIdx(-1);
107
108        return TypeIdx(ID >> Qualifiers::FastWidth);
109      }
110    };
111
112    /// A structure for putting "fast"-unqualified QualTypes into a
113    /// DenseMap.  This uses the standard pointer hash function.
114    struct UnsafeQualTypeDenseMapInfo {
115      static bool isEqual(QualType A, QualType B) { return A == B; }
116
117      static QualType getEmptyKey() {
118        return QualType::getFromOpaquePtr((void*) 1);
119      }
120
121      static QualType getTombstoneKey() {
122        return QualType::getFromOpaquePtr((void*) 2);
123      }
124
125      static unsigned getHashValue(QualType T) {
126        assert(!T.getLocalFastQualifiers() &&
127               "hash invalid for types with fast quals");
128        uintptr_t v = reinterpret_cast<uintptr_t>(T.getAsOpaquePtr());
129        return (unsigned(v) >> 4) ^ (unsigned(v) >> 9);
130      }
131    };
132
133    /// An ID number that refers to an identifier in an AST file.
134    using IdentID = uint32_t;
135
136    /// The number of predefined identifier IDs.
137    const unsigned int NUM_PREDEF_IDENT_IDS = 1;
138
139    /// An ID number that refers to a macro in an AST file.
140    using MacroID = uint32_t;
141
142    /// A global ID number that refers to a macro in an AST file.
143    using GlobalMacroID = uint32_t;
144
145    /// A local to a module ID number that refers to a macro in an
146    /// AST file.
147    using LocalMacroID = uint32_t;
148
149    /// The number of predefined macro IDs.
150    const unsigned int NUM_PREDEF_MACRO_IDS = 1;
151
152    /// An ID number that refers to an ObjC selector in an AST file.
153    using SelectorID = uint32_t;
154
155    /// The number of predefined selector IDs.
156    const unsigned int NUM_PREDEF_SELECTOR_IDS = 1;
157
158    /// An ID number that refers to a set of CXXBaseSpecifiers in an
159    /// AST file.
160    using CXXBaseSpecifiersID = uint32_t;
161
162    /// An ID number that refers to a list of CXXCtorInitializers in an
163    /// AST file.
164    using CXXCtorInitializersID = uint32_t;
165
166    /// An ID number that refers to an entity in the detailed
167    /// preprocessing record.
168    using PreprocessedEntityID = uint32_t;
169
170    /// An ID number that refers to a submodule in a module file.
171    using SubmoduleID = uint32_t;
172
173    /// The number of predefined submodule IDs.
174    const unsigned int NUM_PREDEF_SUBMODULE_IDS = 1;
175
176    /// Source range/offset of a preprocessed entity.
177    struct PPEntityOffset {
178      /// Raw source location of beginning of range.
179      unsigned Begin;
180
181      /// Raw source location of end of range.
182      unsigned End;
183
184      /// Offset in the AST file.
185      uint32_t BitOffset;
186
187      PPEntityOffset(SourceRange R, uint32_t BitOffset)
188        : Begin(R.getBegin().getRawEncoding()),
189          End(R.getEnd().getRawEncoding()), BitOffset(BitOffset) {}
190
191      SourceLocation getBegin() const {
192        return SourceLocation::getFromRawEncoding(Begin);
193      }
194
195      SourceLocation getEnd() const {
196        return SourceLocation::getFromRawEncoding(End);
197      }
198    };
199
200    /// Source range of a skipped preprocessor region
201    struct PPSkippedRange {
202      /// Raw source location of beginning of range.
203      unsigned Begin;
204      /// Raw source location of end of range.
205      unsigned End;
206
207      PPSkippedRange(SourceRange R)
208        : Begin(R.getBegin().getRawEncoding()),
209          End(R.getEnd().getRawEncoding()) { }
210
211      SourceLocation getBegin() const {
212        return SourceLocation::getFromRawEncoding(Begin);
213      }
214      SourceLocation getEnd() const {
215        return SourceLocation::getFromRawEncoding(End);
216      }
217    };
218
219    /// Source range/offset of a preprocessed entity.
220    struct DeclOffset {
221      /// Raw source location.
222      unsigned Loc = 0;
223
224      /// Offset in the AST file.
225      uint32_t BitOffset = 0;
226
227      DeclOffset() = default;
228      DeclOffset(SourceLocation Loc, uint32_t BitOffset)
229        : Loc(Loc.getRawEncoding()), BitOffset(BitOffset) {}
230
231      void setLocation(SourceLocation L) {
232        Loc = L.getRawEncoding();
233      }
234
235      SourceLocation getLocation() const {
236        return SourceLocation::getFromRawEncoding(Loc);
237      }
238    };
239
240    /// The number of predefined preprocessed entity IDs.
241    const unsigned int NUM_PREDEF_PP_ENTITY_IDS = 1;
242
243    /// Describes the various kinds of blocks that occur within
244    /// an AST file.
245    enum BlockIDs {
246      /// The AST block, which acts as a container around the
247      /// full AST block.
248      AST_BLOCK_ID = llvm::bitc::FIRST_APPLICATION_BLOCKID,
249
250      /// The block containing information about the source
251      /// manager.
252      SOURCE_MANAGER_BLOCK_ID,
253
254      /// The block containing information about the
255      /// preprocessor.
256      PREPROCESSOR_BLOCK_ID,
257
258      /// The block containing the definitions of all of the
259      /// types and decls used within the AST file.
260      DECLTYPES_BLOCK_ID,
261
262      /// The block containing the detailed preprocessing record.
263      PREPROCESSOR_DETAIL_BLOCK_ID,
264
265      /// The block containing the submodule structure.
266      SUBMODULE_BLOCK_ID,
267
268      /// The block containing comments.
269      COMMENTS_BLOCK_ID,
270
271      /// The control block, which contains all of the
272      /// information that needs to be validated prior to committing
273      /// to loading the AST file.
274      CONTROL_BLOCK_ID,
275
276      /// The block of input files, which were used as inputs
277      /// to create this AST file.
278      ///
279      /// This block is part of the control block.
280      INPUT_FILES_BLOCK_ID,
281
282      /// The block of configuration options, used to check that
283      /// a module is being used in a configuration compatible with the
284      /// configuration in which it was built.
285      ///
286      /// This block is part of the control block.
287      OPTIONS_BLOCK_ID,
288
289      /// A block containing a module file extension.
290      EXTENSION_BLOCK_ID,
291
292      /// A block with unhashed content.
293      ///
294      /// These records should not change the \a ASTFileSignature.  See \a
295      /// UnhashedControlBlockRecordTypes for the list of records.
296      UNHASHED_CONTROL_BLOCK_ID,
297    };
298
299    /// Record types that occur within the control block.
300    enum ControlRecordTypes {
301      /// AST file metadata, including the AST file version number
302      /// and information about the compiler used to build this AST file.
303      METADATA = 1,
304
305      /// Record code for the list of other AST files imported by
306      /// this AST file.
307      IMPORTS,
308
309      /// Record code for the original file that was used to
310      /// generate the AST file, including both its file ID and its
311      /// name.
312      ORIGINAL_FILE,
313
314      /// The directory that the PCH was originally created in.
315      ORIGINAL_PCH_DIR,
316
317      /// Record code for file ID of the file or buffer that was used to
318      /// generate the AST file.
319      ORIGINAL_FILE_ID,
320
321      /// Offsets into the input-files block where input files
322      /// reside.
323      INPUT_FILE_OFFSETS,
324
325      /// Record code for the module name.
326      MODULE_NAME,
327
328      /// Record code for the module map file that was used to build this
329      /// AST file.
330      MODULE_MAP_FILE,
331
332      /// Record code for the module build directory.
333      MODULE_DIRECTORY,
334    };
335
336    /// Record types that occur within the options block inside
337    /// the control block.
338    enum OptionsRecordTypes {
339      /// Record code for the language options table.
340      ///
341      /// The record with this code contains the contents of the
342      /// LangOptions structure. We serialize the entire contents of
343      /// the structure, and let the reader decide which options are
344      /// actually important to check.
345      LANGUAGE_OPTIONS = 1,
346
347      /// Record code for the target options table.
348      TARGET_OPTIONS,
349
350      /// Record code for the filesystem options table.
351      FILE_SYSTEM_OPTIONS,
352
353      /// Record code for the headers search options table.
354      HEADER_SEARCH_OPTIONS,
355
356      /// Record code for the preprocessor options table.
357      PREPROCESSOR_OPTIONS,
358    };
359
360    /// Record codes for the unhashed control block.
361    enum UnhashedControlBlockRecordTypes {
362      /// Record code for the signature that identifiers this AST file.
363      SIGNATURE = 1,
364
365      /// Record code for the diagnostic options table.
366      DIAGNOSTIC_OPTIONS,
367
368      /// Record code for \#pragma diagnostic mappings.
369      DIAG_PRAGMA_MAPPINGS,
370    };
371
372    /// Record code for extension blocks.
373    enum ExtensionBlockRecordTypes {
374      /// Metadata describing this particular extension.
375      EXTENSION_METADATA = 1,
376
377      /// The first record ID allocated to the extensions themselves.
378      FIRST_EXTENSION_RECORD_ID = 4
379    };
380
381    /// Record types that occur within the input-files block
382    /// inside the control block.
383    enum InputFileRecordTypes {
384      /// An input file.
385      INPUT_FILE = 1,
386
387      /// The input file content hash
388      INPUT_FILE_HASH
389    };
390
391    /// Record types that occur within the AST block itself.
392    enum ASTRecordTypes {
393      /// Record code for the offsets of each type.
394      ///
395      /// The TYPE_OFFSET constant describes the record that occurs
396      /// within the AST block. The record itself is an array of offsets that
397      /// point into the declarations and types block (identified by
398      /// DECLTYPES_BLOCK_ID). The index into the array is based on the ID
399      /// of a type. For a given type ID @c T, the lower three bits of
400      /// @c T are its qualifiers (const, volatile, restrict), as in
401      /// the QualType class. The upper bits, after being shifted and
402      /// subtracting NUM_PREDEF_TYPE_IDS, are used to index into the
403      /// TYPE_OFFSET block to determine the offset of that type's
404      /// corresponding record within the DECLTYPES_BLOCK_ID block.
405      TYPE_OFFSET = 1,
406
407      /// Record code for the offsets of each decl.
408      ///
409      /// The DECL_OFFSET constant describes the record that occurs
410      /// within the block identified by DECL_OFFSETS_BLOCK_ID within
411      /// the AST block. The record itself is an array of offsets that
412      /// point into the declarations and types block (identified by
413      /// DECLTYPES_BLOCK_ID). The declaration ID is an index into this
414      /// record, after subtracting one to account for the use of
415      /// declaration ID 0 for a NULL declaration pointer. Index 0 is
416      /// reserved for the translation unit declaration.
417      DECL_OFFSET = 2,
418
419      /// Record code for the table of offsets of each
420      /// identifier ID.
421      ///
422      /// The offset table contains offsets into the blob stored in
423      /// the IDENTIFIER_TABLE record. Each offset points to the
424      /// NULL-terminated string that corresponds to that identifier.
425      IDENTIFIER_OFFSET = 3,
426
427      /// This is so that older clang versions, before the introduction
428      /// of the control block, can read and reject the newer PCH format.
429      /// *DON'T CHANGE THIS NUMBER*.
430      METADATA_OLD_FORMAT = 4,
431
432      /// Record code for the identifier table.
433      ///
434      /// The identifier table is a simple blob that contains
435      /// NULL-terminated strings for all of the identifiers
436      /// referenced by the AST file. The IDENTIFIER_OFFSET table
437      /// contains the mapping from identifier IDs to the characters
438      /// in this blob. Note that the starting offsets of all of the
439      /// identifiers are odd, so that, when the identifier offset
440      /// table is loaded in, we can use the low bit to distinguish
441      /// between offsets (for unresolved identifier IDs) and
442      /// IdentifierInfo pointers (for already-resolved identifier
443      /// IDs).
444      IDENTIFIER_TABLE = 5,
445
446      /// Record code for the array of eagerly deserialized decls.
447      ///
448      /// The AST file contains a list of all of the declarations that should be
449      /// eagerly deserialized present within the parsed headers, stored as an
450      /// array of declaration IDs. These declarations will be
451      /// reported to the AST consumer after the AST file has been
452      /// read, since their presence can affect the semantics of the
453      /// program (e.g., for code generation).
454      EAGERLY_DESERIALIZED_DECLS = 6,
455
456      /// Record code for the set of non-builtin, special
457      /// types.
458      ///
459      /// This record contains the type IDs for the various type nodes
460      /// that are constructed during semantic analysis (e.g.,
461      /// __builtin_va_list). The SPECIAL_TYPE_* constants provide
462      /// offsets into this record.
463      SPECIAL_TYPES = 7,
464
465      /// Record code for the extra statistics we gather while
466      /// generating an AST file.
467      STATISTICS = 8,
468
469      /// Record code for the array of tentative definitions.
470      TENTATIVE_DEFINITIONS = 9,
471
472      // ID 10 used to be for a list of extern "C" declarations.
473
474      /// Record code for the table of offsets into the
475      /// Objective-C method pool.
476      SELECTOR_OFFSETS = 11,
477
478      /// Record code for the Objective-C method pool,
479      METHOD_POOL = 12,
480
481      /// The value of the next __COUNTER__ to dispense.
482      /// [PP_COUNTER_VALUE, Val]
483      PP_COUNTER_VALUE = 13,
484
485      /// Record code for the table of offsets into the block
486      /// of source-location information.
487      SOURCE_LOCATION_OFFSETS = 14,
488
489      /// Record code for the set of source location entries
490      /// that need to be preloaded by the AST reader.
491      ///
492      /// This set contains the source location entry for the
493      /// predefines buffer and for any file entries that need to be
494      /// preloaded.
495      SOURCE_LOCATION_PRELOADS = 15,
496
497      /// Record code for the set of ext_vector type names.
498      EXT_VECTOR_DECLS = 16,
499
500      /// Record code for the array of unused file scoped decls.
501      UNUSED_FILESCOPED_DECLS = 17,
502
503      /// Record code for the table of offsets to entries in the
504      /// preprocessing record.
505      PPD_ENTITIES_OFFSETS = 18,
506
507      /// Record code for the array of VTable uses.
508      VTABLE_USES = 19,
509
510      // ID 20 used to be for a list of dynamic classes.
511
512      /// Record code for referenced selector pool.
513      REFERENCED_SELECTOR_POOL = 21,
514
515      /// Record code for an update to the TU's lexically contained
516      /// declarations.
517      TU_UPDATE_LEXICAL = 22,
518
519      // ID 23 used to be for a list of local redeclarations.
520
521      /// Record code for declarations that Sema keeps references of.
522      SEMA_DECL_REFS = 24,
523
524      /// Record code for weak undeclared identifiers.
525      WEAK_UNDECLARED_IDENTIFIERS = 25,
526
527      /// Record code for pending implicit instantiations.
528      PENDING_IMPLICIT_INSTANTIATIONS = 26,
529
530      // ID 27 used to be for a list of replacement decls.
531
532      /// Record code for an update to a decl context's lookup table.
533      ///
534      /// In practice, this should only be used for the TU and namespaces.
535      UPDATE_VISIBLE = 28,
536
537      /// Record for offsets of DECL_UPDATES records for declarations
538      /// that were modified after being deserialized and need updates.
539      DECL_UPDATE_OFFSETS = 29,
540
541      // ID 30 used to be a decl update record. These are now in the DECLTYPES
542      // block.
543
544      // ID 31 used to be a list of offsets to DECL_CXX_BASE_SPECIFIERS records.
545
546      // ID 32 used to be the code for \#pragma diagnostic mappings.
547
548      /// Record code for special CUDA declarations.
549      CUDA_SPECIAL_DECL_REFS = 33,
550
551      /// Record code for header search information.
552      HEADER_SEARCH_TABLE = 34,
553
554      /// Record code for floating point \#pragma options.
555      FP_PRAGMA_OPTIONS = 35,
556
557      /// Record code for enabled OpenCL extensions.
558      OPENCL_EXTENSIONS = 36,
559
560      /// The list of delegating constructor declarations.
561      DELEGATING_CTORS = 37,
562
563      /// Record code for the set of known namespaces, which are used
564      /// for typo correction.
565      KNOWN_NAMESPACES = 38,
566
567      /// Record code for the remapping information used to relate
568      /// loaded modules to the various offsets and IDs(e.g., source location
569      /// offests, declaration and type IDs) that are used in that module to
570      /// refer to other modules.
571      MODULE_OFFSET_MAP = 39,
572
573      /// Record code for the source manager line table information,
574      /// which stores information about \#line directives.
575      SOURCE_MANAGER_LINE_TABLE = 40,
576
577      /// Record code for map of Objective-C class definition IDs to the
578      /// ObjC categories in a module that are attached to that class.
579      OBJC_CATEGORIES_MAP = 41,
580
581      /// Record code for a file sorted array of DeclIDs in a module.
582      FILE_SORTED_DECLS = 42,
583
584      /// Record code for an array of all of the (sub)modules that were
585      /// imported by the AST file.
586      IMPORTED_MODULES = 43,
587
588      // ID 44 used to be a table of merged canonical declarations.
589      // ID 45 used to be a list of declaration IDs of local redeclarations.
590
591      /// Record code for the array of Objective-C categories (including
592      /// extensions).
593      ///
594      /// This array can only be interpreted properly using the Objective-C
595      /// categories map.
596      OBJC_CATEGORIES = 46,
597
598      /// Record code for the table of offsets of each macro ID.
599      ///
600      /// The offset table contains offsets into the blob stored in
601      /// the preprocessor block. Each offset points to the corresponding
602      /// macro definition.
603      MACRO_OFFSET = 47,
604
605      /// A list of "interesting" identifiers. Only used in C++ (where we
606      /// don't normally do lookups into the serialized identifier table). These
607      /// are eagerly deserialized.
608      INTERESTING_IDENTIFIERS = 48,
609
610      /// Record code for undefined but used functions and variables that
611      /// need a definition in this TU.
612      UNDEFINED_BUT_USED = 49,
613
614      /// Record code for late parsed template functions.
615      LATE_PARSED_TEMPLATE = 50,
616
617      /// Record code for \#pragma optimize options.
618      OPTIMIZE_PRAGMA_OPTIONS = 51,
619
620      /// Record code for potentially unused local typedef names.
621      UNUSED_LOCAL_TYPEDEF_NAME_CANDIDATES = 52,
622
623      // ID 53 used to be a table of constructor initializer records.
624
625      /// Delete expressions that will be analyzed later.
626      DELETE_EXPRS_TO_ANALYZE = 54,
627
628      /// Record code for \#pragma ms_struct options.
629      MSSTRUCT_PRAGMA_OPTIONS = 55,
630
631      /// Record code for \#pragma ms_struct options.
632      POINTERS_TO_MEMBERS_PRAGMA_OPTIONS = 56,
633
634      /// Number of unmatched #pragma clang cuda_force_host_device begin
635      /// directives we've seen.
636      CUDA_PRAGMA_FORCE_HOST_DEVICE_DEPTH = 57,
637
638      /// Record code for types associated with OpenCL extensions.
639      OPENCL_EXTENSION_TYPES = 58,
640
641      /// Record code for declarations associated with OpenCL extensions.
642      OPENCL_EXTENSION_DECLS = 59,
643
644      MODULAR_CODEGEN_DECLS = 60,
645
646      /// Record code for \#pragma pack options.
647      PACK_PRAGMA_OPTIONS = 61,
648
649      /// The stack of open #ifs/#ifdefs recorded in a preamble.
650      PP_CONDITIONAL_STACK = 62,
651
652      /// A table of skipped ranges within the preprocessing record.
653      PPD_SKIPPED_RANGES = 63
654    };
655
656    /// Record types used within a source manager block.
657    enum SourceManagerRecordTypes {
658      /// Describes a source location entry (SLocEntry) for a
659      /// file.
660      SM_SLOC_FILE_ENTRY = 1,
661
662      /// Describes a source location entry (SLocEntry) for a
663      /// buffer.
664      SM_SLOC_BUFFER_ENTRY = 2,
665
666      /// Describes a blob that contains the data for a buffer
667      /// entry. This kind of record always directly follows a
668      /// SM_SLOC_BUFFER_ENTRY record or a SM_SLOC_FILE_ENTRY with an
669      /// overridden buffer.
670      SM_SLOC_BUFFER_BLOB = 3,
671
672      /// Describes a zlib-compressed blob that contains the data for
673      /// a buffer entry.
674      SM_SLOC_BUFFER_BLOB_COMPRESSED = 4,
675
676      /// Describes a source location entry (SLocEntry) for a
677      /// macro expansion.
678      SM_SLOC_EXPANSION_ENTRY = 5
679    };
680
681    /// Record types used within a preprocessor block.
682    enum PreprocessorRecordTypes {
683      // The macros in the PP section are a PP_MACRO_* instance followed by a
684      // list of PP_TOKEN instances for each token in the definition.
685
686      /// An object-like macro definition.
687      /// [PP_MACRO_OBJECT_LIKE, IdentInfoID, SLoc, IsUsed]
688      PP_MACRO_OBJECT_LIKE = 1,
689
690      /// A function-like macro definition.
691      /// [PP_MACRO_FUNCTION_LIKE, \<ObjectLikeStuff>, IsC99Varargs,
692      /// IsGNUVarars, NumArgs, ArgIdentInfoID* ]
693      PP_MACRO_FUNCTION_LIKE = 2,
694
695      /// Describes one token.
696      /// [PP_TOKEN, SLoc, Length, IdentInfoID, Kind, Flags]
697      PP_TOKEN = 3,
698
699      /// The macro directives history for a particular identifier.
700      PP_MACRO_DIRECTIVE_HISTORY = 4,
701
702      /// A macro directive exported by a module.
703      /// [PP_MODULE_MACRO, SubmoduleID, MacroID, (Overridden SubmoduleID)*]
704      PP_MODULE_MACRO = 5,
705    };
706
707    /// Record types used within a preprocessor detail block.
708    enum PreprocessorDetailRecordTypes {
709      /// Describes a macro expansion within the preprocessing record.
710      PPD_MACRO_EXPANSION = 0,
711
712      /// Describes a macro definition within the preprocessing record.
713      PPD_MACRO_DEFINITION = 1,
714
715      /// Describes an inclusion directive within the preprocessing
716      /// record.
717      PPD_INCLUSION_DIRECTIVE = 2
718    };
719
720    /// Record types used within a submodule description block.
721    enum SubmoduleRecordTypes {
722      /// Metadata for submodules as a whole.
723      SUBMODULE_METADATA = 0,
724
725      /// Defines the major attributes of a submodule, including its
726      /// name and parent.
727      SUBMODULE_DEFINITION = 1,
728
729      /// Specifies the umbrella header used to create this module,
730      /// if any.
731      SUBMODULE_UMBRELLA_HEADER = 2,
732
733      /// Specifies a header that falls into this (sub)module.
734      SUBMODULE_HEADER = 3,
735
736      /// Specifies a top-level header that falls into this (sub)module.
737      SUBMODULE_TOPHEADER = 4,
738
739      /// Specifies an umbrella directory.
740      SUBMODULE_UMBRELLA_DIR = 5,
741
742      /// Specifies the submodules that are imported by this
743      /// submodule.
744      SUBMODULE_IMPORTS = 6,
745
746      /// Specifies the submodules that are re-exported from this
747      /// submodule.
748      SUBMODULE_EXPORTS = 7,
749
750      /// Specifies a required feature.
751      SUBMODULE_REQUIRES = 8,
752
753      /// Specifies a header that has been explicitly excluded
754      /// from this submodule.
755      SUBMODULE_EXCLUDED_HEADER = 9,
756
757      /// Specifies a library or framework to link against.
758      SUBMODULE_LINK_LIBRARY = 10,
759
760      /// Specifies a configuration macro for this module.
761      SUBMODULE_CONFIG_MACRO = 11,
762
763      /// Specifies a conflict with another module.
764      SUBMODULE_CONFLICT = 12,
765
766      /// Specifies a header that is private to this submodule.
767      SUBMODULE_PRIVATE_HEADER = 13,
768
769      /// Specifies a header that is part of the module but must be
770      /// textually included.
771      SUBMODULE_TEXTUAL_HEADER = 14,
772
773      /// Specifies a header that is private to this submodule but
774      /// must be textually included.
775      SUBMODULE_PRIVATE_TEXTUAL_HEADER = 15,
776
777      /// Specifies some declarations with initializers that must be
778      /// emitted to initialize the module.
779      SUBMODULE_INITIALIZERS = 16,
780
781      /// Specifies the name of the module that will eventually
782      /// re-export the entities in this module.
783      SUBMODULE_EXPORT_AS = 17,
784    };
785
786    /// Record types used within a comments block.
787    enum CommentRecordTypes {
788      COMMENTS_RAW_COMMENT = 0
789    };
790
791    /// \defgroup ASTAST AST file AST constants
792    ///
793    /// The constants in this group describe various components of the
794    /// abstract syntax tree within an AST file.
795    ///
796    /// @{
797
798    /// Predefined type IDs.
799    ///
800    /// These type IDs correspond to predefined types in the AST
801    /// context, such as built-in types (int) and special place-holder
802    /// types (the \<overload> and \<dependent> type markers). Such
803    /// types are never actually serialized, since they will be built
804    /// by the AST context when it is created.
805    enum PredefinedTypeIDs {
806      /// The NULL type.
807      PREDEF_TYPE_NULL_ID       = 0,
808
809      /// The void type.
810      PREDEF_TYPE_VOID_ID       = 1,
811
812      /// The 'bool' or '_Bool' type.
813      PREDEF_TYPE_BOOL_ID       = 2,
814
815      /// The 'char' type, when it is unsigned.
816      PREDEF_TYPE_CHAR_U_ID     = 3,
817
818      /// The 'unsigned char' type.
819      PREDEF_TYPE_UCHAR_ID      = 4,
820
821      /// The 'unsigned short' type.
822      PREDEF_TYPE_USHORT_ID     = 5,
823
824      /// The 'unsigned int' type.
825      PREDEF_TYPE_UINT_ID       = 6,
826
827      /// The 'unsigned long' type.
828      PREDEF_TYPE_ULONG_ID      = 7,
829
830      /// The 'unsigned long long' type.
831      PREDEF_TYPE_ULONGLONG_ID  = 8,
832
833      /// The 'char' type, when it is signed.
834      PREDEF_TYPE_CHAR_S_ID     = 9,
835
836      /// The 'signed char' type.
837      PREDEF_TYPE_SCHAR_ID      = 10,
838
839      /// The C++ 'wchar_t' type.
840      PREDEF_TYPE_WCHAR_ID      = 11,
841
842      /// The (signed) 'short' type.
843      PREDEF_TYPE_SHORT_ID      = 12,
844
845      /// The (signed) 'int' type.
846      PREDEF_TYPE_INT_ID        = 13,
847
848      /// The (signed) 'long' type.
849      PREDEF_TYPE_LONG_ID       = 14,
850
851      /// The (signed) 'long long' type.
852      PREDEF_TYPE_LONGLONG_ID   = 15,
853
854      /// The 'float' type.
855      PREDEF_TYPE_FLOAT_ID      = 16,
856
857      /// The 'double' type.
858      PREDEF_TYPE_DOUBLE_ID     = 17,
859
860      /// The 'long double' type.
861      PREDEF_TYPE_LONGDOUBLE_ID = 18,
862
863      /// The placeholder type for overloaded function sets.
864      PREDEF_TYPE_OVERLOAD_ID   = 19,
865
866      /// The placeholder type for dependent types.
867      PREDEF_TYPE_DEPENDENT_ID  = 20,
868
869      /// The '__uint128_t' type.
870      PREDEF_TYPE_UINT128_ID    = 21,
871
872      /// The '__int128_t' type.
873      PREDEF_TYPE_INT128_ID     = 22,
874
875      /// The type of 'nullptr'.
876      PREDEF_TYPE_NULLPTR_ID    = 23,
877
878      /// The C++ 'char16_t' type.
879      PREDEF_TYPE_CHAR16_ID     = 24,
880
881      /// The C++ 'char32_t' type.
882      PREDEF_TYPE_CHAR32_ID     = 25,
883
884      /// The ObjC 'id' type.
885      PREDEF_TYPE_OBJC_ID       = 26,
886
887      /// The ObjC 'Class' type.
888      PREDEF_TYPE_OBJC_CLASS    = 27,
889
890      /// The ObjC 'SEL' type.
891      PREDEF_TYPE_OBJC_SEL      = 28,
892
893      /// The 'unknown any' placeholder type.
894      PREDEF_TYPE_UNKNOWN_ANY   = 29,
895
896      /// The placeholder type for bound member functions.
897      PREDEF_TYPE_BOUND_MEMBER  = 30,
898
899      /// The "auto" deduction type.
900      PREDEF_TYPE_AUTO_DEDUCT   = 31,
901
902      /// The "auto &&" deduction type.
903      PREDEF_TYPE_AUTO_RREF_DEDUCT = 32,
904
905      /// The OpenCL 'half' / ARM NEON __fp16 type.
906      PREDEF_TYPE_HALF_ID       = 33,
907
908      /// ARC's unbridged-cast placeholder type.
909      PREDEF_TYPE_ARC_UNBRIDGED_CAST = 34,
910
911      /// The pseudo-object placeholder type.
912      PREDEF_TYPE_PSEUDO_OBJECT = 35,
913
914      /// The placeholder type for builtin functions.
915      PREDEF_TYPE_BUILTIN_FN = 36,
916
917      /// OpenCL event type.
918      PREDEF_TYPE_EVENT_ID      = 37,
919
920      /// OpenCL clk event type.
921      PREDEF_TYPE_CLK_EVENT_ID  = 38,
922
923      /// OpenCL sampler type.
924      PREDEF_TYPE_SAMPLER_ID    = 39,
925
926      /// OpenCL queue type.
927      PREDEF_TYPE_QUEUE_ID      = 40,
928
929      /// OpenCL reserve_id type.
930      PREDEF_TYPE_RESERVE_ID_ID = 41,
931
932      /// The placeholder type for OpenMP array section.
933      PREDEF_TYPE_OMP_ARRAY_SECTION = 42,
934
935      /// The '__float128' type
936      PREDEF_TYPE_FLOAT128_ID = 43,
937
938      /// The '_Float16' type
939      PREDEF_TYPE_FLOAT16_ID = 44,
940
941      /// The C++ 'char8_t' type.
942      PREDEF_TYPE_CHAR8_ID = 45,
943
944      /// \brief The 'short _Accum' type
945      PREDEF_TYPE_SHORT_ACCUM_ID    = 46,
946
947      /// \brief The '_Accum' type
948      PREDEF_TYPE_ACCUM_ID      = 47,
949
950      /// \brief The 'long _Accum' type
951      PREDEF_TYPE_LONG_ACCUM_ID = 48,
952
953      /// \brief The 'unsigned short _Accum' type
954      PREDEF_TYPE_USHORT_ACCUM_ID   = 49,
955
956      /// \brief The 'unsigned _Accum' type
957      PREDEF_TYPE_UACCUM_ID     = 50,
958
959      /// \brief The 'unsigned long _Accum' type
960      PREDEF_TYPE_ULONG_ACCUM_ID    = 51,
961
962      /// \brief The 'short _Fract' type
963      PREDEF_TYPE_SHORT_FRACT_ID = 52,
964
965      /// \brief The '_Fract' type
966      PREDEF_TYPE_FRACT_ID = 53,
967
968      /// \brief The 'long _Fract' type
969      PREDEF_TYPE_LONG_FRACT_ID = 54,
970
971      /// \brief The 'unsigned short _Fract' type
972      PREDEF_TYPE_USHORT_FRACT_ID = 55,
973
974      /// \brief The 'unsigned _Fract' type
975      PREDEF_TYPE_UFRACT_ID = 56,
976
977      /// \brief The 'unsigned long _Fract' type
978      PREDEF_TYPE_ULONG_FRACT_ID = 57,
979
980      /// \brief The '_Sat short _Accum' type
981      PREDEF_TYPE_SAT_SHORT_ACCUM_ID = 58,
982
983      /// \brief The '_Sat _Accum' type
984      PREDEF_TYPE_SAT_ACCUM_ID = 59,
985
986      /// \brief The '_Sat long _Accum' type
987      PREDEF_TYPE_SAT_LONG_ACCUM_ID = 60,
988
989      /// \brief The '_Sat unsigned short _Accum' type
990      PREDEF_TYPE_SAT_USHORT_ACCUM_ID = 61,
991
992      /// \brief The '_Sat unsigned _Accum' type
993      PREDEF_TYPE_SAT_UACCUM_ID = 62,
994
995      /// \brief The '_Sat unsigned long _Accum' type
996      PREDEF_TYPE_SAT_ULONG_ACCUM_ID = 63,
997
998      /// \brief The '_Sat short _Fract' type
999      PREDEF_TYPE_SAT_SHORT_FRACT_ID = 64,
1000
1001      /// \brief The '_Sat _Fract' type
1002      PREDEF_TYPE_SAT_FRACT_ID = 65,
1003
1004      /// \brief The '_Sat long _Fract' type
1005      PREDEF_TYPE_SAT_LONG_FRACT_ID = 66,
1006
1007      /// \brief The '_Sat unsigned short _Fract' type
1008      PREDEF_TYPE_SAT_USHORT_FRACT_ID = 67,
1009
1010      /// \brief The '_Sat unsigned _Fract' type
1011      PREDEF_TYPE_SAT_UFRACT_ID = 68,
1012
1013      /// \brief The '_Sat unsigned long _Fract' type
1014      PREDEF_TYPE_SAT_ULONG_FRACT_ID = 69,
1015
1016      /// OpenCL image types with auto numeration
1017#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
1018      PREDEF_TYPE_##Id##_ID,
1019#include "clang/Basic/OpenCLImageTypes.def"
1020      /// \brief OpenCL extension types with auto numeration
1021#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
1022      PREDEF_TYPE_##Id##_ID,
1023#include "clang/Basic/OpenCLExtensionTypes.def"
1024      // \brief SVE types with auto numeration
1025#define SVE_TYPE(Name, Id, SingletonId) PREDEF_TYPE_##Id##_ID,
1026#include "clang/Basic/AArch64SVEACLETypes.def"
1027    };
1028
1029    /// The number of predefined type IDs that are reserved for
1030    /// the PREDEF_TYPE_* constants.
1031    ///
1032    /// Type IDs for non-predefined types will start at
1033    /// NUM_PREDEF_TYPE_IDs.
1034    const unsigned NUM_PREDEF_TYPE_IDS = 200;
1035
1036    /// Record codes for each kind of type.
1037    ///
1038    /// These constants describe the type records that can occur within a
1039    /// block identified by DECLTYPES_BLOCK_ID in the AST file. Each
1040    /// constant describes a record for a specific type class in the
1041    /// AST. Note that DeclCode values share this code space.
1042    enum TypeCode {
1043#define TYPE_BIT_CODE(CLASS_ID, CODE_ID, CODE_VALUE) \
1044      TYPE_##CODE_ID = CODE_VALUE,
1045#include "clang/Serialization/TypeBitCodes.def"
1046
1047      /// An ExtQualType record.
1048      TYPE_EXT_QUAL = 1
1049    };
1050
1051    /// The type IDs for special types constructed by semantic
1052    /// analysis.
1053    ///
1054    /// The constants in this enumeration are indices into the
1055    /// SPECIAL_TYPES record.
1056    enum SpecialTypeIDs {
1057      /// CFConstantString type
1058      SPECIAL_TYPE_CF_CONSTANT_STRING          = 0,
1059
1060      /// C FILE typedef type
1061      SPECIAL_TYPE_FILE                        = 1,
1062
1063      /// C jmp_buf typedef type
1064      SPECIAL_TYPE_JMP_BUF                     = 2,
1065
1066      /// C sigjmp_buf typedef type
1067      SPECIAL_TYPE_SIGJMP_BUF                  = 3,
1068
1069      /// Objective-C "id" redefinition type
1070      SPECIAL_TYPE_OBJC_ID_REDEFINITION        = 4,
1071
1072      /// Objective-C "Class" redefinition type
1073      SPECIAL_TYPE_OBJC_CLASS_REDEFINITION     = 5,
1074
1075      /// Objective-C "SEL" redefinition type
1076      SPECIAL_TYPE_OBJC_SEL_REDEFINITION       = 6,
1077
1078      /// C ucontext_t typedef type
1079      SPECIAL_TYPE_UCONTEXT_T                  = 7
1080    };
1081
1082    /// The number of special type IDs.
1083    const unsigned NumSpecialTypeIDs = 8;
1084
1085    /// Predefined declaration IDs.
1086    ///
1087    /// These declaration IDs correspond to predefined declarations in the AST
1088    /// context, such as the NULL declaration ID. Such declarations are never
1089    /// actually serialized, since they will be built by the AST context when
1090    /// it is created.
1091    enum PredefinedDeclIDs {
1092      /// The NULL declaration.
1093      PREDEF_DECL_NULL_ID = 0,
1094
1095      /// The translation unit.
1096      PREDEF_DECL_TRANSLATION_UNIT_ID = 1,
1097
1098      /// The Objective-C 'id' type.
1099      PREDEF_DECL_OBJC_ID_ID = 2,
1100
1101      /// The Objective-C 'SEL' type.
1102      PREDEF_DECL_OBJC_SEL_ID = 3,
1103
1104      /// The Objective-C 'Class' type.
1105      PREDEF_DECL_OBJC_CLASS_ID = 4,
1106
1107      /// The Objective-C 'Protocol' type.
1108      PREDEF_DECL_OBJC_PROTOCOL_ID = 5,
1109
1110      /// The signed 128-bit integer type.
1111      PREDEF_DECL_INT_128_ID = 6,
1112
1113      /// The unsigned 128-bit integer type.
1114      PREDEF_DECL_UNSIGNED_INT_128_ID = 7,
1115
1116      /// The internal 'instancetype' typedef.
1117      PREDEF_DECL_OBJC_INSTANCETYPE_ID = 8,
1118
1119      /// The internal '__builtin_va_list' typedef.
1120      PREDEF_DECL_BUILTIN_VA_LIST_ID = 9,
1121
1122      /// The internal '__va_list_tag' struct, if any.
1123      PREDEF_DECL_VA_LIST_TAG = 10,
1124
1125      /// The internal '__builtin_ms_va_list' typedef.
1126      PREDEF_DECL_BUILTIN_MS_VA_LIST_ID = 11,
1127
1128      /// The extern "C" context.
1129      PREDEF_DECL_EXTERN_C_CONTEXT_ID = 12,
1130
1131      /// The internal '__make_integer_seq' template.
1132      PREDEF_DECL_MAKE_INTEGER_SEQ_ID = 13,
1133
1134      /// The internal '__NSConstantString' typedef.
1135      PREDEF_DECL_CF_CONSTANT_STRING_ID = 14,
1136
1137      /// The internal '__NSConstantString' tag type.
1138      PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID = 15,
1139
1140      /// The internal '__type_pack_element' template.
1141      PREDEF_DECL_TYPE_PACK_ELEMENT_ID = 16,
1142    };
1143
1144    /// The number of declaration IDs that are predefined.
1145    ///
1146    /// For more information about predefined declarations, see the
1147    /// \c PredefinedDeclIDs type and the PREDEF_DECL_*_ID constants.
1148    const unsigned int NUM_PREDEF_DECL_IDS = 17;
1149
1150    /// Record of updates for a declaration that was modified after
1151    /// being deserialized. This can occur within DECLTYPES_BLOCK_ID.
1152    const unsigned int DECL_UPDATES = 49;
1153
1154    /// Record code for a list of local redeclarations of a declaration.
1155    /// This can occur within DECLTYPES_BLOCK_ID.
1156    const unsigned int LOCAL_REDECLARATIONS = 50;
1157
1158    /// Record codes for each kind of declaration.
1159    ///
1160    /// These constants describe the declaration records that can occur within
1161    /// a declarations block (identified by DECLTYPES_BLOCK_ID). Each
1162    /// constant describes a record for a specific declaration class
1163    /// in the AST. Note that TypeCode values share this code space.
1164    enum DeclCode {
1165      /// A TypedefDecl record.
1166      DECL_TYPEDEF = 51,
1167      /// A TypeAliasDecl record.
1168
1169      DECL_TYPEALIAS,
1170
1171      /// An EnumDecl record.
1172      DECL_ENUM,
1173
1174      /// A RecordDecl record.
1175      DECL_RECORD,
1176
1177      /// An EnumConstantDecl record.
1178      DECL_ENUM_CONSTANT,
1179
1180      /// A FunctionDecl record.
1181      DECL_FUNCTION,
1182
1183      /// A ObjCMethodDecl record.
1184      DECL_OBJC_METHOD,
1185
1186      /// A ObjCInterfaceDecl record.
1187      DECL_OBJC_INTERFACE,
1188
1189      /// A ObjCProtocolDecl record.
1190      DECL_OBJC_PROTOCOL,
1191
1192      /// A ObjCIvarDecl record.
1193      DECL_OBJC_IVAR,
1194
1195      /// A ObjCAtDefsFieldDecl record.
1196      DECL_OBJC_AT_DEFS_FIELD,
1197
1198      /// A ObjCCategoryDecl record.
1199      DECL_OBJC_CATEGORY,
1200
1201      /// A ObjCCategoryImplDecl record.
1202      DECL_OBJC_CATEGORY_IMPL,
1203
1204      /// A ObjCImplementationDecl record.
1205      DECL_OBJC_IMPLEMENTATION,
1206
1207      /// A ObjCCompatibleAliasDecl record.
1208      DECL_OBJC_COMPATIBLE_ALIAS,
1209
1210      /// A ObjCPropertyDecl record.
1211      DECL_OBJC_PROPERTY,
1212
1213      /// A ObjCPropertyImplDecl record.
1214      DECL_OBJC_PROPERTY_IMPL,
1215
1216      /// A FieldDecl record.
1217      DECL_FIELD,
1218
1219      /// A MSPropertyDecl record.
1220      DECL_MS_PROPERTY,
1221
1222      /// A VarDecl record.
1223      DECL_VAR,
1224
1225      /// An ImplicitParamDecl record.
1226      DECL_IMPLICIT_PARAM,
1227
1228      /// A ParmVarDecl record.
1229      DECL_PARM_VAR,
1230
1231      /// A DecompositionDecl record.
1232      DECL_DECOMPOSITION,
1233
1234      /// A BindingDecl record.
1235      DECL_BINDING,
1236
1237      /// A FileScopeAsmDecl record.
1238      DECL_FILE_SCOPE_ASM,
1239
1240      /// A BlockDecl record.
1241      DECL_BLOCK,
1242
1243      /// A CapturedDecl record.
1244      DECL_CAPTURED,
1245
1246      /// A record that stores the set of declarations that are
1247      /// lexically stored within a given DeclContext.
1248      ///
1249      /// The record itself is a blob that is an array of declaration IDs,
1250      /// in the order in which those declarations were added to the
1251      /// declaration context. This data is used when iterating over
1252      /// the contents of a DeclContext, e.g., via
1253      /// DeclContext::decls_begin() and DeclContext::decls_end().
1254      DECL_CONTEXT_LEXICAL,
1255
1256      /// A record that stores the set of declarations that are
1257      /// visible from a given DeclContext.
1258      ///
1259      /// The record itself stores a set of mappings, each of which
1260      /// associates a declaration name with one or more declaration
1261      /// IDs. This data is used when performing qualified name lookup
1262      /// into a DeclContext via DeclContext::lookup.
1263      DECL_CONTEXT_VISIBLE,
1264
1265      /// A LabelDecl record.
1266      DECL_LABEL,
1267
1268      /// A NamespaceDecl record.
1269      DECL_NAMESPACE,
1270
1271      /// A NamespaceAliasDecl record.
1272      DECL_NAMESPACE_ALIAS,
1273
1274      /// A UsingDecl record.
1275      DECL_USING,
1276
1277      /// A UsingPackDecl record.
1278      DECL_USING_PACK,
1279
1280      /// A UsingShadowDecl record.
1281      DECL_USING_SHADOW,
1282
1283      /// A ConstructorUsingShadowDecl record.
1284      DECL_CONSTRUCTOR_USING_SHADOW,
1285
1286      /// A UsingDirecitveDecl record.
1287      DECL_USING_DIRECTIVE,
1288
1289      /// An UnresolvedUsingValueDecl record.
1290      DECL_UNRESOLVED_USING_VALUE,
1291
1292      /// An UnresolvedUsingTypenameDecl record.
1293      DECL_UNRESOLVED_USING_TYPENAME,
1294
1295      /// A LinkageSpecDecl record.
1296      DECL_LINKAGE_SPEC,
1297
1298      /// An ExportDecl record.
1299      DECL_EXPORT,
1300
1301      /// A CXXRecordDecl record.
1302      DECL_CXX_RECORD,
1303
1304      /// A CXXDeductionGuideDecl record.
1305      DECL_CXX_DEDUCTION_GUIDE,
1306
1307      /// A CXXMethodDecl record.
1308      DECL_CXX_METHOD,
1309
1310      /// A CXXConstructorDecl record.
1311      DECL_CXX_CONSTRUCTOR,
1312
1313      /// A CXXDestructorDecl record.
1314      DECL_CXX_DESTRUCTOR,
1315
1316      /// A CXXConversionDecl record.
1317      DECL_CXX_CONVERSION,
1318
1319      /// An AccessSpecDecl record.
1320      DECL_ACCESS_SPEC,
1321
1322      /// A FriendDecl record.
1323      DECL_FRIEND,
1324
1325      /// A FriendTemplateDecl record.
1326      DECL_FRIEND_TEMPLATE,
1327
1328      /// A ClassTemplateDecl record.
1329      DECL_CLASS_TEMPLATE,
1330
1331      /// A ClassTemplateSpecializationDecl record.
1332      DECL_CLASS_TEMPLATE_SPECIALIZATION,
1333
1334      /// A ClassTemplatePartialSpecializationDecl record.
1335      DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION,
1336
1337      /// A VarTemplateDecl record.
1338      DECL_VAR_TEMPLATE,
1339
1340      /// A VarTemplateSpecializationDecl record.
1341      DECL_VAR_TEMPLATE_SPECIALIZATION,
1342
1343      /// A VarTemplatePartialSpecializationDecl record.
1344      DECL_VAR_TEMPLATE_PARTIAL_SPECIALIZATION,
1345
1346      /// A FunctionTemplateDecl record.
1347      DECL_FUNCTION_TEMPLATE,
1348
1349      /// A TemplateTypeParmDecl record.
1350      DECL_TEMPLATE_TYPE_PARM,
1351
1352      /// A NonTypeTemplateParmDecl record.
1353      DECL_NON_TYPE_TEMPLATE_PARM,
1354
1355      /// A TemplateTemplateParmDecl record.
1356      DECL_TEMPLATE_TEMPLATE_PARM,
1357
1358      /// A TypeAliasTemplateDecl record.
1359      DECL_TYPE_ALIAS_TEMPLATE,
1360
1361      /// \brief A ConceptDecl record.
1362      DECL_CONCEPT,
1363
1364      /// \brief A StaticAssertDecl record.
1365      DECL_STATIC_ASSERT,
1366
1367      /// A record containing CXXBaseSpecifiers.
1368      DECL_CXX_BASE_SPECIFIERS,
1369
1370      /// A record containing CXXCtorInitializers.
1371      DECL_CXX_CTOR_INITIALIZERS,
1372
1373      /// A IndirectFieldDecl record.
1374      DECL_INDIRECTFIELD,
1375
1376      /// A NonTypeTemplateParmDecl record that stores an expanded
1377      /// non-type template parameter pack.
1378      DECL_EXPANDED_NON_TYPE_TEMPLATE_PARM_PACK,
1379
1380      /// A TemplateTemplateParmDecl record that stores an expanded
1381      /// template template parameter pack.
1382      DECL_EXPANDED_TEMPLATE_TEMPLATE_PARM_PACK,
1383
1384      /// A ClassScopeFunctionSpecializationDecl record a class scope
1385      /// function specialization. (Microsoft extension).
1386      DECL_CLASS_SCOPE_FUNCTION_SPECIALIZATION,
1387
1388      /// An ImportDecl recording a module import.
1389      DECL_IMPORT,
1390
1391      /// An OMPThreadPrivateDecl record.
1392      DECL_OMP_THREADPRIVATE,
1393
1394      /// An OMPRequiresDecl record.
1395      DECL_OMP_REQUIRES,
1396
1397      /// An OMPAllocateDcl record.
1398      DECL_OMP_ALLOCATE,
1399
1400      /// An EmptyDecl record.
1401      DECL_EMPTY,
1402
1403      /// An LifetimeExtendedTemporaryDecl record.
1404      DECL_LIFETIME_EXTENDED_TEMPORARY,
1405
1406      /// A RequiresExprBodyDecl record.
1407      DECL_REQUIRES_EXPR_BODY,
1408
1409      /// An ObjCTypeParamDecl record.
1410      DECL_OBJC_TYPE_PARAM,
1411
1412      /// An OMPCapturedExprDecl record.
1413      DECL_OMP_CAPTUREDEXPR,
1414
1415      /// A PragmaCommentDecl record.
1416      DECL_PRAGMA_COMMENT,
1417
1418      /// A PragmaDetectMismatchDecl record.
1419      DECL_PRAGMA_DETECT_MISMATCH,
1420
1421      /// An OMPDeclareMapperDecl record.
1422      DECL_OMP_DECLARE_MAPPER,
1423
1424      /// An OMPDeclareReductionDecl record.
1425      DECL_OMP_DECLARE_REDUCTION,
1426
1427      DECL_LAST = DECL_OMP_DECLARE_REDUCTION
1428    };
1429
1430    /// Record codes for each kind of statement or expression.
1431    ///
1432    /// These constants describe the records that describe statements
1433    /// or expressions. These records  occur within type and declarations
1434    /// block, so they begin with record values of 128.  Each constant
1435    /// describes a record for a specific statement or expression class in the
1436    /// AST.
1437    enum StmtCode {
1438      /// A marker record that indicates that we are at the end
1439      /// of an expression.
1440      STMT_STOP = DECL_LAST + 1,
1441
1442      /// A NULL expression.
1443      STMT_NULL_PTR,
1444
1445      /// A reference to a previously [de]serialized Stmt record.
1446      STMT_REF_PTR,
1447
1448      /// A NullStmt record.
1449      STMT_NULL,
1450
1451      /// A CompoundStmt record.
1452      STMT_COMPOUND,
1453
1454      /// A CaseStmt record.
1455      STMT_CASE,
1456
1457      /// A DefaultStmt record.
1458      STMT_DEFAULT,
1459
1460      /// A LabelStmt record.
1461      STMT_LABEL,
1462
1463      /// An AttributedStmt record.
1464      STMT_ATTRIBUTED,
1465
1466      /// An IfStmt record.
1467      STMT_IF,
1468
1469      /// A SwitchStmt record.
1470      STMT_SWITCH,
1471
1472      /// A WhileStmt record.
1473      STMT_WHILE,
1474
1475      /// A DoStmt record.
1476      STMT_DO,
1477
1478      /// A ForStmt record.
1479      STMT_FOR,
1480
1481      /// A GotoStmt record.
1482      STMT_GOTO,
1483
1484      /// An IndirectGotoStmt record.
1485      STMT_INDIRECT_GOTO,
1486
1487      /// A ContinueStmt record.
1488      STMT_CONTINUE,
1489
1490      /// A BreakStmt record.
1491      STMT_BREAK,
1492
1493      /// A ReturnStmt record.
1494      STMT_RETURN,
1495
1496      /// A DeclStmt record.
1497      STMT_DECL,
1498
1499      /// A CapturedStmt record.
1500      STMT_CAPTURED,
1501
1502      /// A GCC-style AsmStmt record.
1503      STMT_GCCASM,
1504
1505      /// A MS-style AsmStmt record.
1506      STMT_MSASM,
1507
1508      /// A constant expression context.
1509      EXPR_CONSTANT,
1510
1511      /// A PredefinedExpr record.
1512      EXPR_PREDEFINED,
1513
1514      /// A DeclRefExpr record.
1515      EXPR_DECL_REF,
1516
1517      /// An IntegerLiteral record.
1518      EXPR_INTEGER_LITERAL,
1519
1520      /// A FloatingLiteral record.
1521      EXPR_FLOATING_LITERAL,
1522
1523      /// An ImaginaryLiteral record.
1524      EXPR_IMAGINARY_LITERAL,
1525
1526      /// A StringLiteral record.
1527      EXPR_STRING_LITERAL,
1528
1529      /// A CharacterLiteral record.
1530      EXPR_CHARACTER_LITERAL,
1531
1532      /// A ParenExpr record.
1533      EXPR_PAREN,
1534
1535      /// A ParenListExpr record.
1536      EXPR_PAREN_LIST,
1537
1538      /// A UnaryOperator record.
1539      EXPR_UNARY_OPERATOR,
1540
1541      /// An OffsetOfExpr record.
1542      EXPR_OFFSETOF,
1543
1544      /// A SizefAlignOfExpr record.
1545      EXPR_SIZEOF_ALIGN_OF,
1546
1547      /// An ArraySubscriptExpr record.
1548      EXPR_ARRAY_SUBSCRIPT,
1549
1550      /// A CallExpr record.
1551      EXPR_CALL,
1552
1553      /// A MemberExpr record.
1554      EXPR_MEMBER,
1555
1556      /// A BinaryOperator record.
1557      EXPR_BINARY_OPERATOR,
1558
1559      /// A CompoundAssignOperator record.
1560      EXPR_COMPOUND_ASSIGN_OPERATOR,
1561
1562      /// A ConditionOperator record.
1563      EXPR_CONDITIONAL_OPERATOR,
1564
1565      /// An ImplicitCastExpr record.
1566      EXPR_IMPLICIT_CAST,
1567
1568      /// A CStyleCastExpr record.
1569      EXPR_CSTYLE_CAST,
1570
1571      /// A CompoundLiteralExpr record.
1572      EXPR_COMPOUND_LITERAL,
1573
1574      /// An ExtVectorElementExpr record.
1575      EXPR_EXT_VECTOR_ELEMENT,
1576
1577      /// An InitListExpr record.
1578      EXPR_INIT_LIST,
1579
1580      /// A DesignatedInitExpr record.
1581      EXPR_DESIGNATED_INIT,
1582
1583      /// A DesignatedInitUpdateExpr record.
1584      EXPR_DESIGNATED_INIT_UPDATE,
1585
1586      /// An NoInitExpr record.
1587      EXPR_NO_INIT,
1588
1589      /// An ArrayInitLoopExpr record.
1590      EXPR_ARRAY_INIT_LOOP,
1591
1592      /// An ArrayInitIndexExpr record.
1593      EXPR_ARRAY_INIT_INDEX,
1594
1595      /// An ImplicitValueInitExpr record.
1596      EXPR_IMPLICIT_VALUE_INIT,
1597
1598      /// A VAArgExpr record.
1599      EXPR_VA_ARG,
1600
1601      /// An AddrLabelExpr record.
1602      EXPR_ADDR_LABEL,
1603
1604      /// A StmtExpr record.
1605      EXPR_STMT,
1606
1607      /// A ChooseExpr record.
1608      EXPR_CHOOSE,
1609
1610      /// A GNUNullExpr record.
1611      EXPR_GNU_NULL,
1612
1613      /// A SourceLocExpr record.
1614      EXPR_SOURCE_LOC,
1615
1616      /// A ShuffleVectorExpr record.
1617      EXPR_SHUFFLE_VECTOR,
1618
1619      /// A ConvertVectorExpr record.
1620      EXPR_CONVERT_VECTOR,
1621
1622      /// BlockExpr
1623      EXPR_BLOCK,
1624
1625      /// A GenericSelectionExpr record.
1626      EXPR_GENERIC_SELECTION,
1627
1628      /// A PseudoObjectExpr record.
1629      EXPR_PSEUDO_OBJECT,
1630
1631      /// An AtomicExpr record.
1632      EXPR_ATOMIC,
1633
1634      // Objective-C
1635
1636      /// An ObjCStringLiteral record.
1637      EXPR_OBJC_STRING_LITERAL,
1638
1639      EXPR_OBJC_BOXED_EXPRESSION,
1640      EXPR_OBJC_ARRAY_LITERAL,
1641      EXPR_OBJC_DICTIONARY_LITERAL,
1642
1643      /// An ObjCEncodeExpr record.
1644      EXPR_OBJC_ENCODE,
1645
1646      /// An ObjCSelectorExpr record.
1647      EXPR_OBJC_SELECTOR_EXPR,
1648
1649      /// An ObjCProtocolExpr record.
1650      EXPR_OBJC_PROTOCOL_EXPR,
1651
1652      /// An ObjCIvarRefExpr record.
1653      EXPR_OBJC_IVAR_REF_EXPR,
1654
1655      /// An ObjCPropertyRefExpr record.
1656      EXPR_OBJC_PROPERTY_REF_EXPR,
1657
1658      /// An ObjCSubscriptRefExpr record.
1659      EXPR_OBJC_SUBSCRIPT_REF_EXPR,
1660
1661      /// UNUSED
1662      EXPR_OBJC_KVC_REF_EXPR,
1663
1664      /// An ObjCMessageExpr record.
1665      EXPR_OBJC_MESSAGE_EXPR,
1666
1667      /// An ObjCIsa Expr record.
1668      EXPR_OBJC_ISA,
1669
1670      /// An ObjCIndirectCopyRestoreExpr record.
1671      EXPR_OBJC_INDIRECT_COPY_RESTORE,
1672
1673      /// An ObjCForCollectionStmt record.
1674      STMT_OBJC_FOR_COLLECTION,
1675
1676      /// An ObjCAtCatchStmt record.
1677      STMT_OBJC_CATCH,
1678
1679      /// An ObjCAtFinallyStmt record.
1680      STMT_OBJC_FINALLY,
1681
1682      /// An ObjCAtTryStmt record.
1683      STMT_OBJC_AT_TRY,
1684
1685      /// An ObjCAtSynchronizedStmt record.
1686      STMT_OBJC_AT_SYNCHRONIZED,
1687
1688      /// An ObjCAtThrowStmt record.
1689      STMT_OBJC_AT_THROW,
1690
1691      /// An ObjCAutoreleasePoolStmt record.
1692      STMT_OBJC_AUTORELEASE_POOL,
1693
1694      /// An ObjCBoolLiteralExpr record.
1695      EXPR_OBJC_BOOL_LITERAL,
1696
1697      /// An ObjCAvailabilityCheckExpr record.
1698      EXPR_OBJC_AVAILABILITY_CHECK,
1699
1700      // C++
1701
1702      /// A CXXCatchStmt record.
1703      STMT_CXX_CATCH,
1704
1705      /// A CXXTryStmt record.
1706      STMT_CXX_TRY,
1707      /// A CXXForRangeStmt record.
1708
1709      STMT_CXX_FOR_RANGE,
1710
1711      /// A CXXOperatorCallExpr record.
1712      EXPR_CXX_OPERATOR_CALL,
1713
1714      /// A CXXMemberCallExpr record.
1715      EXPR_CXX_MEMBER_CALL,
1716
1717      /// A CXXRewrittenBinaryOperator record.
1718      EXPR_CXX_REWRITTEN_BINARY_OPERATOR,
1719
1720      /// A CXXConstructExpr record.
1721      EXPR_CXX_CONSTRUCT,
1722
1723      /// A CXXInheritedCtorInitExpr record.
1724      EXPR_CXX_INHERITED_CTOR_INIT,
1725
1726      /// A CXXTemporaryObjectExpr record.
1727      EXPR_CXX_TEMPORARY_OBJECT,
1728
1729      /// A CXXStaticCastExpr record.
1730      EXPR_CXX_STATIC_CAST,
1731
1732      /// A CXXDynamicCastExpr record.
1733      EXPR_CXX_DYNAMIC_CAST,
1734
1735      /// A CXXReinterpretCastExpr record.
1736      EXPR_CXX_REINTERPRET_CAST,
1737
1738      /// A CXXConstCastExpr record.
1739      EXPR_CXX_CONST_CAST,
1740
1741      /// A CXXFunctionalCastExpr record.
1742      EXPR_CXX_FUNCTIONAL_CAST,
1743
1744      /// A UserDefinedLiteral record.
1745      EXPR_USER_DEFINED_LITERAL,
1746
1747      /// A CXXStdInitializerListExpr record.
1748      EXPR_CXX_STD_INITIALIZER_LIST,
1749
1750      /// A CXXBoolLiteralExpr record.
1751      EXPR_CXX_BOOL_LITERAL,
1752
1753      EXPR_CXX_NULL_PTR_LITERAL,  // CXXNullPtrLiteralExpr
1754      EXPR_CXX_TYPEID_EXPR,       // CXXTypeidExpr (of expr).
1755      EXPR_CXX_TYPEID_TYPE,       // CXXTypeidExpr (of type).
1756      EXPR_CXX_THIS,              // CXXThisExpr
1757      EXPR_CXX_THROW,             // CXXThrowExpr
1758      EXPR_CXX_DEFAULT_ARG,       // CXXDefaultArgExpr
1759      EXPR_CXX_DEFAULT_INIT,      // CXXDefaultInitExpr
1760      EXPR_CXX_BIND_TEMPORARY,    // CXXBindTemporaryExpr
1761
1762      EXPR_CXX_SCALAR_VALUE_INIT, // CXXScalarValueInitExpr
1763      EXPR_CXX_NEW,               // CXXNewExpr
1764      EXPR_CXX_DELETE,            // CXXDeleteExpr
1765      EXPR_CXX_PSEUDO_DESTRUCTOR, // CXXPseudoDestructorExpr
1766
1767      EXPR_EXPR_WITH_CLEANUPS,    // ExprWithCleanups
1768
1769      EXPR_CXX_DEPENDENT_SCOPE_MEMBER,   // CXXDependentScopeMemberExpr
1770      EXPR_CXX_DEPENDENT_SCOPE_DECL_REF, // DependentScopeDeclRefExpr
1771      EXPR_CXX_UNRESOLVED_CONSTRUCT,     // CXXUnresolvedConstructExpr
1772      EXPR_CXX_UNRESOLVED_MEMBER,        // UnresolvedMemberExpr
1773      EXPR_CXX_UNRESOLVED_LOOKUP,        // UnresolvedLookupExpr
1774
1775      EXPR_CXX_EXPRESSION_TRAIT,  // ExpressionTraitExpr
1776      EXPR_CXX_NOEXCEPT,          // CXXNoexceptExpr
1777
1778      EXPR_OPAQUE_VALUE,          // OpaqueValueExpr
1779      EXPR_BINARY_CONDITIONAL_OPERATOR,  // BinaryConditionalOperator
1780      EXPR_TYPE_TRAIT,            // TypeTraitExpr
1781      EXPR_ARRAY_TYPE_TRAIT,      // ArrayTypeTraitIntExpr
1782
1783      EXPR_PACK_EXPANSION,        // PackExpansionExpr
1784      EXPR_SIZEOF_PACK,           // SizeOfPackExpr
1785      EXPR_SUBST_NON_TYPE_TEMPLATE_PARM, // SubstNonTypeTemplateParmExpr
1786      EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK,// SubstNonTypeTemplateParmPackExpr
1787      EXPR_FUNCTION_PARM_PACK,    // FunctionParmPackExpr
1788      EXPR_MATERIALIZE_TEMPORARY, // MaterializeTemporaryExpr
1789      EXPR_CXX_FOLD,              // CXXFoldExpr
1790      EXPR_CONCEPT_SPECIALIZATION,// ConceptSpecializationExpr
1791      EXPR_REQUIRES,              // RequiresExpr
1792
1793      // CUDA
1794      EXPR_CUDA_KERNEL_CALL,       // CUDAKernelCallExpr
1795
1796      // OpenCL
1797      EXPR_ASTYPE,                 // AsTypeExpr
1798
1799      // Microsoft
1800      EXPR_CXX_PROPERTY_REF_EXPR, // MSPropertyRefExpr
1801      EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR, // MSPropertySubscriptExpr
1802      EXPR_CXX_UUIDOF_EXPR,       // CXXUuidofExpr (of expr).
1803      EXPR_CXX_UUIDOF_TYPE,       // CXXUuidofExpr (of type).
1804      STMT_SEH_LEAVE,             // SEHLeaveStmt
1805      STMT_SEH_EXCEPT,            // SEHExceptStmt
1806      STMT_SEH_FINALLY,           // SEHFinallyStmt
1807      STMT_SEH_TRY,               // SEHTryStmt
1808
1809      // OpenMP directives
1810      STMT_OMP_PARALLEL_DIRECTIVE,
1811      STMT_OMP_SIMD_DIRECTIVE,
1812      STMT_OMP_FOR_DIRECTIVE,
1813      STMT_OMP_FOR_SIMD_DIRECTIVE,
1814      STMT_OMP_SECTIONS_DIRECTIVE,
1815      STMT_OMP_SECTION_DIRECTIVE,
1816      STMT_OMP_SINGLE_DIRECTIVE,
1817      STMT_OMP_MASTER_DIRECTIVE,
1818      STMT_OMP_CRITICAL_DIRECTIVE,
1819      STMT_OMP_PARALLEL_FOR_DIRECTIVE,
1820      STMT_OMP_PARALLEL_FOR_SIMD_DIRECTIVE,
1821      STMT_OMP_PARALLEL_MASTER_DIRECTIVE,
1822      STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE,
1823      STMT_OMP_TASK_DIRECTIVE,
1824      STMT_OMP_TASKYIELD_DIRECTIVE,
1825      STMT_OMP_BARRIER_DIRECTIVE,
1826      STMT_OMP_TASKWAIT_DIRECTIVE,
1827      STMT_OMP_FLUSH_DIRECTIVE,
1828      STMT_OMP_ORDERED_DIRECTIVE,
1829      STMT_OMP_ATOMIC_DIRECTIVE,
1830      STMT_OMP_TARGET_DIRECTIVE,
1831      STMT_OMP_TARGET_DATA_DIRECTIVE,
1832      STMT_OMP_TARGET_ENTER_DATA_DIRECTIVE,
1833      STMT_OMP_TARGET_EXIT_DATA_DIRECTIVE,
1834      STMT_OMP_TARGET_PARALLEL_DIRECTIVE,
1835      STMT_OMP_TARGET_PARALLEL_FOR_DIRECTIVE,
1836      STMT_OMP_TEAMS_DIRECTIVE,
1837      STMT_OMP_TASKGROUP_DIRECTIVE,
1838      STMT_OMP_CANCELLATION_POINT_DIRECTIVE,
1839      STMT_OMP_CANCEL_DIRECTIVE,
1840      STMT_OMP_TASKLOOP_DIRECTIVE,
1841      STMT_OMP_TASKLOOP_SIMD_DIRECTIVE,
1842      STMT_OMP_MASTER_TASKLOOP_DIRECTIVE,
1843      STMT_OMP_MASTER_TASKLOOP_SIMD_DIRECTIVE,
1844      STMT_OMP_PARALLEL_MASTER_TASKLOOP_DIRECTIVE,
1845      STMT_OMP_PARALLEL_MASTER_TASKLOOP_SIMD_DIRECTIVE,
1846      STMT_OMP_DISTRIBUTE_DIRECTIVE,
1847      STMT_OMP_TARGET_UPDATE_DIRECTIVE,
1848      STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE,
1849      STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE,
1850      STMT_OMP_DISTRIBUTE_SIMD_DIRECTIVE,
1851      STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE,
1852      STMT_OMP_TARGET_SIMD_DIRECTIVE,
1853      STMT_OMP_TEAMS_DISTRIBUTE_DIRECTIVE,
1854      STMT_OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE,
1855      STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE,
1856      STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE,
1857      STMT_OMP_TARGET_TEAMS_DIRECTIVE,
1858      STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE,
1859      STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE,
1860      STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE,
1861      STMT_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE,
1862      EXPR_OMP_ARRAY_SECTION,
1863
1864      // ARC
1865      EXPR_OBJC_BRIDGED_CAST,     // ObjCBridgedCastExpr
1866
1867      STMT_MS_DEPENDENT_EXISTS,   // MSDependentExistsStmt
1868      EXPR_LAMBDA,                // LambdaExpr
1869      STMT_COROUTINE_BODY,
1870      STMT_CORETURN,
1871      EXPR_COAWAIT,
1872      EXPR_COYIELD,
1873      EXPR_DEPENDENT_COAWAIT,
1874    };
1875
1876    /// The kinds of designators that can occur in a
1877    /// DesignatedInitExpr.
1878    enum DesignatorTypes {
1879      /// Field designator where only the field name is known.
1880      DESIG_FIELD_NAME  = 0,
1881
1882      /// Field designator where the field has been resolved to
1883      /// a declaration.
1884      DESIG_FIELD_DECL  = 1,
1885
1886      /// Array designator.
1887      DESIG_ARRAY       = 2,
1888
1889      /// GNU array range designator.
1890      DESIG_ARRAY_RANGE = 3
1891    };
1892
1893    /// The different kinds of data that can occur in a
1894    /// CtorInitializer.
1895    enum CtorInitializerType {
1896      CTOR_INITIALIZER_BASE,
1897      CTOR_INITIALIZER_DELEGATING,
1898      CTOR_INITIALIZER_MEMBER,
1899      CTOR_INITIALIZER_INDIRECT_MEMBER
1900    };
1901
1902    /// Describes the redeclarations of a declaration.
1903    struct LocalRedeclarationsInfo {
1904      // The ID of the first declaration
1905      DeclID FirstID;
1906
1907      // Offset into the array of redeclaration chains.
1908      unsigned Offset;
1909
1910      friend bool operator<(const LocalRedeclarationsInfo &X,
1911                            const LocalRedeclarationsInfo &Y) {
1912        return X.FirstID < Y.FirstID;
1913      }
1914
1915      friend bool operator>(const LocalRedeclarationsInfo &X,
1916                            const LocalRedeclarationsInfo &Y) {
1917        return X.FirstID > Y.FirstID;
1918      }
1919
1920      friend bool operator<=(const LocalRedeclarationsInfo &X,
1921                             const LocalRedeclarationsInfo &Y) {
1922        return X.FirstID <= Y.FirstID;
1923      }
1924
1925      friend bool operator>=(const LocalRedeclarationsInfo &X,
1926                             const LocalRedeclarationsInfo &Y) {
1927        return X.FirstID >= Y.FirstID;
1928      }
1929    };
1930
1931    /// Describes the categories of an Objective-C class.
1932    struct ObjCCategoriesInfo {
1933      // The ID of the definition
1934      DeclID DefinitionID;
1935
1936      // Offset into the array of category lists.
1937      unsigned Offset;
1938
1939      friend bool operator<(const ObjCCategoriesInfo &X,
1940                            const ObjCCategoriesInfo &Y) {
1941        return X.DefinitionID < Y.DefinitionID;
1942      }
1943
1944      friend bool operator>(const ObjCCategoriesInfo &X,
1945                            const ObjCCategoriesInfo &Y) {
1946        return X.DefinitionID > Y.DefinitionID;
1947      }
1948
1949      friend bool operator<=(const ObjCCategoriesInfo &X,
1950                             const ObjCCategoriesInfo &Y) {
1951        return X.DefinitionID <= Y.DefinitionID;
1952      }
1953
1954      friend bool operator>=(const ObjCCategoriesInfo &X,
1955                             const ObjCCategoriesInfo &Y) {
1956        return X.DefinitionID >= Y.DefinitionID;
1957      }
1958    };
1959
1960    /// A key used when looking up entities by \ref DeclarationName.
1961    ///
1962    /// Different \ref DeclarationNames are mapped to different keys, but the
1963    /// same key can occasionally represent multiple names (for names that
1964    /// contain types, in particular).
1965    class DeclarationNameKey {
1966      using NameKind = unsigned;
1967
1968      NameKind Kind = 0;
1969      uint64_t Data = 0;
1970
1971    public:
1972      DeclarationNameKey() = default;
1973      DeclarationNameKey(DeclarationName Name);
1974      DeclarationNameKey(NameKind Kind, uint64_t Data)
1975          : Kind(Kind), Data(Data) {}
1976
1977      NameKind getKind() const { return Kind; }
1978
1979      IdentifierInfo *getIdentifier() const {
1980        assert(Kind == DeclarationName::Identifier ||
1981               Kind == DeclarationName::CXXLiteralOperatorName ||
1982               Kind == DeclarationName::CXXDeductionGuideName);
1983        return (IdentifierInfo *)Data;
1984      }
1985
1986      Selector getSelector() const {
1987        assert(Kind == DeclarationName::ObjCZeroArgSelector ||
1988               Kind == DeclarationName::ObjCOneArgSelector ||
1989               Kind == DeclarationName::ObjCMultiArgSelector);
1990        return Selector(Data);
1991      }
1992
1993      OverloadedOperatorKind getOperatorKind() const {
1994        assert(Kind == DeclarationName::CXXOperatorName);
1995        return (OverloadedOperatorKind)Data;
1996      }
1997
1998      /// Compute a fingerprint of this key for use in on-disk hash table.
1999      unsigned getHash() const;
2000
2001      friend bool operator==(const DeclarationNameKey &A,
2002                             const DeclarationNameKey &B) {
2003        return A.Kind == B.Kind && A.Data == B.Data;
2004      }
2005    };
2006
2007    /// @}
2008
2009} // namespace serialization
2010} // namespace clang
2011
2012namespace llvm {
2013
2014  template <> struct DenseMapInfo<clang::serialization::DeclarationNameKey> {
2015    static clang::serialization::DeclarationNameKey getEmptyKey() {
2016      return clang::serialization::DeclarationNameKey(-1, 1);
2017    }
2018
2019    static clang::serialization::DeclarationNameKey getTombstoneKey() {
2020      return clang::serialization::DeclarationNameKey(-1, 2);
2021    }
2022
2023    static unsigned
2024    getHashValue(const clang::serialization::DeclarationNameKey &Key) {
2025      return Key.getHash();
2026    }
2027
2028    static bool isEqual(const clang::serialization::DeclarationNameKey &L,
2029                        const clang::serialization::DeclarationNameKey &R) {
2030      return L == R;
2031    }
2032  };
2033
2034} // namespace llvm
2035
2036#endif // LLVM_CLANG_SERIALIZATION_ASTBITCODES_H
2037