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