1 //===- ASTBitCodes.h - Enum values for the PCH bitcode format ---*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // This header defines Bitcode enum values for Clang serialized AST files.
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
15 //===----------------------------------------------------------------------===//
17 #ifndef LLVM_CLANG_SERIALIZATION_ASTBITCODES_H
18 #define LLVM_CLANG_SERIALIZATION_ASTBITCODES_H
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"
31 namespace serialization {
33 /// AST file major version number supported by this version of
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.
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;
46 /// AST file minor version number supported by this version of
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;
56 /// An ID number that refers to an identifier in an AST file.
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;
62 /// An ID number that refers to a declaration in an AST file.
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;
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;
75 /// An ID number that refers to a type in an AST file.
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;
87 /// A type index; the type ID with the qualifier bits removed.
93 explicit TypeIdx(uint32_t index) : Idx(index) {}
95 uint32_t getIndex() const { return Idx; }
97 TypeID asTypeID(unsigned FastQuals) const {
98 if (Idx == uint32_t(-1))
101 return (Idx << Qualifiers::FastWidth) | FastQuals;
104 static TypeIdx fromTypeID(TypeID ID) {
105 if (ID == TypeID(-1))
108 return TypeIdx(ID >> Qualifiers::FastWidth);
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; }
117 static QualType getEmptyKey() {
118 return QualType::getFromOpaquePtr((void*) 1);
121 static QualType getTombstoneKey() {
122 return QualType::getFromOpaquePtr((void*) 2);
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);
133 /// An ID number that refers to an identifier in an AST file.
134 using IdentID = uint32_t;
136 /// The number of predefined identifier IDs.
137 const unsigned int NUM_PREDEF_IDENT_IDS = 1;
139 /// An ID number that refers to a macro in an AST file.
140 using MacroID = uint32_t;
142 /// A global ID number that refers to a macro in an AST file.
143 using GlobalMacroID = uint32_t;
145 /// A local to a module ID number that refers to a macro in an
147 using LocalMacroID = uint32_t;
149 /// The number of predefined macro IDs.
150 const unsigned int NUM_PREDEF_MACRO_IDS = 1;
152 /// An ID number that refers to an ObjC selector in an AST file.
153 using SelectorID = uint32_t;
155 /// The number of predefined selector IDs.
156 const unsigned int NUM_PREDEF_SELECTOR_IDS = 1;
158 /// An ID number that refers to a set of CXXBaseSpecifiers in an
160 using CXXBaseSpecifiersID = uint32_t;
162 /// An ID number that refers to a list of CXXCtorInitializers in an
164 using CXXCtorInitializersID = uint32_t;
166 /// An ID number that refers to an entity in the detailed
167 /// preprocessing record.
168 using PreprocessedEntityID = uint32_t;
170 /// An ID number that refers to a submodule in a module file.
171 using SubmoduleID = uint32_t;
173 /// The number of predefined submodule IDs.
174 const unsigned int NUM_PREDEF_SUBMODULE_IDS = 1;
176 /// Source range/offset of a preprocessed entity.
177 struct PPEntityOffset {
178 /// Raw source location of beginning of range.
181 /// Raw source location of end of range.
184 /// Offset in the AST file.
187 PPEntityOffset(SourceRange R, uint32_t BitOffset)
188 : Begin(R.getBegin().getRawEncoding()),
189 End(R.getEnd().getRawEncoding()), BitOffset(BitOffset) {}
191 SourceLocation getBegin() const {
192 return SourceLocation::getFromRawEncoding(Begin);
195 SourceLocation getEnd() const {
196 return SourceLocation::getFromRawEncoding(End);
200 /// Source range of a skipped preprocessor region
201 struct PPSkippedRange {
202 /// Raw source location of beginning of range.
204 /// Raw source location of end of range.
207 PPSkippedRange(SourceRange R)
208 : Begin(R.getBegin().getRawEncoding()),
209 End(R.getEnd().getRawEncoding()) { }
211 SourceLocation getBegin() const {
212 return SourceLocation::getFromRawEncoding(Begin);
214 SourceLocation getEnd() const {
215 return SourceLocation::getFromRawEncoding(End);
219 /// Source range/offset of a preprocessed entity.
221 /// Raw source location.
224 /// Offset in the AST file.
225 uint32_t BitOffset = 0;
227 DeclOffset() = default;
228 DeclOffset(SourceLocation Loc, uint32_t BitOffset)
229 : Loc(Loc.getRawEncoding()), BitOffset(BitOffset) {}
231 void setLocation(SourceLocation L) {
232 Loc = L.getRawEncoding();
235 SourceLocation getLocation() const {
236 return SourceLocation::getFromRawEncoding(Loc);
240 /// The number of predefined preprocessed entity IDs.
241 const unsigned int NUM_PREDEF_PP_ENTITY_IDS = 1;
243 /// Describes the various kinds of blocks that occur within
246 /// The AST block, which acts as a container around the
248 AST_BLOCK_ID = llvm::bitc::FIRST_APPLICATION_BLOCKID,
250 /// The block containing information about the source
252 SOURCE_MANAGER_BLOCK_ID,
254 /// The block containing information about the
256 PREPROCESSOR_BLOCK_ID,
258 /// The block containing the definitions of all of the
259 /// types and decls used within the AST file.
262 /// The block containing the detailed preprocessing record.
263 PREPROCESSOR_DETAIL_BLOCK_ID,
265 /// The block containing the submodule structure.
268 /// The block containing comments.
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.
276 /// The block of input files, which were used as inputs
277 /// to create this AST file.
279 /// This block is part of the control block.
280 INPUT_FILES_BLOCK_ID,
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.
286 /// This block is part of the control block.
289 /// A block containing a module file extension.
292 /// A block with unhashed content.
294 /// These records should not change the \a ASTFileSignature. See \a
295 /// UnhashedControlBlockRecordTypes for the list of records.
296 UNHASHED_CONTROL_BLOCK_ID,
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.
305 /// Record code for the list of other AST files imported by
309 /// Record code for the original file that was used to
310 /// generate the AST file, including both its file ID and its
314 /// The directory that the PCH was originally created in.
317 /// Record code for file ID of the file or buffer that was used to
318 /// generate the AST file.
321 /// Offsets into the input-files block where input files
325 /// Record code for the module name.
328 /// Record code for the module map file that was used to build this
332 /// Record code for the module build directory.
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.
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,
347 /// Record code for the target options table.
350 /// Record code for the filesystem options table.
353 /// Record code for the headers search options table.
354 HEADER_SEARCH_OPTIONS,
356 /// Record code for the preprocessor options table.
357 PREPROCESSOR_OPTIONS,
360 /// Record codes for the unhashed control block.
361 enum UnhashedControlBlockRecordTypes {
362 /// Record code for the signature that identifiers this AST file.
365 /// Record code for the diagnostic options table.
368 /// Record code for \#pragma diagnostic mappings.
369 DIAG_PRAGMA_MAPPINGS,
372 /// Record code for extension blocks.
373 enum ExtensionBlockRecordTypes {
374 /// Metadata describing this particular extension.
375 EXTENSION_METADATA = 1,
377 /// The first record ID allocated to the extensions themselves.
378 FIRST_EXTENSION_RECORD_ID = 4
381 /// Record types that occur within the input-files block
382 /// inside the control block.
383 enum InputFileRecordTypes {
387 /// The input file content hash
391 /// Record types that occur within the AST block itself.
392 enum ASTRecordTypes {
393 /// Record code for the offsets of each type.
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.
407 /// Record code for the offsets of each decl.
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.
419 /// Record code for the table of offsets of each
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,
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,
432 /// Record code for the identifier table.
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
444 IDENTIFIER_TABLE = 5,
446 /// Record code for the array of eagerly deserialized decls.
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,
456 /// Record code for the set of non-builtin, special
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.
465 /// Record code for the extra statistics we gather while
466 /// generating an AST file.
469 /// Record code for the array of tentative definitions.
470 TENTATIVE_DEFINITIONS = 9,
472 // ID 10 used to be for a list of extern "C" declarations.
474 /// Record code for the table of offsets into the
475 /// Objective-C method pool.
476 SELECTOR_OFFSETS = 11,
478 /// Record code for the Objective-C method pool,
481 /// The value of the next __COUNTER__ to dispense.
482 /// [PP_COUNTER_VALUE, Val]
483 PP_COUNTER_VALUE = 13,
485 /// Record code for the table of offsets into the block
486 /// of source-location information.
487 SOURCE_LOCATION_OFFSETS = 14,
489 /// Record code for the set of source location entries
490 /// that need to be preloaded by the AST reader.
492 /// This set contains the source location entry for the
493 /// predefines buffer and for any file entries that need to be
495 SOURCE_LOCATION_PRELOADS = 15,
497 /// Record code for the set of ext_vector type names.
498 EXT_VECTOR_DECLS = 16,
500 /// Record code for the array of unused file scoped decls.
501 UNUSED_FILESCOPED_DECLS = 17,
503 /// Record code for the table of offsets to entries in the
504 /// preprocessing record.
505 PPD_ENTITIES_OFFSETS = 18,
507 /// Record code for the array of VTable uses.
510 // ID 20 used to be for a list of dynamic classes.
512 /// Record code for referenced selector pool.
513 REFERENCED_SELECTOR_POOL = 21,
515 /// Record code for an update to the TU's lexically contained
517 TU_UPDATE_LEXICAL = 22,
519 // ID 23 used to be for a list of local redeclarations.
521 /// Record code for declarations that Sema keeps references of.
524 /// Record code for weak undeclared identifiers.
525 WEAK_UNDECLARED_IDENTIFIERS = 25,
527 /// Record code for pending implicit instantiations.
528 PENDING_IMPLICIT_INSTANTIATIONS = 26,
530 // ID 27 used to be for a list of replacement decls.
532 /// Record code for an update to a decl context's lookup table.
534 /// In practice, this should only be used for the TU and namespaces.
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,
541 // ID 30 used to be a decl update record. These are now in the DECLTYPES
544 // ID 31 used to be a list of offsets to DECL_CXX_BASE_SPECIFIERS records.
546 // ID 32 used to be the code for \#pragma diagnostic mappings.
548 /// Record code for special CUDA declarations.
549 CUDA_SPECIAL_DECL_REFS = 33,
551 /// Record code for header search information.
552 HEADER_SEARCH_TABLE = 34,
554 /// Record code for floating point \#pragma options.
555 FP_PRAGMA_OPTIONS = 35,
557 /// Record code for enabled OpenCL extensions.
558 OPENCL_EXTENSIONS = 36,
560 /// The list of delegating constructor declarations.
561 DELEGATING_CTORS = 37,
563 /// Record code for the set of known namespaces, which are used
564 /// for typo correction.
565 KNOWN_NAMESPACES = 38,
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,
573 /// Record code for the source manager line table information,
574 /// which stores information about \#line directives.
575 SOURCE_MANAGER_LINE_TABLE = 40,
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,
581 /// Record code for a file sorted array of DeclIDs in a module.
582 FILE_SORTED_DECLS = 42,
584 /// Record code for an array of all of the (sub)modules that were
585 /// imported by the AST file.
586 IMPORTED_MODULES = 43,
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.
591 /// Record code for the array of Objective-C categories (including
594 /// This array can only be interpreted properly using the Objective-C
596 OBJC_CATEGORIES = 46,
598 /// Record code for the table of offsets of each macro ID.
600 /// The offset table contains offsets into the blob stored in
601 /// the preprocessor block. Each offset points to the corresponding
602 /// macro definition.
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,
610 /// Record code for undefined but used functions and variables that
611 /// need a definition in this TU.
612 UNDEFINED_BUT_USED = 49,
614 /// Record code for late parsed template functions.
615 LATE_PARSED_TEMPLATE = 50,
617 /// Record code for \#pragma optimize options.
618 OPTIMIZE_PRAGMA_OPTIONS = 51,
620 /// Record code for potentially unused local typedef names.
621 UNUSED_LOCAL_TYPEDEF_NAME_CANDIDATES = 52,
623 // ID 53 used to be a table of constructor initializer records.
625 /// Delete expressions that will be analyzed later.
626 DELETE_EXPRS_TO_ANALYZE = 54,
628 /// Record code for \#pragma ms_struct options.
629 MSSTRUCT_PRAGMA_OPTIONS = 55,
631 /// Record code for \#pragma ms_struct options.
632 POINTERS_TO_MEMBERS_PRAGMA_OPTIONS = 56,
634 /// Number of unmatched #pragma clang cuda_force_host_device begin
635 /// directives we've seen.
636 CUDA_PRAGMA_FORCE_HOST_DEVICE_DEPTH = 57,
638 /// Record code for types associated with OpenCL extensions.
639 OPENCL_EXTENSION_TYPES = 58,
641 /// Record code for declarations associated with OpenCL extensions.
642 OPENCL_EXTENSION_DECLS = 59,
644 MODULAR_CODEGEN_DECLS = 60,
646 /// Record code for \#pragma pack options.
647 PACK_PRAGMA_OPTIONS = 61,
649 /// The stack of open #ifs/#ifdefs recorded in a preamble.
650 PP_CONDITIONAL_STACK = 62,
652 /// A table of skipped ranges within the preprocessing record.
653 PPD_SKIPPED_RANGES = 63
656 /// Record types used within a source manager block.
657 enum SourceManagerRecordTypes {
658 /// Describes a source location entry (SLocEntry) for a
660 SM_SLOC_FILE_ENTRY = 1,
662 /// Describes a source location entry (SLocEntry) for a
664 SM_SLOC_BUFFER_ENTRY = 2,
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,
672 /// Describes a zlib-compressed blob that contains the data for
674 SM_SLOC_BUFFER_BLOB_COMPRESSED = 4,
676 /// Describes a source location entry (SLocEntry) for a
678 SM_SLOC_EXPANSION_ENTRY = 5
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.
686 /// An object-like macro definition.
687 /// [PP_MACRO_OBJECT_LIKE, IdentInfoID, SLoc, IsUsed]
688 PP_MACRO_OBJECT_LIKE = 1,
690 /// A function-like macro definition.
691 /// [PP_MACRO_FUNCTION_LIKE, \<ObjectLikeStuff>, IsC99Varargs,
692 /// IsGNUVarars, NumArgs, ArgIdentInfoID* ]
693 PP_MACRO_FUNCTION_LIKE = 2,
695 /// Describes one token.
696 /// [PP_TOKEN, SLoc, Length, IdentInfoID, Kind, Flags]
699 /// The macro directives history for a particular identifier.
700 PP_MACRO_DIRECTIVE_HISTORY = 4,
702 /// A macro directive exported by a module.
703 /// [PP_MODULE_MACRO, SubmoduleID, MacroID, (Overridden SubmoduleID)*]
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,
712 /// Describes a macro definition within the preprocessing record.
713 PPD_MACRO_DEFINITION = 1,
715 /// Describes an inclusion directive within the preprocessing
717 PPD_INCLUSION_DIRECTIVE = 2
720 /// Record types used within a submodule description block.
721 enum SubmoduleRecordTypes {
722 /// Metadata for submodules as a whole.
723 SUBMODULE_METADATA = 0,
725 /// Defines the major attributes of a submodule, including its
727 SUBMODULE_DEFINITION = 1,
729 /// Specifies the umbrella header used to create this module,
731 SUBMODULE_UMBRELLA_HEADER = 2,
733 /// Specifies a header that falls into this (sub)module.
734 SUBMODULE_HEADER = 3,
736 /// Specifies a top-level header that falls into this (sub)module.
737 SUBMODULE_TOPHEADER = 4,
739 /// Specifies an umbrella directory.
740 SUBMODULE_UMBRELLA_DIR = 5,
742 /// Specifies the submodules that are imported by this
744 SUBMODULE_IMPORTS = 6,
746 /// Specifies the submodules that are re-exported from this
748 SUBMODULE_EXPORTS = 7,
750 /// Specifies a required feature.
751 SUBMODULE_REQUIRES = 8,
753 /// Specifies a header that has been explicitly excluded
754 /// from this submodule.
755 SUBMODULE_EXCLUDED_HEADER = 9,
757 /// Specifies a library or framework to link against.
758 SUBMODULE_LINK_LIBRARY = 10,
760 /// Specifies a configuration macro for this module.
761 SUBMODULE_CONFIG_MACRO = 11,
763 /// Specifies a conflict with another module.
764 SUBMODULE_CONFLICT = 12,
766 /// Specifies a header that is private to this submodule.
767 SUBMODULE_PRIVATE_HEADER = 13,
769 /// Specifies a header that is part of the module but must be
770 /// textually included.
771 SUBMODULE_TEXTUAL_HEADER = 14,
773 /// Specifies a header that is private to this submodule but
774 /// must be textually included.
775 SUBMODULE_PRIVATE_TEXTUAL_HEADER = 15,
777 /// Specifies some declarations with initializers that must be
778 /// emitted to initialize the module.
779 SUBMODULE_INITIALIZERS = 16,
781 /// Specifies the name of the module that will eventually
782 /// re-export the entities in this module.
783 SUBMODULE_EXPORT_AS = 17,
786 /// Record types used within a comments block.
787 enum CommentRecordTypes {
788 COMMENTS_RAW_COMMENT = 0
791 /// \defgroup ASTAST AST file AST constants
793 /// The constants in this group describe various components of the
794 /// abstract syntax tree within an AST file.
798 /// Predefined type IDs.
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 {
807 PREDEF_TYPE_NULL_ID = 0,
810 PREDEF_TYPE_VOID_ID = 1,
812 /// The 'bool' or '_Bool' type.
813 PREDEF_TYPE_BOOL_ID = 2,
815 /// The 'char' type, when it is unsigned.
816 PREDEF_TYPE_CHAR_U_ID = 3,
818 /// The 'unsigned char' type.
819 PREDEF_TYPE_UCHAR_ID = 4,
821 /// The 'unsigned short' type.
822 PREDEF_TYPE_USHORT_ID = 5,
824 /// The 'unsigned int' type.
825 PREDEF_TYPE_UINT_ID = 6,
827 /// The 'unsigned long' type.
828 PREDEF_TYPE_ULONG_ID = 7,
830 /// The 'unsigned long long' type.
831 PREDEF_TYPE_ULONGLONG_ID = 8,
833 /// The 'char' type, when it is signed.
834 PREDEF_TYPE_CHAR_S_ID = 9,
836 /// The 'signed char' type.
837 PREDEF_TYPE_SCHAR_ID = 10,
839 /// The C++ 'wchar_t' type.
840 PREDEF_TYPE_WCHAR_ID = 11,
842 /// The (signed) 'short' type.
843 PREDEF_TYPE_SHORT_ID = 12,
845 /// The (signed) 'int' type.
846 PREDEF_TYPE_INT_ID = 13,
848 /// The (signed) 'long' type.
849 PREDEF_TYPE_LONG_ID = 14,
851 /// The (signed) 'long long' type.
852 PREDEF_TYPE_LONGLONG_ID = 15,
854 /// The 'float' type.
855 PREDEF_TYPE_FLOAT_ID = 16,
857 /// The 'double' type.
858 PREDEF_TYPE_DOUBLE_ID = 17,
860 /// The 'long double' type.
861 PREDEF_TYPE_LONGDOUBLE_ID = 18,
863 /// The placeholder type for overloaded function sets.
864 PREDEF_TYPE_OVERLOAD_ID = 19,
866 /// The placeholder type for dependent types.
867 PREDEF_TYPE_DEPENDENT_ID = 20,
869 /// The '__uint128_t' type.
870 PREDEF_TYPE_UINT128_ID = 21,
872 /// The '__int128_t' type.
873 PREDEF_TYPE_INT128_ID = 22,
875 /// The type of 'nullptr'.
876 PREDEF_TYPE_NULLPTR_ID = 23,
878 /// The C++ 'char16_t' type.
879 PREDEF_TYPE_CHAR16_ID = 24,
881 /// The C++ 'char32_t' type.
882 PREDEF_TYPE_CHAR32_ID = 25,
884 /// The ObjC 'id' type.
885 PREDEF_TYPE_OBJC_ID = 26,
887 /// The ObjC 'Class' type.
888 PREDEF_TYPE_OBJC_CLASS = 27,
890 /// The ObjC 'SEL' type.
891 PREDEF_TYPE_OBJC_SEL = 28,
893 /// The 'unknown any' placeholder type.
894 PREDEF_TYPE_UNKNOWN_ANY = 29,
896 /// The placeholder type for bound member functions.
897 PREDEF_TYPE_BOUND_MEMBER = 30,
899 /// The "auto" deduction type.
900 PREDEF_TYPE_AUTO_DEDUCT = 31,
902 /// The "auto &&" deduction type.
903 PREDEF_TYPE_AUTO_RREF_DEDUCT = 32,
905 /// The OpenCL 'half' / ARM NEON __fp16 type.
906 PREDEF_TYPE_HALF_ID = 33,
908 /// ARC's unbridged-cast placeholder type.
909 PREDEF_TYPE_ARC_UNBRIDGED_CAST = 34,
911 /// The pseudo-object placeholder type.
912 PREDEF_TYPE_PSEUDO_OBJECT = 35,
914 /// The placeholder type for builtin functions.
915 PREDEF_TYPE_BUILTIN_FN = 36,
917 /// OpenCL event type.
918 PREDEF_TYPE_EVENT_ID = 37,
920 /// OpenCL clk event type.
921 PREDEF_TYPE_CLK_EVENT_ID = 38,
923 /// OpenCL sampler type.
924 PREDEF_TYPE_SAMPLER_ID = 39,
926 /// OpenCL queue type.
927 PREDEF_TYPE_QUEUE_ID = 40,
929 /// OpenCL reserve_id type.
930 PREDEF_TYPE_RESERVE_ID_ID = 41,
932 /// The placeholder type for OpenMP array section.
933 PREDEF_TYPE_OMP_ARRAY_SECTION = 42,
935 /// The '__float128' type
936 PREDEF_TYPE_FLOAT128_ID = 43,
938 /// The '_Float16' type
939 PREDEF_TYPE_FLOAT16_ID = 44,
941 /// The C++ 'char8_t' type.
942 PREDEF_TYPE_CHAR8_ID = 45,
944 /// \brief The 'short _Accum' type
945 PREDEF_TYPE_SHORT_ACCUM_ID = 46,
947 /// \brief The '_Accum' type
948 PREDEF_TYPE_ACCUM_ID = 47,
950 /// \brief The 'long _Accum' type
951 PREDEF_TYPE_LONG_ACCUM_ID = 48,
953 /// \brief The 'unsigned short _Accum' type
954 PREDEF_TYPE_USHORT_ACCUM_ID = 49,
956 /// \brief The 'unsigned _Accum' type
957 PREDEF_TYPE_UACCUM_ID = 50,
959 /// \brief The 'unsigned long _Accum' type
960 PREDEF_TYPE_ULONG_ACCUM_ID = 51,
962 /// \brief The 'short _Fract' type
963 PREDEF_TYPE_SHORT_FRACT_ID = 52,
965 /// \brief The '_Fract' type
966 PREDEF_TYPE_FRACT_ID = 53,
968 /// \brief The 'long _Fract' type
969 PREDEF_TYPE_LONG_FRACT_ID = 54,
971 /// \brief The 'unsigned short _Fract' type
972 PREDEF_TYPE_USHORT_FRACT_ID = 55,
974 /// \brief The 'unsigned _Fract' type
975 PREDEF_TYPE_UFRACT_ID = 56,
977 /// \brief The 'unsigned long _Fract' type
978 PREDEF_TYPE_ULONG_FRACT_ID = 57,
980 /// \brief The '_Sat short _Accum' type
981 PREDEF_TYPE_SAT_SHORT_ACCUM_ID = 58,
983 /// \brief The '_Sat _Accum' type
984 PREDEF_TYPE_SAT_ACCUM_ID = 59,
986 /// \brief The '_Sat long _Accum' type
987 PREDEF_TYPE_SAT_LONG_ACCUM_ID = 60,
989 /// \brief The '_Sat unsigned short _Accum' type
990 PREDEF_TYPE_SAT_USHORT_ACCUM_ID = 61,
992 /// \brief The '_Sat unsigned _Accum' type
993 PREDEF_TYPE_SAT_UACCUM_ID = 62,
995 /// \brief The '_Sat unsigned long _Accum' type
996 PREDEF_TYPE_SAT_ULONG_ACCUM_ID = 63,
998 /// \brief The '_Sat short _Fract' type
999 PREDEF_TYPE_SAT_SHORT_FRACT_ID = 64,
1001 /// \brief The '_Sat _Fract' type
1002 PREDEF_TYPE_SAT_FRACT_ID = 65,
1004 /// \brief The '_Sat long _Fract' type
1005 PREDEF_TYPE_SAT_LONG_FRACT_ID = 66,
1007 /// \brief The '_Sat unsigned short _Fract' type
1008 PREDEF_TYPE_SAT_USHORT_FRACT_ID = 67,
1010 /// \brief The '_Sat unsigned _Fract' type
1011 PREDEF_TYPE_SAT_UFRACT_ID = 68,
1013 /// \brief The '_Sat unsigned long _Fract' type
1014 PREDEF_TYPE_SAT_ULONG_FRACT_ID = 69,
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"
1029 /// The number of predefined type IDs that are reserved for
1030 /// the PREDEF_TYPE_* constants.
1032 /// Type IDs for non-predefined types will start at
1033 /// NUM_PREDEF_TYPE_IDs.
1034 const unsigned NUM_PREDEF_TYPE_IDS = 200;
1036 /// Record codes for each kind of type.
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.
1043 /// An ExtQualType record.
1046 /// A ComplexType record.
1049 /// A PointerType record.
1052 /// A BlockPointerType record.
1053 TYPE_BLOCK_POINTER = 5,
1055 /// An LValueReferenceType record.
1056 TYPE_LVALUE_REFERENCE = 6,
1058 /// An RValueReferenceType record.
1059 TYPE_RVALUE_REFERENCE = 7,
1061 /// A MemberPointerType record.
1062 TYPE_MEMBER_POINTER = 8,
1064 /// A ConstantArrayType record.
1065 TYPE_CONSTANT_ARRAY = 9,
1067 /// An IncompleteArrayType record.
1068 TYPE_INCOMPLETE_ARRAY = 10,
1070 /// A VariableArrayType record.
1071 TYPE_VARIABLE_ARRAY = 11,
1073 /// A VectorType record.
1076 /// An ExtVectorType record.
1077 TYPE_EXT_VECTOR = 13,
1079 /// A FunctionNoProtoType record.
1080 TYPE_FUNCTION_NO_PROTO = 14,
1082 /// A FunctionProtoType record.
1083 TYPE_FUNCTION_PROTO = 15,
1085 /// A TypedefType record.
1088 /// A TypeOfExprType record.
1089 TYPE_TYPEOF_EXPR = 17,
1091 /// A TypeOfType record.
1094 /// A RecordType record.
1097 /// An EnumType record.
1100 /// An ObjCInterfaceType record.
1101 TYPE_OBJC_INTERFACE = 21,
1103 /// An ObjCObjectPointerType record.
1104 TYPE_OBJC_OBJECT_POINTER = 22,
1106 /// a DecltypeType record.
1109 /// An ElaboratedType record.
1110 TYPE_ELABORATED = 24,
1112 /// A SubstTemplateTypeParmType record.
1113 TYPE_SUBST_TEMPLATE_TYPE_PARM = 25,
1115 /// An UnresolvedUsingType record.
1116 TYPE_UNRESOLVED_USING = 26,
1118 /// An InjectedClassNameType record.
1119 TYPE_INJECTED_CLASS_NAME = 27,
1121 /// An ObjCObjectType record.
1122 TYPE_OBJC_OBJECT = 28,
1124 /// An TemplateTypeParmType record.
1125 TYPE_TEMPLATE_TYPE_PARM = 29,
1127 /// An TemplateSpecializationType record.
1128 TYPE_TEMPLATE_SPECIALIZATION = 30,
1130 /// A DependentNameType record.
1131 TYPE_DEPENDENT_NAME = 31,
1133 /// A DependentTemplateSpecializationType record.
1134 TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION = 32,
1136 /// A DependentSizedArrayType record.
1137 TYPE_DEPENDENT_SIZED_ARRAY = 33,
1139 /// A ParenType record.
1142 /// A PackExpansionType record.
1143 TYPE_PACK_EXPANSION = 35,
1145 /// An AttributedType record.
1146 TYPE_ATTRIBUTED = 36,
1148 /// A SubstTemplateTypeParmPackType record.
1149 TYPE_SUBST_TEMPLATE_TYPE_PARM_PACK = 37,
1151 /// A AutoType record.
1154 /// A UnaryTransformType record.
1155 TYPE_UNARY_TRANSFORM = 39,
1157 /// An AtomicType record.
1160 /// A DecayedType record.
1163 /// An AdjustedType record.
1166 /// A PipeType record.
1169 /// An ObjCTypeParamType record.
1170 TYPE_OBJC_TYPE_PARAM = 44,
1172 /// A DeducedTemplateSpecializationType record.
1173 TYPE_DEDUCED_TEMPLATE_SPECIALIZATION = 45,
1175 /// A DependentSizedExtVectorType record.
1176 TYPE_DEPENDENT_SIZED_EXT_VECTOR = 46,
1178 /// A DependentAddressSpaceType record.
1179 TYPE_DEPENDENT_ADDRESS_SPACE = 47,
1181 /// A dependentSizedVectorType record.
1182 TYPE_DEPENDENT_SIZED_VECTOR = 48,
1184 /// A type defined in a macro.
1185 TYPE_MACRO_QUALIFIED = 49
1188 /// The type IDs for special types constructed by semantic
1191 /// The constants in this enumeration are indices into the
1192 /// SPECIAL_TYPES record.
1193 enum SpecialTypeIDs {
1194 /// CFConstantString type
1195 SPECIAL_TYPE_CF_CONSTANT_STRING = 0,
1197 /// C FILE typedef type
1198 SPECIAL_TYPE_FILE = 1,
1200 /// C jmp_buf typedef type
1201 SPECIAL_TYPE_JMP_BUF = 2,
1203 /// C sigjmp_buf typedef type
1204 SPECIAL_TYPE_SIGJMP_BUF = 3,
1206 /// Objective-C "id" redefinition type
1207 SPECIAL_TYPE_OBJC_ID_REDEFINITION = 4,
1209 /// Objective-C "Class" redefinition type
1210 SPECIAL_TYPE_OBJC_CLASS_REDEFINITION = 5,
1212 /// Objective-C "SEL" redefinition type
1213 SPECIAL_TYPE_OBJC_SEL_REDEFINITION = 6,
1215 /// C ucontext_t typedef type
1216 SPECIAL_TYPE_UCONTEXT_T = 7
1219 /// The number of special type IDs.
1220 const unsigned NumSpecialTypeIDs = 8;
1222 /// Predefined declaration IDs.
1224 /// These declaration IDs correspond to predefined declarations in the AST
1225 /// context, such as the NULL declaration ID. Such declarations are never
1226 /// actually serialized, since they will be built by the AST context when
1228 enum PredefinedDeclIDs {
1229 /// The NULL declaration.
1230 PREDEF_DECL_NULL_ID = 0,
1232 /// The translation unit.
1233 PREDEF_DECL_TRANSLATION_UNIT_ID = 1,
1235 /// The Objective-C 'id' type.
1236 PREDEF_DECL_OBJC_ID_ID = 2,
1238 /// The Objective-C 'SEL' type.
1239 PREDEF_DECL_OBJC_SEL_ID = 3,
1241 /// The Objective-C 'Class' type.
1242 PREDEF_DECL_OBJC_CLASS_ID = 4,
1244 /// The Objective-C 'Protocol' type.
1245 PREDEF_DECL_OBJC_PROTOCOL_ID = 5,
1247 /// The signed 128-bit integer type.
1248 PREDEF_DECL_INT_128_ID = 6,
1250 /// The unsigned 128-bit integer type.
1251 PREDEF_DECL_UNSIGNED_INT_128_ID = 7,
1253 /// The internal 'instancetype' typedef.
1254 PREDEF_DECL_OBJC_INSTANCETYPE_ID = 8,
1256 /// The internal '__builtin_va_list' typedef.
1257 PREDEF_DECL_BUILTIN_VA_LIST_ID = 9,
1259 /// The internal '__va_list_tag' struct, if any.
1260 PREDEF_DECL_VA_LIST_TAG = 10,
1262 /// The internal '__builtin_ms_va_list' typedef.
1263 PREDEF_DECL_BUILTIN_MS_VA_LIST_ID = 11,
1265 /// The extern "C" context.
1266 PREDEF_DECL_EXTERN_C_CONTEXT_ID = 12,
1268 /// The internal '__make_integer_seq' template.
1269 PREDEF_DECL_MAKE_INTEGER_SEQ_ID = 13,
1271 /// The internal '__NSConstantString' typedef.
1272 PREDEF_DECL_CF_CONSTANT_STRING_ID = 14,
1274 /// The internal '__NSConstantString' tag type.
1275 PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID = 15,
1277 /// The internal '__type_pack_element' template.
1278 PREDEF_DECL_TYPE_PACK_ELEMENT_ID = 16,
1281 /// The number of declaration IDs that are predefined.
1283 /// For more information about predefined declarations, see the
1284 /// \c PredefinedDeclIDs type and the PREDEF_DECL_*_ID constants.
1285 const unsigned int NUM_PREDEF_DECL_IDS = 17;
1287 /// Record of updates for a declaration that was modified after
1288 /// being deserialized. This can occur within DECLTYPES_BLOCK_ID.
1289 const unsigned int DECL_UPDATES = 49;
1291 /// Record code for a list of local redeclarations of a declaration.
1292 /// This can occur within DECLTYPES_BLOCK_ID.
1293 const unsigned int LOCAL_REDECLARATIONS = 50;
1295 /// Record codes for each kind of declaration.
1297 /// These constants describe the declaration records that can occur within
1298 /// a declarations block (identified by DECLTYPES_BLOCK_ID). Each
1299 /// constant describes a record for a specific declaration class
1300 /// in the AST. Note that TypeCode values share this code space.
1302 /// A TypedefDecl record.
1304 /// A TypeAliasDecl record.
1308 /// An EnumDecl record.
1311 /// A RecordDecl record.
1314 /// An EnumConstantDecl record.
1317 /// A FunctionDecl record.
1320 /// A ObjCMethodDecl record.
1323 /// A ObjCInterfaceDecl record.
1324 DECL_OBJC_INTERFACE,
1326 /// A ObjCProtocolDecl record.
1329 /// A ObjCIvarDecl record.
1332 /// A ObjCAtDefsFieldDecl record.
1333 DECL_OBJC_AT_DEFS_FIELD,
1335 /// A ObjCCategoryDecl record.
1338 /// A ObjCCategoryImplDecl record.
1339 DECL_OBJC_CATEGORY_IMPL,
1341 /// A ObjCImplementationDecl record.
1342 DECL_OBJC_IMPLEMENTATION,
1344 /// A ObjCCompatibleAliasDecl record.
1345 DECL_OBJC_COMPATIBLE_ALIAS,
1347 /// A ObjCPropertyDecl record.
1350 /// A ObjCPropertyImplDecl record.
1351 DECL_OBJC_PROPERTY_IMPL,
1353 /// A FieldDecl record.
1356 /// A MSPropertyDecl record.
1359 /// A VarDecl record.
1362 /// An ImplicitParamDecl record.
1363 DECL_IMPLICIT_PARAM,
1365 /// A ParmVarDecl record.
1368 /// A DecompositionDecl record.
1371 /// A BindingDecl record.
1374 /// A FileScopeAsmDecl record.
1375 DECL_FILE_SCOPE_ASM,
1377 /// A BlockDecl record.
1380 /// A CapturedDecl record.
1383 /// A record that stores the set of declarations that are
1384 /// lexically stored within a given DeclContext.
1386 /// The record itself is a blob that is an array of declaration IDs,
1387 /// in the order in which those declarations were added to the
1388 /// declaration context. This data is used when iterating over
1389 /// the contents of a DeclContext, e.g., via
1390 /// DeclContext::decls_begin() and DeclContext::decls_end().
1391 DECL_CONTEXT_LEXICAL,
1393 /// A record that stores the set of declarations that are
1394 /// visible from a given DeclContext.
1396 /// The record itself stores a set of mappings, each of which
1397 /// associates a declaration name with one or more declaration
1398 /// IDs. This data is used when performing qualified name lookup
1399 /// into a DeclContext via DeclContext::lookup.
1400 DECL_CONTEXT_VISIBLE,
1402 /// A LabelDecl record.
1405 /// A NamespaceDecl record.
1408 /// A NamespaceAliasDecl record.
1409 DECL_NAMESPACE_ALIAS,
1411 /// A UsingDecl record.
1414 /// A UsingPackDecl record.
1417 /// A UsingShadowDecl record.
1420 /// A ConstructorUsingShadowDecl record.
1421 DECL_CONSTRUCTOR_USING_SHADOW,
1423 /// A UsingDirecitveDecl record.
1424 DECL_USING_DIRECTIVE,
1426 /// An UnresolvedUsingValueDecl record.
1427 DECL_UNRESOLVED_USING_VALUE,
1429 /// An UnresolvedUsingTypenameDecl record.
1430 DECL_UNRESOLVED_USING_TYPENAME,
1432 /// A LinkageSpecDecl record.
1435 /// An ExportDecl record.
1438 /// A CXXRecordDecl record.
1441 /// A CXXDeductionGuideDecl record.
1442 DECL_CXX_DEDUCTION_GUIDE,
1444 /// A CXXMethodDecl record.
1447 /// A CXXConstructorDecl record.
1448 DECL_CXX_CONSTRUCTOR,
1450 /// A CXXDestructorDecl record.
1451 DECL_CXX_DESTRUCTOR,
1453 /// A CXXConversionDecl record.
1454 DECL_CXX_CONVERSION,
1456 /// An AccessSpecDecl record.
1459 /// A FriendDecl record.
1462 /// A FriendTemplateDecl record.
1463 DECL_FRIEND_TEMPLATE,
1465 /// A ClassTemplateDecl record.
1466 DECL_CLASS_TEMPLATE,
1468 /// A ClassTemplateSpecializationDecl record.
1469 DECL_CLASS_TEMPLATE_SPECIALIZATION,
1471 /// A ClassTemplatePartialSpecializationDecl record.
1472 DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION,
1474 /// A VarTemplateDecl record.
1477 /// A VarTemplateSpecializationDecl record.
1478 DECL_VAR_TEMPLATE_SPECIALIZATION,
1480 /// A VarTemplatePartialSpecializationDecl record.
1481 DECL_VAR_TEMPLATE_PARTIAL_SPECIALIZATION,
1483 /// A FunctionTemplateDecl record.
1484 DECL_FUNCTION_TEMPLATE,
1486 /// A TemplateTypeParmDecl record.
1487 DECL_TEMPLATE_TYPE_PARM,
1489 /// A NonTypeTemplateParmDecl record.
1490 DECL_NON_TYPE_TEMPLATE_PARM,
1492 /// A TemplateTemplateParmDecl record.
1493 DECL_TEMPLATE_TEMPLATE_PARM,
1495 /// A TypeAliasTemplateDecl record.
1496 DECL_TYPE_ALIAS_TEMPLATE,
1498 /// \brief A ConceptDecl record.
1501 /// \brief A StaticAssertDecl record.
1504 /// A record containing CXXBaseSpecifiers.
1505 DECL_CXX_BASE_SPECIFIERS,
1507 /// A record containing CXXCtorInitializers.
1508 DECL_CXX_CTOR_INITIALIZERS,
1510 /// A IndirectFieldDecl record.
1513 /// A NonTypeTemplateParmDecl record that stores an expanded
1514 /// non-type template parameter pack.
1515 DECL_EXPANDED_NON_TYPE_TEMPLATE_PARM_PACK,
1517 /// A TemplateTemplateParmDecl record that stores an expanded
1518 /// template template parameter pack.
1519 DECL_EXPANDED_TEMPLATE_TEMPLATE_PARM_PACK,
1521 /// A ClassScopeFunctionSpecializationDecl record a class scope
1522 /// function specialization. (Microsoft extension).
1523 DECL_CLASS_SCOPE_FUNCTION_SPECIALIZATION,
1525 /// An ImportDecl recording a module import.
1528 /// An OMPThreadPrivateDecl record.
1529 DECL_OMP_THREADPRIVATE,
1531 /// An OMPRequiresDecl record.
1534 /// An OMPAllocateDcl record.
1537 /// An EmptyDecl record.
1540 /// An ObjCTypeParamDecl record.
1541 DECL_OBJC_TYPE_PARAM,
1543 /// An OMPCapturedExprDecl record.
1544 DECL_OMP_CAPTUREDEXPR,
1546 /// A PragmaCommentDecl record.
1547 DECL_PRAGMA_COMMENT,
1549 /// A PragmaDetectMismatchDecl record.
1550 DECL_PRAGMA_DETECT_MISMATCH,
1552 /// An OMPDeclareMapperDecl record.
1553 DECL_OMP_DECLARE_MAPPER,
1555 /// An OMPDeclareReductionDecl record.
1556 DECL_OMP_DECLARE_REDUCTION,
1558 DECL_LAST = DECL_OMP_DECLARE_REDUCTION
1561 /// Record codes for each kind of statement or expression.
1563 /// These constants describe the records that describe statements
1564 /// or expressions. These records occur within type and declarations
1565 /// block, so they begin with record values of 128. Each constant
1566 /// describes a record for a specific statement or expression class in the
1569 /// A marker record that indicates that we are at the end
1570 /// of an expression.
1571 STMT_STOP = DECL_LAST + 1,
1573 /// A NULL expression.
1576 /// A reference to a previously [de]serialized Stmt record.
1579 /// A NullStmt record.
1582 /// A CompoundStmt record.
1585 /// A CaseStmt record.
1588 /// A DefaultStmt record.
1591 /// A LabelStmt record.
1594 /// An AttributedStmt record.
1597 /// An IfStmt record.
1600 /// A SwitchStmt record.
1603 /// A WhileStmt record.
1606 /// A DoStmt record.
1609 /// A ForStmt record.
1612 /// A GotoStmt record.
1615 /// An IndirectGotoStmt record.
1618 /// A ContinueStmt record.
1621 /// A BreakStmt record.
1624 /// A ReturnStmt record.
1627 /// A DeclStmt record.
1630 /// A CapturedStmt record.
1633 /// A GCC-style AsmStmt record.
1636 /// A MS-style AsmStmt record.
1639 /// A constant expression context.
1642 /// A PredefinedExpr record.
1645 /// A DeclRefExpr record.
1648 /// An IntegerLiteral record.
1649 EXPR_INTEGER_LITERAL,
1651 /// A FloatingLiteral record.
1652 EXPR_FLOATING_LITERAL,
1654 /// An ImaginaryLiteral record.
1655 EXPR_IMAGINARY_LITERAL,
1657 /// A StringLiteral record.
1658 EXPR_STRING_LITERAL,
1660 /// A CharacterLiteral record.
1661 EXPR_CHARACTER_LITERAL,
1663 /// A ParenExpr record.
1666 /// A ParenListExpr record.
1669 /// A UnaryOperator record.
1670 EXPR_UNARY_OPERATOR,
1672 /// An OffsetOfExpr record.
1675 /// A SizefAlignOfExpr record.
1676 EXPR_SIZEOF_ALIGN_OF,
1678 /// An ArraySubscriptExpr record.
1679 EXPR_ARRAY_SUBSCRIPT,
1681 /// A CallExpr record.
1684 /// A MemberExpr record.
1687 /// A BinaryOperator record.
1688 EXPR_BINARY_OPERATOR,
1690 /// A CompoundAssignOperator record.
1691 EXPR_COMPOUND_ASSIGN_OPERATOR,
1693 /// A ConditionOperator record.
1694 EXPR_CONDITIONAL_OPERATOR,
1696 /// An ImplicitCastExpr record.
1699 /// A CStyleCastExpr record.
1702 /// A CompoundLiteralExpr record.
1703 EXPR_COMPOUND_LITERAL,
1705 /// An ExtVectorElementExpr record.
1706 EXPR_EXT_VECTOR_ELEMENT,
1708 /// An InitListExpr record.
1711 /// A DesignatedInitExpr record.
1712 EXPR_DESIGNATED_INIT,
1714 /// A DesignatedInitUpdateExpr record.
1715 EXPR_DESIGNATED_INIT_UPDATE,
1717 /// An NoInitExpr record.
1720 /// An ArrayInitLoopExpr record.
1721 EXPR_ARRAY_INIT_LOOP,
1723 /// An ArrayInitIndexExpr record.
1724 EXPR_ARRAY_INIT_INDEX,
1726 /// An ImplicitValueInitExpr record.
1727 EXPR_IMPLICIT_VALUE_INIT,
1729 /// A VAArgExpr record.
1732 /// An AddrLabelExpr record.
1735 /// A StmtExpr record.
1738 /// A ChooseExpr record.
1741 /// A GNUNullExpr record.
1744 /// A SourceLocExpr record.
1747 /// A ShuffleVectorExpr record.
1748 EXPR_SHUFFLE_VECTOR,
1750 /// A ConvertVectorExpr record.
1751 EXPR_CONVERT_VECTOR,
1756 /// A GenericSelectionExpr record.
1757 EXPR_GENERIC_SELECTION,
1759 /// A PseudoObjectExpr record.
1762 /// An AtomicExpr record.
1767 /// An ObjCStringLiteral record.
1768 EXPR_OBJC_STRING_LITERAL,
1770 EXPR_OBJC_BOXED_EXPRESSION,
1771 EXPR_OBJC_ARRAY_LITERAL,
1772 EXPR_OBJC_DICTIONARY_LITERAL,
1774 /// An ObjCEncodeExpr record.
1777 /// An ObjCSelectorExpr record.
1778 EXPR_OBJC_SELECTOR_EXPR,
1780 /// An ObjCProtocolExpr record.
1781 EXPR_OBJC_PROTOCOL_EXPR,
1783 /// An ObjCIvarRefExpr record.
1784 EXPR_OBJC_IVAR_REF_EXPR,
1786 /// An ObjCPropertyRefExpr record.
1787 EXPR_OBJC_PROPERTY_REF_EXPR,
1789 /// An ObjCSubscriptRefExpr record.
1790 EXPR_OBJC_SUBSCRIPT_REF_EXPR,
1793 EXPR_OBJC_KVC_REF_EXPR,
1795 /// An ObjCMessageExpr record.
1796 EXPR_OBJC_MESSAGE_EXPR,
1798 /// An ObjCIsa Expr record.
1801 /// An ObjCIndirectCopyRestoreExpr record.
1802 EXPR_OBJC_INDIRECT_COPY_RESTORE,
1804 /// An ObjCForCollectionStmt record.
1805 STMT_OBJC_FOR_COLLECTION,
1807 /// An ObjCAtCatchStmt record.
1810 /// An ObjCAtFinallyStmt record.
1813 /// An ObjCAtTryStmt record.
1816 /// An ObjCAtSynchronizedStmt record.
1817 STMT_OBJC_AT_SYNCHRONIZED,
1819 /// An ObjCAtThrowStmt record.
1822 /// An ObjCAutoreleasePoolStmt record.
1823 STMT_OBJC_AUTORELEASE_POOL,
1825 /// An ObjCBoolLiteralExpr record.
1826 EXPR_OBJC_BOOL_LITERAL,
1828 /// An ObjCAvailabilityCheckExpr record.
1829 EXPR_OBJC_AVAILABILITY_CHECK,
1833 /// A CXXCatchStmt record.
1836 /// A CXXTryStmt record.
1838 /// A CXXForRangeStmt record.
1842 /// A CXXOperatorCallExpr record.
1843 EXPR_CXX_OPERATOR_CALL,
1845 /// A CXXMemberCallExpr record.
1846 EXPR_CXX_MEMBER_CALL,
1848 /// A CXXRewrittenBinaryOperator record.
1849 EXPR_CXX_REWRITTEN_BINARY_OPERATOR,
1851 /// A CXXConstructExpr record.
1854 /// A CXXInheritedCtorInitExpr record.
1855 EXPR_CXX_INHERITED_CTOR_INIT,
1857 /// A CXXTemporaryObjectExpr record.
1858 EXPR_CXX_TEMPORARY_OBJECT,
1860 /// A CXXStaticCastExpr record.
1861 EXPR_CXX_STATIC_CAST,
1863 /// A CXXDynamicCastExpr record.
1864 EXPR_CXX_DYNAMIC_CAST,
1866 /// A CXXReinterpretCastExpr record.
1867 EXPR_CXX_REINTERPRET_CAST,
1869 /// A CXXConstCastExpr record.
1870 EXPR_CXX_CONST_CAST,
1872 /// A CXXFunctionalCastExpr record.
1873 EXPR_CXX_FUNCTIONAL_CAST,
1875 /// A UserDefinedLiteral record.
1876 EXPR_USER_DEFINED_LITERAL,
1878 /// A CXXStdInitializerListExpr record.
1879 EXPR_CXX_STD_INITIALIZER_LIST,
1881 /// A CXXBoolLiteralExpr record.
1882 EXPR_CXX_BOOL_LITERAL,
1884 EXPR_CXX_NULL_PTR_LITERAL, // CXXNullPtrLiteralExpr
1885 EXPR_CXX_TYPEID_EXPR, // CXXTypeidExpr (of expr).
1886 EXPR_CXX_TYPEID_TYPE, // CXXTypeidExpr (of type).
1887 EXPR_CXX_THIS, // CXXThisExpr
1888 EXPR_CXX_THROW, // CXXThrowExpr
1889 EXPR_CXX_DEFAULT_ARG, // CXXDefaultArgExpr
1890 EXPR_CXX_DEFAULT_INIT, // CXXDefaultInitExpr
1891 EXPR_CXX_BIND_TEMPORARY, // CXXBindTemporaryExpr
1893 EXPR_CXX_SCALAR_VALUE_INIT, // CXXScalarValueInitExpr
1894 EXPR_CXX_NEW, // CXXNewExpr
1895 EXPR_CXX_DELETE, // CXXDeleteExpr
1896 EXPR_CXX_PSEUDO_DESTRUCTOR, // CXXPseudoDestructorExpr
1898 EXPR_EXPR_WITH_CLEANUPS, // ExprWithCleanups
1900 EXPR_CXX_DEPENDENT_SCOPE_MEMBER, // CXXDependentScopeMemberExpr
1901 EXPR_CXX_DEPENDENT_SCOPE_DECL_REF, // DependentScopeDeclRefExpr
1902 EXPR_CXX_UNRESOLVED_CONSTRUCT, // CXXUnresolvedConstructExpr
1903 EXPR_CXX_UNRESOLVED_MEMBER, // UnresolvedMemberExpr
1904 EXPR_CXX_UNRESOLVED_LOOKUP, // UnresolvedLookupExpr
1906 EXPR_CXX_EXPRESSION_TRAIT, // ExpressionTraitExpr
1907 EXPR_CXX_NOEXCEPT, // CXXNoexceptExpr
1909 EXPR_OPAQUE_VALUE, // OpaqueValueExpr
1910 EXPR_BINARY_CONDITIONAL_OPERATOR, // BinaryConditionalOperator
1911 EXPR_TYPE_TRAIT, // TypeTraitExpr
1912 EXPR_ARRAY_TYPE_TRAIT, // ArrayTypeTraitIntExpr
1914 EXPR_PACK_EXPANSION, // PackExpansionExpr
1915 EXPR_SIZEOF_PACK, // SizeOfPackExpr
1916 EXPR_SUBST_NON_TYPE_TEMPLATE_PARM, // SubstNonTypeTemplateParmExpr
1917 EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK,// SubstNonTypeTemplateParmPackExpr
1918 EXPR_FUNCTION_PARM_PACK, // FunctionParmPackExpr
1919 EXPR_MATERIALIZE_TEMPORARY, // MaterializeTemporaryExpr
1920 EXPR_CXX_FOLD, // CXXFoldExpr
1921 EXPR_CONCEPT_SPECIALIZATION,// ConceptSpecializationExpr
1924 EXPR_CUDA_KERNEL_CALL, // CUDAKernelCallExpr
1927 EXPR_ASTYPE, // AsTypeExpr
1930 EXPR_CXX_PROPERTY_REF_EXPR, // MSPropertyRefExpr
1931 EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR, // MSPropertySubscriptExpr
1932 EXPR_CXX_UUIDOF_EXPR, // CXXUuidofExpr (of expr).
1933 EXPR_CXX_UUIDOF_TYPE, // CXXUuidofExpr (of type).
1934 STMT_SEH_LEAVE, // SEHLeaveStmt
1935 STMT_SEH_EXCEPT, // SEHExceptStmt
1936 STMT_SEH_FINALLY, // SEHFinallyStmt
1937 STMT_SEH_TRY, // SEHTryStmt
1939 // OpenMP directives
1940 STMT_OMP_PARALLEL_DIRECTIVE,
1941 STMT_OMP_SIMD_DIRECTIVE,
1942 STMT_OMP_FOR_DIRECTIVE,
1943 STMT_OMP_FOR_SIMD_DIRECTIVE,
1944 STMT_OMP_SECTIONS_DIRECTIVE,
1945 STMT_OMP_SECTION_DIRECTIVE,
1946 STMT_OMP_SINGLE_DIRECTIVE,
1947 STMT_OMP_MASTER_DIRECTIVE,
1948 STMT_OMP_CRITICAL_DIRECTIVE,
1949 STMT_OMP_PARALLEL_FOR_DIRECTIVE,
1950 STMT_OMP_PARALLEL_FOR_SIMD_DIRECTIVE,
1951 STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE,
1952 STMT_OMP_TASK_DIRECTIVE,
1953 STMT_OMP_TASKYIELD_DIRECTIVE,
1954 STMT_OMP_BARRIER_DIRECTIVE,
1955 STMT_OMP_TASKWAIT_DIRECTIVE,
1956 STMT_OMP_FLUSH_DIRECTIVE,
1957 STMT_OMP_ORDERED_DIRECTIVE,
1958 STMT_OMP_ATOMIC_DIRECTIVE,
1959 STMT_OMP_TARGET_DIRECTIVE,
1960 STMT_OMP_TARGET_DATA_DIRECTIVE,
1961 STMT_OMP_TARGET_ENTER_DATA_DIRECTIVE,
1962 STMT_OMP_TARGET_EXIT_DATA_DIRECTIVE,
1963 STMT_OMP_TARGET_PARALLEL_DIRECTIVE,
1964 STMT_OMP_TARGET_PARALLEL_FOR_DIRECTIVE,
1965 STMT_OMP_TEAMS_DIRECTIVE,
1966 STMT_OMP_TASKGROUP_DIRECTIVE,
1967 STMT_OMP_CANCELLATION_POINT_DIRECTIVE,
1968 STMT_OMP_CANCEL_DIRECTIVE,
1969 STMT_OMP_TASKLOOP_DIRECTIVE,
1970 STMT_OMP_TASKLOOP_SIMD_DIRECTIVE,
1971 STMT_OMP_MASTER_TASKLOOP_DIRECTIVE,
1972 STMT_OMP_MASTER_TASKLOOP_SIMD_DIRECTIVE,
1973 STMT_OMP_PARALLEL_MASTER_TASKLOOP_DIRECTIVE,
1974 STMT_OMP_DISTRIBUTE_DIRECTIVE,
1975 STMT_OMP_TARGET_UPDATE_DIRECTIVE,
1976 STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE,
1977 STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE,
1978 STMT_OMP_DISTRIBUTE_SIMD_DIRECTIVE,
1979 STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE,
1980 STMT_OMP_TARGET_SIMD_DIRECTIVE,
1981 STMT_OMP_TEAMS_DISTRIBUTE_DIRECTIVE,
1982 STMT_OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE,
1983 STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE,
1984 STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE,
1985 STMT_OMP_TARGET_TEAMS_DIRECTIVE,
1986 STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE,
1987 STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE,
1988 STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE,
1989 STMT_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE,
1990 EXPR_OMP_ARRAY_SECTION,
1993 EXPR_OBJC_BRIDGED_CAST, // ObjCBridgedCastExpr
1995 STMT_MS_DEPENDENT_EXISTS, // MSDependentExistsStmt
1996 EXPR_LAMBDA, // LambdaExpr
1997 STMT_COROUTINE_BODY,
2001 EXPR_DEPENDENT_COAWAIT,
2004 /// The kinds of designators that can occur in a
2005 /// DesignatedInitExpr.
2006 enum DesignatorTypes {
2007 /// Field designator where only the field name is known.
2008 DESIG_FIELD_NAME = 0,
2010 /// Field designator where the field has been resolved to
2012 DESIG_FIELD_DECL = 1,
2014 /// Array designator.
2017 /// GNU array range designator.
2018 DESIG_ARRAY_RANGE = 3
2021 /// The different kinds of data that can occur in a
2022 /// CtorInitializer.
2023 enum CtorInitializerType {
2024 CTOR_INITIALIZER_BASE,
2025 CTOR_INITIALIZER_DELEGATING,
2026 CTOR_INITIALIZER_MEMBER,
2027 CTOR_INITIALIZER_INDIRECT_MEMBER
2030 /// Describes the redeclarations of a declaration.
2031 struct LocalRedeclarationsInfo {
2032 // The ID of the first declaration
2035 // Offset into the array of redeclaration chains.
2038 friend bool operator<(const LocalRedeclarationsInfo &X,
2039 const LocalRedeclarationsInfo &Y) {
2040 return X.FirstID < Y.FirstID;
2043 friend bool operator>(const LocalRedeclarationsInfo &X,
2044 const LocalRedeclarationsInfo &Y) {
2045 return X.FirstID > Y.FirstID;
2048 friend bool operator<=(const LocalRedeclarationsInfo &X,
2049 const LocalRedeclarationsInfo &Y) {
2050 return X.FirstID <= Y.FirstID;
2053 friend bool operator>=(const LocalRedeclarationsInfo &X,
2054 const LocalRedeclarationsInfo &Y) {
2055 return X.FirstID >= Y.FirstID;
2059 /// Describes the categories of an Objective-C class.
2060 struct ObjCCategoriesInfo {
2061 // The ID of the definition
2062 DeclID DefinitionID;
2064 // Offset into the array of category lists.
2067 friend bool operator<(const ObjCCategoriesInfo &X,
2068 const ObjCCategoriesInfo &Y) {
2069 return X.DefinitionID < Y.DefinitionID;
2072 friend bool operator>(const ObjCCategoriesInfo &X,
2073 const ObjCCategoriesInfo &Y) {
2074 return X.DefinitionID > Y.DefinitionID;
2077 friend bool operator<=(const ObjCCategoriesInfo &X,
2078 const ObjCCategoriesInfo &Y) {
2079 return X.DefinitionID <= Y.DefinitionID;
2082 friend bool operator>=(const ObjCCategoriesInfo &X,
2083 const ObjCCategoriesInfo &Y) {
2084 return X.DefinitionID >= Y.DefinitionID;
2088 /// A key used when looking up entities by \ref DeclarationName.
2090 /// Different \ref DeclarationNames are mapped to different keys, but the
2091 /// same key can occasionally represent multiple names (for names that
2092 /// contain types, in particular).
2093 class DeclarationNameKey {
2094 using NameKind = unsigned;
2100 DeclarationNameKey() = default;
2101 DeclarationNameKey(DeclarationName Name);
2102 DeclarationNameKey(NameKind Kind, uint64_t Data)
2103 : Kind(Kind), Data(Data) {}
2105 NameKind getKind() const { return Kind; }
2107 IdentifierInfo *getIdentifier() const {
2108 assert(Kind == DeclarationName::Identifier ||
2109 Kind == DeclarationName::CXXLiteralOperatorName ||
2110 Kind == DeclarationName::CXXDeductionGuideName);
2111 return (IdentifierInfo *)Data;
2114 Selector getSelector() const {
2115 assert(Kind == DeclarationName::ObjCZeroArgSelector ||
2116 Kind == DeclarationName::ObjCOneArgSelector ||
2117 Kind == DeclarationName::ObjCMultiArgSelector);
2118 return Selector(Data);
2121 OverloadedOperatorKind getOperatorKind() const {
2122 assert(Kind == DeclarationName::CXXOperatorName);
2123 return (OverloadedOperatorKind)Data;
2126 /// Compute a fingerprint of this key for use in on-disk hash table.
2127 unsigned getHash() const;
2129 friend bool operator==(const DeclarationNameKey &A,
2130 const DeclarationNameKey &B) {
2131 return A.Kind == B.Kind && A.Data == B.Data;
2137 } // namespace serialization
2138 } // namespace clang
2142 template <> struct DenseMapInfo<clang::serialization::DeclarationNameKey> {
2143 static clang::serialization::DeclarationNameKey getEmptyKey() {
2144 return clang::serialization::DeclarationNameKey(-1, 1);
2147 static clang::serialization::DeclarationNameKey getTombstoneKey() {
2148 return clang::serialization::DeclarationNameKey(-1, 2);
2152 getHashValue(const clang::serialization::DeclarationNameKey &Key) {
2153 return Key.getHash();
2156 static bool isEqual(const clang::serialization::DeclarationNameKey &L,
2157 const clang::serialization::DeclarationNameKey &R) {
2164 #endif // LLVM_CLANG_SERIALIZATION_ASTBITCODES_H