1 //===- ASTBitCodes.h - Enum values for the PCH bitcode format ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This header defines Bitcode enum values for Clang serialized AST files.
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
16 //===----------------------------------------------------------------------===//
18 #ifndef LLVM_CLANG_SERIALIZATION_ASTBITCODES_H
19 #define LLVM_CLANG_SERIALIZATION_ASTBITCODES_H
21 #include "clang/AST/DeclarationName.h"
22 #include "clang/AST/Type.h"
23 #include "clang/Basic/IdentifierTable.h"
24 #include "clang/Basic/OperatorKinds.h"
25 #include "clang/Basic/SourceLocation.h"
26 #include "llvm/ADT/DenseMapInfo.h"
27 #include "llvm/Bitcode/BitCodes.h"
32 namespace serialization {
34 /// \brief AST file major version number supported by this version of
37 /// Whenever the AST file format changes in a way that makes it
38 /// incompatible with previous versions (such that a reader
39 /// designed for the previous version could not support reading
40 /// the new version), this number should be increased.
42 /// Version 4 of AST files also requires that the version control branch and
43 /// revision match exactly, since there is no backward compatibility of
44 /// AST files at this time.
45 const unsigned VERSION_MAJOR = 6;
47 /// \brief AST file minor version number supported by this version of
50 /// Whenever the AST format changes in a way that is still
51 /// compatible with previous versions (such that a reader designed
52 /// for the previous version could still support reading the new
53 /// version by ignoring new kinds of subblocks), this number
54 /// should be increased.
55 const unsigned VERSION_MINOR = 0;
57 /// \brief An ID number that refers to an identifier in an AST file.
59 /// The ID numbers of identifiers are consecutive (in order of discovery)
60 /// and start at 1. 0 is reserved for NULL.
61 using IdentifierID = uint32_t;
63 /// \brief An ID number that refers to a declaration in an AST file.
65 /// The ID numbers of declarations are consecutive (in order of
66 /// discovery), with values below NUM_PREDEF_DECL_IDS being reserved.
67 /// At the start of a chain of precompiled headers, declaration ID 1 is
68 /// used for the translation unit declaration.
69 using DeclID = uint32_t;
71 // FIXME: Turn these into classes so we can have some type safety when
72 // we go from local ID to global and vice-versa.
73 using LocalDeclID = DeclID;
74 using GlobalDeclID = DeclID;
76 /// \brief An ID number that refers to a type in an AST file.
78 /// The ID of a type is partitioned into two parts: the lower
79 /// three bits are used to store the const/volatile/restrict
80 /// qualifiers (as with QualType) and the upper bits provide a
81 /// type index. The type index values are partitioned into two
82 /// sets. The values below NUM_PREDEF_TYPE_IDs are predefined type
83 /// IDs (based on the PREDEF_TYPE_*_ID constants), with 0 as a
84 /// placeholder for "no type". Values from NUM_PREDEF_TYPE_IDs are
85 /// other types that have serialized representations.
86 using TypeID = uint32_t;
88 /// \brief A type index; the type ID with the qualifier bits removed.
94 explicit TypeIdx(uint32_t index) : Idx(index) {}
96 uint32_t getIndex() const { return Idx; }
98 TypeID asTypeID(unsigned FastQuals) const {
99 if (Idx == uint32_t(-1))
102 return (Idx << Qualifiers::FastWidth) | FastQuals;
105 static TypeIdx fromTypeID(TypeID ID) {
106 if (ID == TypeID(-1))
109 return TypeIdx(ID >> Qualifiers::FastWidth);
113 /// A structure for putting "fast"-unqualified QualTypes into a
114 /// DenseMap. This uses the standard pointer hash function.
115 struct UnsafeQualTypeDenseMapInfo {
116 static bool isEqual(QualType A, QualType B) { return A == B; }
118 static QualType getEmptyKey() {
119 return QualType::getFromOpaquePtr((void*) 1);
122 static QualType getTombstoneKey() {
123 return QualType::getFromOpaquePtr((void*) 2);
126 static unsigned getHashValue(QualType T) {
127 assert(!T.getLocalFastQualifiers() &&
128 "hash invalid for types with fast quals");
129 uintptr_t v = reinterpret_cast<uintptr_t>(T.getAsOpaquePtr());
130 return (unsigned(v) >> 4) ^ (unsigned(v) >> 9);
134 /// \brief An ID number that refers to an identifier in an AST file.
135 using IdentID = uint32_t;
137 /// \brief The number of predefined identifier IDs.
138 const unsigned int NUM_PREDEF_IDENT_IDS = 1;
140 /// \brief An ID number that refers to a macro in an AST file.
141 using MacroID = uint32_t;
143 /// \brief A global ID number that refers to a macro in an AST file.
144 using GlobalMacroID = uint32_t;
146 /// \brief A local to a module ID number that refers to a macro in an
148 using LocalMacroID = uint32_t;
150 /// \brief The number of predefined macro IDs.
151 const unsigned int NUM_PREDEF_MACRO_IDS = 1;
153 /// \brief An ID number that refers to an ObjC selector in an AST file.
154 using SelectorID = uint32_t;
156 /// \brief The number of predefined selector IDs.
157 const unsigned int NUM_PREDEF_SELECTOR_IDS = 1;
159 /// \brief An ID number that refers to a set of CXXBaseSpecifiers in an
161 using CXXBaseSpecifiersID = uint32_t;
163 /// \brief An ID number that refers to a list of CXXCtorInitializers in an
165 using CXXCtorInitializersID = uint32_t;
167 /// \brief An ID number that refers to an entity in the detailed
168 /// preprocessing record.
169 using PreprocessedEntityID = uint32_t;
171 /// \brief An ID number that refers to a submodule in a module file.
172 using SubmoduleID = uint32_t;
174 /// \brief The number of predefined submodule IDs.
175 const unsigned int NUM_PREDEF_SUBMODULE_IDS = 1;
177 /// \brief Source range/offset of a preprocessed entity.
178 struct PPEntityOffset {
179 /// \brief Raw source location of beginning of range.
182 /// \brief Raw source location of end of range.
185 /// \brief Offset in the AST file.
188 PPEntityOffset(SourceRange R, uint32_t BitOffset)
189 : Begin(R.getBegin().getRawEncoding()),
190 End(R.getEnd().getRawEncoding()), BitOffset(BitOffset) {}
192 SourceLocation getBegin() const {
193 return SourceLocation::getFromRawEncoding(Begin);
196 SourceLocation getEnd() const {
197 return SourceLocation::getFromRawEncoding(End);
201 /// \brief Source range/offset of a preprocessed entity.
203 /// \brief Raw source location.
206 /// \brief Offset in the AST file.
207 uint32_t BitOffset = 0;
209 DeclOffset() = default;
210 DeclOffset(SourceLocation Loc, uint32_t BitOffset)
211 : Loc(Loc.getRawEncoding()), BitOffset(BitOffset) {}
213 void setLocation(SourceLocation L) {
214 Loc = L.getRawEncoding();
217 SourceLocation getLocation() const {
218 return SourceLocation::getFromRawEncoding(Loc);
222 /// \brief The number of predefined preprocessed entity IDs.
223 const unsigned int NUM_PREDEF_PP_ENTITY_IDS = 1;
225 /// \brief Describes the various kinds of blocks that occur within
228 /// \brief The AST block, which acts as a container around the
230 AST_BLOCK_ID = llvm::bitc::FIRST_APPLICATION_BLOCKID,
232 /// \brief The block containing information about the source
234 SOURCE_MANAGER_BLOCK_ID,
236 /// \brief The block containing information about the
238 PREPROCESSOR_BLOCK_ID,
240 /// \brief The block containing the definitions of all of the
241 /// types and decls used within the AST file.
244 /// \brief The block containing the detailed preprocessing record.
245 PREPROCESSOR_DETAIL_BLOCK_ID,
247 /// \brief The block containing the submodule structure.
250 /// \brief The block containing comments.
253 /// \brief The control block, which contains all of the
254 /// information that needs to be validated prior to committing
255 /// to loading the AST file.
258 /// \brief The block of input files, which were used as inputs
259 /// to create this AST file.
261 /// This block is part of the control block.
262 INPUT_FILES_BLOCK_ID,
264 /// \brief The block of configuration options, used to check that
265 /// a module is being used in a configuration compatible with the
266 /// configuration in which it was built.
268 /// This block is part of the control block.
271 /// \brief A block containing a module file extension.
274 /// A block with unhashed content.
276 /// These records should not change the \a ASTFileSignature. See \a
277 /// UnhashedControlBlockRecordTypes for the list of records.
278 UNHASHED_CONTROL_BLOCK_ID,
281 /// \brief Record types that occur within the control block.
282 enum ControlRecordTypes {
283 /// \brief AST file metadata, including the AST file version number
284 /// and information about the compiler used to build this AST file.
287 /// \brief Record code for the list of other AST files imported by
291 /// \brief Record code for the original file that was used to
292 /// generate the AST file, including both its file ID and its
296 /// \brief The directory that the PCH was originally created in.
299 /// \brief Record code for file ID of the file or buffer that was used to
300 /// generate the AST file.
303 /// \brief Offsets into the input-files block where input files
307 /// \brief Record code for the module name.
310 /// \brief Record code for the module map file that was used to build this
314 /// \brief Record code for the module build directory.
318 /// \brief Record types that occur within the options block inside
319 /// the control block.
320 enum OptionsRecordTypes {
321 /// \brief Record code for the language options table.
323 /// The record with this code contains the contents of the
324 /// LangOptions structure. We serialize the entire contents of
325 /// the structure, and let the reader decide which options are
326 /// actually important to check.
327 LANGUAGE_OPTIONS = 1,
329 /// \brief Record code for the target options table.
332 /// \brief Record code for the filesystem options table.
335 /// \brief Record code for the headers search options table.
336 HEADER_SEARCH_OPTIONS,
338 /// \brief Record code for the preprocessor options table.
339 PREPROCESSOR_OPTIONS,
342 /// Record codes for the unhashed control block.
343 enum UnhashedControlBlockRecordTypes {
344 /// Record code for the signature that identifiers this AST file.
347 /// Record code for the diagnostic options table.
350 /// Record code for \#pragma diagnostic mappings.
351 DIAG_PRAGMA_MAPPINGS,
354 /// \brief Record code for extension blocks.
355 enum ExtensionBlockRecordTypes {
356 /// Metadata describing this particular extension.
357 EXTENSION_METADATA = 1,
359 /// The first record ID allocated to the extensions themselves.
360 FIRST_EXTENSION_RECORD_ID = 4
363 /// \brief Record types that occur within the input-files block
364 /// inside the control block.
365 enum InputFileRecordTypes {
366 /// \brief An input file.
370 /// \brief Record types that occur within the AST block itself.
371 enum ASTRecordTypes {
372 /// \brief Record code for the offsets of each type.
374 /// The TYPE_OFFSET constant describes the record that occurs
375 /// within the AST block. The record itself is an array of offsets that
376 /// point into the declarations and types block (identified by
377 /// DECLTYPES_BLOCK_ID). The index into the array is based on the ID
378 /// of a type. For a given type ID @c T, the lower three bits of
379 /// @c T are its qualifiers (const, volatile, restrict), as in
380 /// the QualType class. The upper bits, after being shifted and
381 /// subtracting NUM_PREDEF_TYPE_IDS, are used to index into the
382 /// TYPE_OFFSET block to determine the offset of that type's
383 /// corresponding record within the DECLTYPES_BLOCK_ID block.
386 /// \brief Record code for the offsets of each decl.
388 /// The DECL_OFFSET constant describes the record that occurs
389 /// within the block identified by DECL_OFFSETS_BLOCK_ID within
390 /// the AST block. The record itself is an array of offsets that
391 /// point into the declarations and types block (identified by
392 /// DECLTYPES_BLOCK_ID). The declaration ID is an index into this
393 /// record, after subtracting one to account for the use of
394 /// declaration ID 0 for a NULL declaration pointer. Index 0 is
395 /// reserved for the translation unit declaration.
398 /// \brief Record code for the table of offsets of each
401 /// The offset table contains offsets into the blob stored in
402 /// the IDENTIFIER_TABLE record. Each offset points to the
403 /// NULL-terminated string that corresponds to that identifier.
404 IDENTIFIER_OFFSET = 3,
406 /// \brief This is so that older clang versions, before the introduction
407 /// of the control block, can read and reject the newer PCH format.
408 /// *DON'T CHANGE THIS NUMBER*.
409 METADATA_OLD_FORMAT = 4,
411 /// \brief Record code for the identifier table.
413 /// The identifier table is a simple blob that contains
414 /// NULL-terminated strings for all of the identifiers
415 /// referenced by the AST file. The IDENTIFIER_OFFSET table
416 /// contains the mapping from identifier IDs to the characters
417 /// in this blob. Note that the starting offsets of all of the
418 /// identifiers are odd, so that, when the identifier offset
419 /// table is loaded in, we can use the low bit to distinguish
420 /// between offsets (for unresolved identifier IDs) and
421 /// IdentifierInfo pointers (for already-resolved identifier
423 IDENTIFIER_TABLE = 5,
425 /// \brief Record code for the array of eagerly deserialized decls.
427 /// The AST file contains a list of all of the declarations that should be
428 /// eagerly deserialized present within the parsed headers, stored as an
429 /// array of declaration IDs. These declarations will be
430 /// reported to the AST consumer after the AST file has been
431 /// read, since their presence can affect the semantics of the
432 /// program (e.g., for code generation).
433 EAGERLY_DESERIALIZED_DECLS = 6,
435 /// \brief Record code for the set of non-builtin, special
438 /// This record contains the type IDs for the various type nodes
439 /// that are constructed during semantic analysis (e.g.,
440 /// __builtin_va_list). The SPECIAL_TYPE_* constants provide
441 /// offsets into this record.
444 /// \brief Record code for the extra statistics we gather while
445 /// generating an AST file.
448 /// \brief Record code for the array of tentative definitions.
449 TENTATIVE_DEFINITIONS = 9,
451 // ID 10 used to be for a list of extern "C" declarations.
453 /// \brief Record code for the table of offsets into the
454 /// Objective-C method pool.
455 SELECTOR_OFFSETS = 11,
457 /// \brief Record code for the Objective-C method pool,
460 /// \brief The value of the next __COUNTER__ to dispense.
461 /// [PP_COUNTER_VALUE, Val]
462 PP_COUNTER_VALUE = 13,
464 /// \brief Record code for the table of offsets into the block
465 /// of source-location information.
466 SOURCE_LOCATION_OFFSETS = 14,
468 /// \brief Record code for the set of source location entries
469 /// that need to be preloaded by the AST reader.
471 /// This set contains the source location entry for the
472 /// predefines buffer and for any file entries that need to be
474 SOURCE_LOCATION_PRELOADS = 15,
476 /// \brief Record code for the set of ext_vector type names.
477 EXT_VECTOR_DECLS = 16,
479 /// \brief Record code for the array of unused file scoped decls.
480 UNUSED_FILESCOPED_DECLS = 17,
482 /// \brief Record code for the table of offsets to entries in the
483 /// preprocessing record.
484 PPD_ENTITIES_OFFSETS = 18,
486 /// \brief Record code for the array of VTable uses.
489 // ID 20 used to be for a list of dynamic classes.
491 /// \brief Record code for referenced selector pool.
492 REFERENCED_SELECTOR_POOL = 21,
494 /// \brief Record code for an update to the TU's lexically contained
496 TU_UPDATE_LEXICAL = 22,
498 // ID 23 used to be for a list of local redeclarations.
500 /// \brief Record code for declarations that Sema keeps references of.
503 /// \brief Record code for weak undeclared identifiers.
504 WEAK_UNDECLARED_IDENTIFIERS = 25,
506 /// \brief Record code for pending implicit instantiations.
507 PENDING_IMPLICIT_INSTANTIATIONS = 26,
509 // ID 27 used to be for a list of replacement decls.
511 /// \brief Record code for an update to a decl context's lookup table.
513 /// In practice, this should only be used for the TU and namespaces.
516 /// \brief Record for offsets of DECL_UPDATES records for declarations
517 /// that were modified after being deserialized and need updates.
518 DECL_UPDATE_OFFSETS = 29,
520 // ID 30 used to be a decl update record. These are now in the DECLTYPES
523 // ID 31 used to be a list of offsets to DECL_CXX_BASE_SPECIFIERS records.
525 // ID 32 used to be the code for \#pragma diagnostic mappings.
527 /// \brief Record code for special CUDA declarations.
528 CUDA_SPECIAL_DECL_REFS = 33,
530 /// \brief Record code for header search information.
531 HEADER_SEARCH_TABLE = 34,
533 /// \brief Record code for floating point \#pragma options.
534 FP_PRAGMA_OPTIONS = 35,
536 /// \brief Record code for enabled OpenCL extensions.
537 OPENCL_EXTENSIONS = 36,
539 /// \brief The list of delegating constructor declarations.
540 DELEGATING_CTORS = 37,
542 /// \brief Record code for the set of known namespaces, which are used
543 /// for typo correction.
544 KNOWN_NAMESPACES = 38,
546 /// \brief Record code for the remapping information used to relate
547 /// loaded modules to the various offsets and IDs(e.g., source location
548 /// offests, declaration and type IDs) that are used in that module to
549 /// refer to other modules.
550 MODULE_OFFSET_MAP = 39,
552 /// \brief Record code for the source manager line table information,
553 /// which stores information about \#line directives.
554 SOURCE_MANAGER_LINE_TABLE = 40,
556 /// \brief Record code for map of Objective-C class definition IDs to the
557 /// ObjC categories in a module that are attached to that class.
558 OBJC_CATEGORIES_MAP = 41,
560 /// \brief Record code for a file sorted array of DeclIDs in a module.
561 FILE_SORTED_DECLS = 42,
563 /// \brief Record code for an array of all of the (sub)modules that were
564 /// imported by the AST file.
565 IMPORTED_MODULES = 43,
567 // ID 44 used to be a table of merged canonical declarations.
568 // ID 45 used to be a list of declaration IDs of local redeclarations.
570 /// \brief Record code for the array of Objective-C categories (including
573 /// This array can only be interpreted properly using the Objective-C
575 OBJC_CATEGORIES = 46,
577 /// \brief Record code for the table of offsets of each macro ID.
579 /// The offset table contains offsets into the blob stored in
580 /// the preprocessor block. Each offset points to the corresponding
581 /// macro definition.
584 /// \brief A list of "interesting" identifiers. Only used in C++ (where we
585 /// don't normally do lookups into the serialized identifier table). These
586 /// are eagerly deserialized.
587 INTERESTING_IDENTIFIERS = 48,
589 /// \brief Record code for undefined but used functions and variables that
590 /// need a definition in this TU.
591 UNDEFINED_BUT_USED = 49,
593 /// \brief Record code for late parsed template functions.
594 LATE_PARSED_TEMPLATE = 50,
596 /// \brief Record code for \#pragma optimize options.
597 OPTIMIZE_PRAGMA_OPTIONS = 51,
599 /// \brief Record code for potentially unused local typedef names.
600 UNUSED_LOCAL_TYPEDEF_NAME_CANDIDATES = 52,
602 // ID 53 used to be a table of constructor initializer records.
604 /// \brief Delete expressions that will be analyzed later.
605 DELETE_EXPRS_TO_ANALYZE = 54,
607 /// \brief Record code for \#pragma ms_struct options.
608 MSSTRUCT_PRAGMA_OPTIONS = 55,
610 /// \brief Record code for \#pragma ms_struct options.
611 POINTERS_TO_MEMBERS_PRAGMA_OPTIONS = 56,
613 /// \brief Number of unmatched #pragma clang cuda_force_host_device begin
614 /// directives we've seen.
615 CUDA_PRAGMA_FORCE_HOST_DEVICE_DEPTH = 57,
617 /// \brief Record code for types associated with OpenCL extensions.
618 OPENCL_EXTENSION_TYPES = 58,
620 /// \brief Record code for declarations associated with OpenCL extensions.
621 OPENCL_EXTENSION_DECLS = 59,
623 MODULAR_CODEGEN_DECLS = 60,
625 /// \brief Record code for \#pragma pack options.
626 PACK_PRAGMA_OPTIONS = 61,
628 /// \brief The stack of open #ifs/#ifdefs recorded in a preamble.
629 PP_CONDITIONAL_STACK = 62,
632 /// \brief Record types used within a source manager block.
633 enum SourceManagerRecordTypes {
634 /// \brief Describes a source location entry (SLocEntry) for a
636 SM_SLOC_FILE_ENTRY = 1,
638 /// \brief Describes a source location entry (SLocEntry) for a
640 SM_SLOC_BUFFER_ENTRY = 2,
642 /// \brief Describes a blob that contains the data for a buffer
643 /// entry. This kind of record always directly follows a
644 /// SM_SLOC_BUFFER_ENTRY record or a SM_SLOC_FILE_ENTRY with an
645 /// overridden buffer.
646 SM_SLOC_BUFFER_BLOB = 3,
648 /// \brief Describes a zlib-compressed blob that contains the data for
650 SM_SLOC_BUFFER_BLOB_COMPRESSED = 4,
652 /// \brief Describes a source location entry (SLocEntry) for a
654 SM_SLOC_EXPANSION_ENTRY = 5
657 /// \brief Record types used within a preprocessor block.
658 enum PreprocessorRecordTypes {
659 // The macros in the PP section are a PP_MACRO_* instance followed by a
660 // list of PP_TOKEN instances for each token in the definition.
662 /// \brief An object-like macro definition.
663 /// [PP_MACRO_OBJECT_LIKE, IdentInfoID, SLoc, IsUsed]
664 PP_MACRO_OBJECT_LIKE = 1,
666 /// \brief A function-like macro definition.
667 /// [PP_MACRO_FUNCTION_LIKE, \<ObjectLikeStuff>, IsC99Varargs,
668 /// IsGNUVarars, NumArgs, ArgIdentInfoID* ]
669 PP_MACRO_FUNCTION_LIKE = 2,
671 /// \brief Describes one token.
672 /// [PP_TOKEN, SLoc, Length, IdentInfoID, Kind, Flags]
675 /// \brief The macro directives history for a particular identifier.
676 PP_MACRO_DIRECTIVE_HISTORY = 4,
678 /// \brief A macro directive exported by a module.
679 /// [PP_MODULE_MACRO, SubmoduleID, MacroID, (Overridden SubmoduleID)*]
683 /// \brief Record types used within a preprocessor detail block.
684 enum PreprocessorDetailRecordTypes {
685 /// \brief Describes a macro expansion within the preprocessing record.
686 PPD_MACRO_EXPANSION = 0,
688 /// \brief Describes a macro definition within the preprocessing record.
689 PPD_MACRO_DEFINITION = 1,
691 /// \brief Describes an inclusion directive within the preprocessing
693 PPD_INCLUSION_DIRECTIVE = 2
696 /// \brief Record types used within a submodule description block.
697 enum SubmoduleRecordTypes {
698 /// \brief Metadata for submodules as a whole.
699 SUBMODULE_METADATA = 0,
701 /// \brief Defines the major attributes of a submodule, including its
703 SUBMODULE_DEFINITION = 1,
705 /// \brief Specifies the umbrella header used to create this module,
707 SUBMODULE_UMBRELLA_HEADER = 2,
709 /// \brief Specifies a header that falls into this (sub)module.
710 SUBMODULE_HEADER = 3,
712 /// \brief Specifies a top-level header that falls into this (sub)module.
713 SUBMODULE_TOPHEADER = 4,
715 /// \brief Specifies an umbrella directory.
716 SUBMODULE_UMBRELLA_DIR = 5,
718 /// \brief Specifies the submodules that are imported by this
720 SUBMODULE_IMPORTS = 6,
722 /// \brief Specifies the submodules that are re-exported from this
724 SUBMODULE_EXPORTS = 7,
726 /// \brief Specifies a required feature.
727 SUBMODULE_REQUIRES = 8,
729 /// \brief Specifies a header that has been explicitly excluded
730 /// from this submodule.
731 SUBMODULE_EXCLUDED_HEADER = 9,
733 /// \brief Specifies a library or framework to link against.
734 SUBMODULE_LINK_LIBRARY = 10,
736 /// \brief Specifies a configuration macro for this module.
737 SUBMODULE_CONFIG_MACRO = 11,
739 /// \brief Specifies a conflict with another module.
740 SUBMODULE_CONFLICT = 12,
742 /// \brief Specifies a header that is private to this submodule.
743 SUBMODULE_PRIVATE_HEADER = 13,
745 /// \brief Specifies a header that is part of the module but must be
746 /// textually included.
747 SUBMODULE_TEXTUAL_HEADER = 14,
749 /// \brief Specifies a header that is private to this submodule but
750 /// must be textually included.
751 SUBMODULE_PRIVATE_TEXTUAL_HEADER = 15,
753 /// \brief Specifies some declarations with initializers that must be
754 /// emitted to initialize the module.
755 SUBMODULE_INITIALIZERS = 16,
757 /// \brief Specifies the name of the module that will eventually
758 /// re-export the entities in this module.
759 SUBMODULE_EXPORT_AS = 17,
762 /// \brief Record types used within a comments block.
763 enum CommentRecordTypes {
764 COMMENTS_RAW_COMMENT = 0
767 /// \defgroup ASTAST AST file AST constants
769 /// The constants in this group describe various components of the
770 /// abstract syntax tree within an AST file.
774 /// \brief Predefined type IDs.
776 /// These type IDs correspond to predefined types in the AST
777 /// context, such as built-in types (int) and special place-holder
778 /// types (the \<overload> and \<dependent> type markers). Such
779 /// types are never actually serialized, since they will be built
780 /// by the AST context when it is created.
781 enum PredefinedTypeIDs {
782 /// \brief The NULL type.
783 PREDEF_TYPE_NULL_ID = 0,
785 /// \brief The void type.
786 PREDEF_TYPE_VOID_ID = 1,
788 /// \brief The 'bool' or '_Bool' type.
789 PREDEF_TYPE_BOOL_ID = 2,
791 /// \brief The 'char' type, when it is unsigned.
792 PREDEF_TYPE_CHAR_U_ID = 3,
794 /// \brief The 'unsigned char' type.
795 PREDEF_TYPE_UCHAR_ID = 4,
797 /// \brief The 'unsigned short' type.
798 PREDEF_TYPE_USHORT_ID = 5,
800 /// \brief The 'unsigned int' type.
801 PREDEF_TYPE_UINT_ID = 6,
803 /// \brief The 'unsigned long' type.
804 PREDEF_TYPE_ULONG_ID = 7,
806 /// \brief The 'unsigned long long' type.
807 PREDEF_TYPE_ULONGLONG_ID = 8,
809 /// \brief The 'char' type, when it is signed.
810 PREDEF_TYPE_CHAR_S_ID = 9,
812 /// \brief The 'signed char' type.
813 PREDEF_TYPE_SCHAR_ID = 10,
815 /// \brief The C++ 'wchar_t' type.
816 PREDEF_TYPE_WCHAR_ID = 11,
818 /// \brief The (signed) 'short' type.
819 PREDEF_TYPE_SHORT_ID = 12,
821 /// \brief The (signed) 'int' type.
822 PREDEF_TYPE_INT_ID = 13,
824 /// \brief The (signed) 'long' type.
825 PREDEF_TYPE_LONG_ID = 14,
827 /// \brief The (signed) 'long long' type.
828 PREDEF_TYPE_LONGLONG_ID = 15,
830 /// \brief The 'float' type.
831 PREDEF_TYPE_FLOAT_ID = 16,
833 /// \brief The 'double' type.
834 PREDEF_TYPE_DOUBLE_ID = 17,
836 /// \brief The 'long double' type.
837 PREDEF_TYPE_LONGDOUBLE_ID = 18,
839 /// \brief The placeholder type for overloaded function sets.
840 PREDEF_TYPE_OVERLOAD_ID = 19,
842 /// \brief The placeholder type for dependent types.
843 PREDEF_TYPE_DEPENDENT_ID = 20,
845 /// \brief The '__uint128_t' type.
846 PREDEF_TYPE_UINT128_ID = 21,
848 /// \brief The '__int128_t' type.
849 PREDEF_TYPE_INT128_ID = 22,
851 /// \brief The type of 'nullptr'.
852 PREDEF_TYPE_NULLPTR_ID = 23,
854 /// \brief The C++ 'char16_t' type.
855 PREDEF_TYPE_CHAR16_ID = 24,
857 /// \brief The C++ 'char32_t' type.
858 PREDEF_TYPE_CHAR32_ID = 25,
860 /// \brief The ObjC 'id' type.
861 PREDEF_TYPE_OBJC_ID = 26,
863 /// \brief The ObjC 'Class' type.
864 PREDEF_TYPE_OBJC_CLASS = 27,
866 /// \brief The ObjC 'SEL' type.
867 PREDEF_TYPE_OBJC_SEL = 28,
869 /// \brief The 'unknown any' placeholder type.
870 PREDEF_TYPE_UNKNOWN_ANY = 29,
872 /// \brief The placeholder type for bound member functions.
873 PREDEF_TYPE_BOUND_MEMBER = 30,
875 /// \brief The "auto" deduction type.
876 PREDEF_TYPE_AUTO_DEDUCT = 31,
878 /// \brief The "auto &&" deduction type.
879 PREDEF_TYPE_AUTO_RREF_DEDUCT = 32,
881 /// \brief The OpenCL 'half' / ARM NEON __fp16 type.
882 PREDEF_TYPE_HALF_ID = 33,
884 /// \brief ARC's unbridged-cast placeholder type.
885 PREDEF_TYPE_ARC_UNBRIDGED_CAST = 34,
887 /// \brief The pseudo-object placeholder type.
888 PREDEF_TYPE_PSEUDO_OBJECT = 35,
890 /// \brief The placeholder type for builtin functions.
891 PREDEF_TYPE_BUILTIN_FN = 36,
893 /// \brief OpenCL event type.
894 PREDEF_TYPE_EVENT_ID = 37,
896 /// \brief OpenCL clk event type.
897 PREDEF_TYPE_CLK_EVENT_ID = 38,
899 /// \brief OpenCL sampler type.
900 PREDEF_TYPE_SAMPLER_ID = 39,
902 /// \brief OpenCL queue type.
903 PREDEF_TYPE_QUEUE_ID = 40,
905 /// \brief OpenCL reserve_id type.
906 PREDEF_TYPE_RESERVE_ID_ID = 41,
908 /// \brief The placeholder type for OpenMP array section.
909 PREDEF_TYPE_OMP_ARRAY_SECTION = 42,
911 /// \brief The '__float128' type
912 PREDEF_TYPE_FLOAT128_ID = 43,
914 /// \brief The '_Float16' type
915 PREDEF_TYPE_FLOAT16_ID = 44,
917 /// \brief OpenCL image types with auto numeration
918 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
919 PREDEF_TYPE_##Id##_ID,
920 #include "clang/Basic/OpenCLImageTypes.def"
923 /// \brief The number of predefined type IDs that are reserved for
924 /// the PREDEF_TYPE_* constants.
926 /// Type IDs for non-predefined types will start at
927 /// NUM_PREDEF_TYPE_IDs.
928 const unsigned NUM_PREDEF_TYPE_IDS = 100;
930 /// \brief Record codes for each kind of type.
932 /// These constants describe the type records that can occur within a
933 /// block identified by DECLTYPES_BLOCK_ID in the AST file. Each
934 /// constant describes a record for a specific type class in the
935 /// AST. Note that DeclCode values share this code space.
937 /// \brief An ExtQualType record.
940 /// \brief A ComplexType record.
943 /// \brief A PointerType record.
946 /// \brief A BlockPointerType record.
947 TYPE_BLOCK_POINTER = 5,
949 /// \brief An LValueReferenceType record.
950 TYPE_LVALUE_REFERENCE = 6,
952 /// \brief An RValueReferenceType record.
953 TYPE_RVALUE_REFERENCE = 7,
955 /// \brief A MemberPointerType record.
956 TYPE_MEMBER_POINTER = 8,
958 /// \brief A ConstantArrayType record.
959 TYPE_CONSTANT_ARRAY = 9,
961 /// \brief An IncompleteArrayType record.
962 TYPE_INCOMPLETE_ARRAY = 10,
964 /// \brief A VariableArrayType record.
965 TYPE_VARIABLE_ARRAY = 11,
967 /// \brief A VectorType record.
970 /// \brief An ExtVectorType record.
971 TYPE_EXT_VECTOR = 13,
973 /// \brief A FunctionNoProtoType record.
974 TYPE_FUNCTION_NO_PROTO = 14,
976 /// \brief A FunctionProtoType record.
977 TYPE_FUNCTION_PROTO = 15,
979 /// \brief A TypedefType record.
982 /// \brief A TypeOfExprType record.
983 TYPE_TYPEOF_EXPR = 17,
985 /// \brief A TypeOfType record.
988 /// \brief A RecordType record.
991 /// \brief An EnumType record.
994 /// \brief An ObjCInterfaceType record.
995 TYPE_OBJC_INTERFACE = 21,
997 /// \brief An ObjCObjectPointerType record.
998 TYPE_OBJC_OBJECT_POINTER = 22,
1000 /// \brief a DecltypeType record.
1003 /// \brief An ElaboratedType record.
1004 TYPE_ELABORATED = 24,
1006 /// \brief A SubstTemplateTypeParmType record.
1007 TYPE_SUBST_TEMPLATE_TYPE_PARM = 25,
1009 /// \brief An UnresolvedUsingType record.
1010 TYPE_UNRESOLVED_USING = 26,
1012 /// \brief An InjectedClassNameType record.
1013 TYPE_INJECTED_CLASS_NAME = 27,
1015 /// \brief An ObjCObjectType record.
1016 TYPE_OBJC_OBJECT = 28,
1018 /// \brief An TemplateTypeParmType record.
1019 TYPE_TEMPLATE_TYPE_PARM = 29,
1021 /// \brief An TemplateSpecializationType record.
1022 TYPE_TEMPLATE_SPECIALIZATION = 30,
1024 /// \brief A DependentNameType record.
1025 TYPE_DEPENDENT_NAME = 31,
1027 /// \brief A DependentTemplateSpecializationType record.
1028 TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION = 32,
1030 /// \brief A DependentSizedArrayType record.
1031 TYPE_DEPENDENT_SIZED_ARRAY = 33,
1033 /// \brief A ParenType record.
1036 /// \brief A PackExpansionType record.
1037 TYPE_PACK_EXPANSION = 35,
1039 /// \brief An AttributedType record.
1040 TYPE_ATTRIBUTED = 36,
1042 /// \brief A SubstTemplateTypeParmPackType record.
1043 TYPE_SUBST_TEMPLATE_TYPE_PARM_PACK = 37,
1045 /// \brief A AutoType record.
1048 /// \brief A UnaryTransformType record.
1049 TYPE_UNARY_TRANSFORM = 39,
1051 /// \brief An AtomicType record.
1054 /// \brief A DecayedType record.
1057 /// \brief An AdjustedType record.
1060 /// \brief A PipeType record.
1063 /// \brief An ObjCTypeParamType record.
1064 TYPE_OBJC_TYPE_PARAM = 44,
1066 /// \brief A DeducedTemplateSpecializationType record.
1067 TYPE_DEDUCED_TEMPLATE_SPECIALIZATION = 45,
1069 /// \brief A DependentSizedExtVectorType record.
1070 TYPE_DEPENDENT_SIZED_EXT_VECTOR = 46,
1072 /// \brief A DependentAddressSpaceType record.
1073 TYPE_DEPENDENT_ADDRESS_SPACE = 47
1076 /// \brief The type IDs for special types constructed by semantic
1079 /// The constants in this enumeration are indices into the
1080 /// SPECIAL_TYPES record.
1081 enum SpecialTypeIDs {
1082 /// \brief CFConstantString type
1083 SPECIAL_TYPE_CF_CONSTANT_STRING = 0,
1085 /// \brief C FILE typedef type
1086 SPECIAL_TYPE_FILE = 1,
1088 /// \brief C jmp_buf typedef type
1089 SPECIAL_TYPE_JMP_BUF = 2,
1091 /// \brief C sigjmp_buf typedef type
1092 SPECIAL_TYPE_SIGJMP_BUF = 3,
1094 /// \brief Objective-C "id" redefinition type
1095 SPECIAL_TYPE_OBJC_ID_REDEFINITION = 4,
1097 /// \brief Objective-C "Class" redefinition type
1098 SPECIAL_TYPE_OBJC_CLASS_REDEFINITION = 5,
1100 /// \brief Objective-C "SEL" redefinition type
1101 SPECIAL_TYPE_OBJC_SEL_REDEFINITION = 6,
1103 /// \brief C ucontext_t typedef type
1104 SPECIAL_TYPE_UCONTEXT_T = 7
1107 /// \brief The number of special type IDs.
1108 const unsigned NumSpecialTypeIDs = 8;
1110 /// \brief Predefined declaration IDs.
1112 /// These declaration IDs correspond to predefined declarations in the AST
1113 /// context, such as the NULL declaration ID. Such declarations are never
1114 /// actually serialized, since they will be built by the AST context when
1116 enum PredefinedDeclIDs {
1117 /// \brief The NULL declaration.
1118 PREDEF_DECL_NULL_ID = 0,
1120 /// \brief The translation unit.
1121 PREDEF_DECL_TRANSLATION_UNIT_ID = 1,
1123 /// \brief The Objective-C 'id' type.
1124 PREDEF_DECL_OBJC_ID_ID = 2,
1126 /// \brief The Objective-C 'SEL' type.
1127 PREDEF_DECL_OBJC_SEL_ID = 3,
1129 /// \brief The Objective-C 'Class' type.
1130 PREDEF_DECL_OBJC_CLASS_ID = 4,
1132 /// \brief The Objective-C 'Protocol' type.
1133 PREDEF_DECL_OBJC_PROTOCOL_ID = 5,
1135 /// \brief The signed 128-bit integer type.
1136 PREDEF_DECL_INT_128_ID = 6,
1138 /// \brief The unsigned 128-bit integer type.
1139 PREDEF_DECL_UNSIGNED_INT_128_ID = 7,
1141 /// \brief The internal 'instancetype' typedef.
1142 PREDEF_DECL_OBJC_INSTANCETYPE_ID = 8,
1144 /// \brief The internal '__builtin_va_list' typedef.
1145 PREDEF_DECL_BUILTIN_VA_LIST_ID = 9,
1147 /// \brief The internal '__va_list_tag' struct, if any.
1148 PREDEF_DECL_VA_LIST_TAG = 10,
1150 /// \brief The internal '__builtin_ms_va_list' typedef.
1151 PREDEF_DECL_BUILTIN_MS_VA_LIST_ID = 11,
1153 /// \brief The extern "C" context.
1154 PREDEF_DECL_EXTERN_C_CONTEXT_ID = 12,
1156 /// \brief The internal '__make_integer_seq' template.
1157 PREDEF_DECL_MAKE_INTEGER_SEQ_ID = 13,
1159 /// \brief The internal '__NSConstantString' typedef.
1160 PREDEF_DECL_CF_CONSTANT_STRING_ID = 14,
1162 /// \brief The internal '__NSConstantString' tag type.
1163 PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID = 15,
1165 /// \brief The internal '__type_pack_element' template.
1166 PREDEF_DECL_TYPE_PACK_ELEMENT_ID = 16,
1169 /// \brief The number of declaration IDs that are predefined.
1171 /// For more information about predefined declarations, see the
1172 /// \c PredefinedDeclIDs type and the PREDEF_DECL_*_ID constants.
1173 const unsigned int NUM_PREDEF_DECL_IDS = 17;
1175 /// \brief Record of updates for a declaration that was modified after
1176 /// being deserialized. This can occur within DECLTYPES_BLOCK_ID.
1177 const unsigned int DECL_UPDATES = 49;
1179 /// \brief Record code for a list of local redeclarations of a declaration.
1180 /// This can occur within DECLTYPES_BLOCK_ID.
1181 const unsigned int LOCAL_REDECLARATIONS = 50;
1183 /// \brief Record codes for each kind of declaration.
1185 /// These constants describe the declaration records that can occur within
1186 /// a declarations block (identified by DECLTYPES_BLOCK_ID). Each
1187 /// constant describes a record for a specific declaration class
1188 /// in the AST. Note that TypeCode values share this code space.
1190 /// \brief A TypedefDecl record.
1192 /// \brief A TypeAliasDecl record.
1196 /// \brief An EnumDecl record.
1199 /// \brief A RecordDecl record.
1202 /// \brief An EnumConstantDecl record.
1205 /// \brief A FunctionDecl record.
1208 /// \brief A ObjCMethodDecl record.
1211 /// \brief A ObjCInterfaceDecl record.
1212 DECL_OBJC_INTERFACE,
1214 /// \brief A ObjCProtocolDecl record.
1217 /// \brief A ObjCIvarDecl record.
1220 /// \brief A ObjCAtDefsFieldDecl record.
1221 DECL_OBJC_AT_DEFS_FIELD,
1223 /// \brief A ObjCCategoryDecl record.
1226 /// \brief A ObjCCategoryImplDecl record.
1227 DECL_OBJC_CATEGORY_IMPL,
1229 /// \brief A ObjCImplementationDecl record.
1230 DECL_OBJC_IMPLEMENTATION,
1232 /// \brief A ObjCCompatibleAliasDecl record.
1233 DECL_OBJC_COMPATIBLE_ALIAS,
1235 /// \brief A ObjCPropertyDecl record.
1238 /// \brief A ObjCPropertyImplDecl record.
1239 DECL_OBJC_PROPERTY_IMPL,
1241 /// \brief A FieldDecl record.
1244 /// \brief A MSPropertyDecl record.
1247 /// \brief A VarDecl record.
1250 /// \brief An ImplicitParamDecl record.
1251 DECL_IMPLICIT_PARAM,
1253 /// \brief A ParmVarDecl record.
1256 /// \brief A DecompositionDecl record.
1259 /// \brief A BindingDecl record.
1262 /// \brief A FileScopeAsmDecl record.
1263 DECL_FILE_SCOPE_ASM,
1265 /// \brief A BlockDecl record.
1268 /// \brief A CapturedDecl record.
1271 /// \brief A record that stores the set of declarations that are
1272 /// lexically stored within a given DeclContext.
1274 /// The record itself is a blob that is an array of declaration IDs,
1275 /// in the order in which those declarations were added to the
1276 /// declaration context. This data is used when iterating over
1277 /// the contents of a DeclContext, e.g., via
1278 /// DeclContext::decls_begin() and DeclContext::decls_end().
1279 DECL_CONTEXT_LEXICAL,
1281 /// \brief A record that stores the set of declarations that are
1282 /// visible from a given DeclContext.
1284 /// The record itself stores a set of mappings, each of which
1285 /// associates a declaration name with one or more declaration
1286 /// IDs. This data is used when performing qualified name lookup
1287 /// into a DeclContext via DeclContext::lookup.
1288 DECL_CONTEXT_VISIBLE,
1290 /// \brief A LabelDecl record.
1293 /// \brief A NamespaceDecl record.
1296 /// \brief A NamespaceAliasDecl record.
1297 DECL_NAMESPACE_ALIAS,
1299 /// \brief A UsingDecl record.
1302 /// \brief A UsingPackDecl record.
1305 /// \brief A UsingShadowDecl record.
1308 /// \brief A ConstructorUsingShadowDecl record.
1309 DECL_CONSTRUCTOR_USING_SHADOW,
1311 /// \brief A UsingDirecitveDecl record.
1312 DECL_USING_DIRECTIVE,
1314 /// \brief An UnresolvedUsingValueDecl record.
1315 DECL_UNRESOLVED_USING_VALUE,
1317 /// \brief An UnresolvedUsingTypenameDecl record.
1318 DECL_UNRESOLVED_USING_TYPENAME,
1320 /// \brief A LinkageSpecDecl record.
1323 /// \brief An ExportDecl record.
1326 /// \brief A CXXRecordDecl record.
1329 /// \brief A CXXDeductionGuideDecl record.
1330 DECL_CXX_DEDUCTION_GUIDE,
1332 /// \brief A CXXMethodDecl record.
1335 /// \brief A CXXConstructorDecl record.
1336 DECL_CXX_CONSTRUCTOR,
1338 /// \brief A CXXConstructorDecl record for an inherited constructor.
1339 DECL_CXX_INHERITED_CONSTRUCTOR,
1341 /// \brief A CXXDestructorDecl record.
1342 DECL_CXX_DESTRUCTOR,
1344 /// \brief A CXXConversionDecl record.
1345 DECL_CXX_CONVERSION,
1347 /// \brief An AccessSpecDecl record.
1350 /// \brief A FriendDecl record.
1353 /// \brief A FriendTemplateDecl record.
1354 DECL_FRIEND_TEMPLATE,
1356 /// \brief A ClassTemplateDecl record.
1357 DECL_CLASS_TEMPLATE,
1359 /// \brief A ClassTemplateSpecializationDecl record.
1360 DECL_CLASS_TEMPLATE_SPECIALIZATION,
1362 /// \brief A ClassTemplatePartialSpecializationDecl record.
1363 DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION,
1365 /// \brief A VarTemplateDecl record.
1368 /// \brief A VarTemplateSpecializationDecl record.
1369 DECL_VAR_TEMPLATE_SPECIALIZATION,
1371 /// \brief A VarTemplatePartialSpecializationDecl record.
1372 DECL_VAR_TEMPLATE_PARTIAL_SPECIALIZATION,
1374 /// \brief A FunctionTemplateDecl record.
1375 DECL_FUNCTION_TEMPLATE,
1377 /// \brief A TemplateTypeParmDecl record.
1378 DECL_TEMPLATE_TYPE_PARM,
1380 /// \brief A NonTypeTemplateParmDecl record.
1381 DECL_NON_TYPE_TEMPLATE_PARM,
1383 /// \brief A TemplateTemplateParmDecl record.
1384 DECL_TEMPLATE_TEMPLATE_PARM,
1386 /// \brief A TypeAliasTemplateDecl record.
1387 DECL_TYPE_ALIAS_TEMPLATE,
1389 /// \brief A StaticAssertDecl record.
1392 /// \brief A record containing CXXBaseSpecifiers.
1393 DECL_CXX_BASE_SPECIFIERS,
1395 /// \brief A record containing CXXCtorInitializers.
1396 DECL_CXX_CTOR_INITIALIZERS,
1398 /// \brief A IndirectFieldDecl record.
1401 /// \brief A NonTypeTemplateParmDecl record that stores an expanded
1402 /// non-type template parameter pack.
1403 DECL_EXPANDED_NON_TYPE_TEMPLATE_PARM_PACK,
1405 /// \brief A TemplateTemplateParmDecl record that stores an expanded
1406 /// template template parameter pack.
1407 DECL_EXPANDED_TEMPLATE_TEMPLATE_PARM_PACK,
1409 /// \brief A ClassScopeFunctionSpecializationDecl record a class scope
1410 /// function specialization. (Microsoft extension).
1411 DECL_CLASS_SCOPE_FUNCTION_SPECIALIZATION,
1413 /// \brief An ImportDecl recording a module import.
1416 /// \brief An OMPThreadPrivateDecl record.
1417 DECL_OMP_THREADPRIVATE,
1419 /// \brief An EmptyDecl record.
1422 /// \brief An ObjCTypeParamDecl record.
1423 DECL_OBJC_TYPE_PARAM,
1425 /// \brief An OMPCapturedExprDecl record.
1426 DECL_OMP_CAPTUREDEXPR,
1428 /// \brief A PragmaCommentDecl record.
1429 DECL_PRAGMA_COMMENT,
1431 /// \brief A PragmaDetectMismatchDecl record.
1432 DECL_PRAGMA_DETECT_MISMATCH,
1434 /// \brief An OMPDeclareReductionDecl record.
1435 DECL_OMP_DECLARE_REDUCTION,
1438 /// \brief Record codes for each kind of statement or expression.
1440 /// These constants describe the records that describe statements
1441 /// or expressions. These records occur within type and declarations
1442 /// block, so they begin with record values of 128. Each constant
1443 /// describes a record for a specific statement or expression class in the
1446 /// \brief A marker record that indicates that we are at the end
1447 /// of an expression.
1450 /// \brief A NULL expression.
1453 /// \brief A reference to a previously [de]serialized Stmt record.
1456 /// \brief A NullStmt record.
1459 /// \brief A CompoundStmt record.
1462 /// \brief A CaseStmt record.
1465 /// \brief A DefaultStmt record.
1468 /// \brief A LabelStmt record.
1471 /// \brief An AttributedStmt record.
1474 /// \brief An IfStmt record.
1477 /// \brief A SwitchStmt record.
1480 /// \brief A WhileStmt record.
1483 /// \brief A DoStmt record.
1486 /// \brief A ForStmt record.
1489 /// \brief A GotoStmt record.
1492 /// \brief An IndirectGotoStmt record.
1495 /// \brief A ContinueStmt record.
1498 /// \brief A BreakStmt record.
1501 /// \brief A ReturnStmt record.
1504 /// \brief A DeclStmt record.
1507 /// \brief A CapturedStmt record.
1510 /// \brief A GCC-style AsmStmt record.
1513 /// \brief A MS-style AsmStmt record.
1516 /// \brief A PredefinedExpr record.
1519 /// \brief A DeclRefExpr record.
1522 /// \brief An IntegerLiteral record.
1523 EXPR_INTEGER_LITERAL,
1525 /// \brief A FloatingLiteral record.
1526 EXPR_FLOATING_LITERAL,
1528 /// \brief An ImaginaryLiteral record.
1529 EXPR_IMAGINARY_LITERAL,
1531 /// \brief A StringLiteral record.
1532 EXPR_STRING_LITERAL,
1534 /// \brief A CharacterLiteral record.
1535 EXPR_CHARACTER_LITERAL,
1537 /// \brief A ParenExpr record.
1540 /// \brief A ParenListExpr record.
1543 /// \brief A UnaryOperator record.
1544 EXPR_UNARY_OPERATOR,
1546 /// \brief An OffsetOfExpr record.
1549 /// \brief A SizefAlignOfExpr record.
1550 EXPR_SIZEOF_ALIGN_OF,
1552 /// \brief An ArraySubscriptExpr record.
1553 EXPR_ARRAY_SUBSCRIPT,
1555 /// \brief A CallExpr record.
1558 /// \brief A MemberExpr record.
1561 /// \brief A BinaryOperator record.
1562 EXPR_BINARY_OPERATOR,
1564 /// \brief A CompoundAssignOperator record.
1565 EXPR_COMPOUND_ASSIGN_OPERATOR,
1567 /// \brief A ConditionOperator record.
1568 EXPR_CONDITIONAL_OPERATOR,
1570 /// \brief An ImplicitCastExpr record.
1573 /// \brief A CStyleCastExpr record.
1576 /// \brief A CompoundLiteralExpr record.
1577 EXPR_COMPOUND_LITERAL,
1579 /// \brief An ExtVectorElementExpr record.
1580 EXPR_EXT_VECTOR_ELEMENT,
1582 /// \brief An InitListExpr record.
1585 /// \brief A DesignatedInitExpr record.
1586 EXPR_DESIGNATED_INIT,
1588 /// \brief A DesignatedInitUpdateExpr record.
1589 EXPR_DESIGNATED_INIT_UPDATE,
1591 /// \brief An NoInitExpr record.
1594 /// \brief An ArrayInitLoopExpr record.
1595 EXPR_ARRAY_INIT_LOOP,
1597 /// \brief An ArrayInitIndexExpr record.
1598 EXPR_ARRAY_INIT_INDEX,
1600 /// \brief An ImplicitValueInitExpr record.
1601 EXPR_IMPLICIT_VALUE_INIT,
1603 /// \brief A VAArgExpr record.
1606 /// \brief An AddrLabelExpr record.
1609 /// \brief A StmtExpr record.
1612 /// \brief A ChooseExpr record.
1615 /// \brief A GNUNullExpr record.
1618 /// \brief A ShuffleVectorExpr record.
1619 EXPR_SHUFFLE_VECTOR,
1621 /// \brief A ConvertVectorExpr record.
1622 EXPR_CONVERT_VECTOR,
1624 /// \brief BlockExpr
1627 /// \brief A GenericSelectionExpr record.
1628 EXPR_GENERIC_SELECTION,
1630 /// \brief A PseudoObjectExpr record.
1633 /// \brief An AtomicExpr record.
1638 /// \brief An ObjCStringLiteral record.
1639 EXPR_OBJC_STRING_LITERAL,
1641 EXPR_OBJC_BOXED_EXPRESSION,
1642 EXPR_OBJC_ARRAY_LITERAL,
1643 EXPR_OBJC_DICTIONARY_LITERAL,
1645 /// \brief An ObjCEncodeExpr record.
1648 /// \brief An ObjCSelectorExpr record.
1649 EXPR_OBJC_SELECTOR_EXPR,
1651 /// \brief An ObjCProtocolExpr record.
1652 EXPR_OBJC_PROTOCOL_EXPR,
1654 /// \brief An ObjCIvarRefExpr record.
1655 EXPR_OBJC_IVAR_REF_EXPR,
1657 /// \brief An ObjCPropertyRefExpr record.
1658 EXPR_OBJC_PROPERTY_REF_EXPR,
1660 /// \brief An ObjCSubscriptRefExpr record.
1661 EXPR_OBJC_SUBSCRIPT_REF_EXPR,
1664 EXPR_OBJC_KVC_REF_EXPR,
1666 /// \brief An ObjCMessageExpr record.
1667 EXPR_OBJC_MESSAGE_EXPR,
1669 /// \brief An ObjCIsa Expr record.
1672 /// \brief An ObjCIndirectCopyRestoreExpr record.
1673 EXPR_OBJC_INDIRECT_COPY_RESTORE,
1675 /// \brief An ObjCForCollectionStmt record.
1676 STMT_OBJC_FOR_COLLECTION,
1678 /// \brief An ObjCAtCatchStmt record.
1681 /// \brief An ObjCAtFinallyStmt record.
1684 /// \brief An ObjCAtTryStmt record.
1687 /// \brief An ObjCAtSynchronizedStmt record.
1688 STMT_OBJC_AT_SYNCHRONIZED,
1690 /// \brief An ObjCAtThrowStmt record.
1693 /// \brief An ObjCAutoreleasePoolStmt record.
1694 STMT_OBJC_AUTORELEASE_POOL,
1696 /// \brief An ObjCBoolLiteralExpr record.
1697 EXPR_OBJC_BOOL_LITERAL,
1699 /// \brief An ObjCAvailabilityCheckExpr record.
1700 EXPR_OBJC_AVAILABILITY_CHECK,
1704 /// \brief A CXXCatchStmt record.
1707 /// \brief A CXXTryStmt record.
1709 /// \brief A CXXForRangeStmt record.
1713 /// \brief A CXXOperatorCallExpr record.
1714 EXPR_CXX_OPERATOR_CALL,
1716 /// \brief A CXXMemberCallExpr record.
1717 EXPR_CXX_MEMBER_CALL,
1719 /// \brief A CXXConstructExpr record.
1722 /// \brief A CXXInheritedCtorInitExpr record.
1723 EXPR_CXX_INHERITED_CTOR_INIT,
1725 /// \brief A CXXTemporaryObjectExpr record.
1726 EXPR_CXX_TEMPORARY_OBJECT,
1728 /// \brief A CXXStaticCastExpr record.
1729 EXPR_CXX_STATIC_CAST,
1731 /// \brief A CXXDynamicCastExpr record.
1732 EXPR_CXX_DYNAMIC_CAST,
1734 /// \brief A CXXReinterpretCastExpr record.
1735 EXPR_CXX_REINTERPRET_CAST,
1737 /// \brief A CXXConstCastExpr record.
1738 EXPR_CXX_CONST_CAST,
1740 /// \brief A CXXFunctionalCastExpr record.
1741 EXPR_CXX_FUNCTIONAL_CAST,
1743 /// \brief A UserDefinedLiteral record.
1744 EXPR_USER_DEFINED_LITERAL,
1746 /// \brief A CXXStdInitializerListExpr record.
1747 EXPR_CXX_STD_INITIALIZER_LIST,
1749 /// \brief A CXXBoolLiteralExpr record.
1750 EXPR_CXX_BOOL_LITERAL,
1752 EXPR_CXX_NULL_PTR_LITERAL, // CXXNullPtrLiteralExpr
1753 EXPR_CXX_TYPEID_EXPR, // CXXTypeidExpr (of expr).
1754 EXPR_CXX_TYPEID_TYPE, // CXXTypeidExpr (of type).
1755 EXPR_CXX_THIS, // CXXThisExpr
1756 EXPR_CXX_THROW, // CXXThrowExpr
1757 EXPR_CXX_DEFAULT_ARG, // CXXDefaultArgExpr
1758 EXPR_CXX_DEFAULT_INIT, // CXXDefaultInitExpr
1759 EXPR_CXX_BIND_TEMPORARY, // CXXBindTemporaryExpr
1761 EXPR_CXX_SCALAR_VALUE_INIT, // CXXScalarValueInitExpr
1762 EXPR_CXX_NEW, // CXXNewExpr
1763 EXPR_CXX_DELETE, // CXXDeleteExpr
1764 EXPR_CXX_PSEUDO_DESTRUCTOR, // CXXPseudoDestructorExpr
1766 EXPR_EXPR_WITH_CLEANUPS, // ExprWithCleanups
1768 EXPR_CXX_DEPENDENT_SCOPE_MEMBER, // CXXDependentScopeMemberExpr
1769 EXPR_CXX_DEPENDENT_SCOPE_DECL_REF, // DependentScopeDeclRefExpr
1770 EXPR_CXX_UNRESOLVED_CONSTRUCT, // CXXUnresolvedConstructExpr
1771 EXPR_CXX_UNRESOLVED_MEMBER, // UnresolvedMemberExpr
1772 EXPR_CXX_UNRESOLVED_LOOKUP, // UnresolvedLookupExpr
1774 EXPR_CXX_EXPRESSION_TRAIT, // ExpressionTraitExpr
1775 EXPR_CXX_NOEXCEPT, // CXXNoexceptExpr
1777 EXPR_OPAQUE_VALUE, // OpaqueValueExpr
1778 EXPR_BINARY_CONDITIONAL_OPERATOR, // BinaryConditionalOperator
1779 EXPR_TYPE_TRAIT, // TypeTraitExpr
1780 EXPR_ARRAY_TYPE_TRAIT, // ArrayTypeTraitIntExpr
1782 EXPR_PACK_EXPANSION, // PackExpansionExpr
1783 EXPR_SIZEOF_PACK, // SizeOfPackExpr
1784 EXPR_SUBST_NON_TYPE_TEMPLATE_PARM, // SubstNonTypeTemplateParmExpr
1785 EXPR_SUBST_NON_TYPE_TEMPLATE_PARM_PACK,// SubstNonTypeTemplateParmPackExpr
1786 EXPR_FUNCTION_PARM_PACK, // FunctionParmPackExpr
1787 EXPR_MATERIALIZE_TEMPORARY, // MaterializeTemporaryExpr
1788 EXPR_CXX_FOLD, // CXXFoldExpr
1791 EXPR_CUDA_KERNEL_CALL, // CUDAKernelCallExpr
1794 EXPR_ASTYPE, // AsTypeExpr
1797 EXPR_CXX_PROPERTY_REF_EXPR, // MSPropertyRefExpr
1798 EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR, // MSPropertySubscriptExpr
1799 EXPR_CXX_UUIDOF_EXPR, // CXXUuidofExpr (of expr).
1800 EXPR_CXX_UUIDOF_TYPE, // CXXUuidofExpr (of type).
1801 STMT_SEH_LEAVE, // SEHLeaveStmt
1802 STMT_SEH_EXCEPT, // SEHExceptStmt
1803 STMT_SEH_FINALLY, // SEHFinallyStmt
1804 STMT_SEH_TRY, // SEHTryStmt
1806 // OpenMP directives
1807 STMT_OMP_PARALLEL_DIRECTIVE,
1808 STMT_OMP_SIMD_DIRECTIVE,
1809 STMT_OMP_FOR_DIRECTIVE,
1810 STMT_OMP_FOR_SIMD_DIRECTIVE,
1811 STMT_OMP_SECTIONS_DIRECTIVE,
1812 STMT_OMP_SECTION_DIRECTIVE,
1813 STMT_OMP_SINGLE_DIRECTIVE,
1814 STMT_OMP_MASTER_DIRECTIVE,
1815 STMT_OMP_CRITICAL_DIRECTIVE,
1816 STMT_OMP_PARALLEL_FOR_DIRECTIVE,
1817 STMT_OMP_PARALLEL_FOR_SIMD_DIRECTIVE,
1818 STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE,
1819 STMT_OMP_TASK_DIRECTIVE,
1820 STMT_OMP_TASKYIELD_DIRECTIVE,
1821 STMT_OMP_BARRIER_DIRECTIVE,
1822 STMT_OMP_TASKWAIT_DIRECTIVE,
1823 STMT_OMP_FLUSH_DIRECTIVE,
1824 STMT_OMP_ORDERED_DIRECTIVE,
1825 STMT_OMP_ATOMIC_DIRECTIVE,
1826 STMT_OMP_TARGET_DIRECTIVE,
1827 STMT_OMP_TARGET_DATA_DIRECTIVE,
1828 STMT_OMP_TARGET_ENTER_DATA_DIRECTIVE,
1829 STMT_OMP_TARGET_EXIT_DATA_DIRECTIVE,
1830 STMT_OMP_TARGET_PARALLEL_DIRECTIVE,
1831 STMT_OMP_TARGET_PARALLEL_FOR_DIRECTIVE,
1832 STMT_OMP_TEAMS_DIRECTIVE,
1833 STMT_OMP_TASKGROUP_DIRECTIVE,
1834 STMT_OMP_CANCELLATION_POINT_DIRECTIVE,
1835 STMT_OMP_CANCEL_DIRECTIVE,
1836 STMT_OMP_TASKLOOP_DIRECTIVE,
1837 STMT_OMP_TASKLOOP_SIMD_DIRECTIVE,
1838 STMT_OMP_DISTRIBUTE_DIRECTIVE,
1839 STMT_OMP_TARGET_UPDATE_DIRECTIVE,
1840 STMT_OMP_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE,
1841 STMT_OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE,
1842 STMT_OMP_DISTRIBUTE_SIMD_DIRECTIVE,
1843 STMT_OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE,
1844 STMT_OMP_TARGET_SIMD_DIRECTIVE,
1845 STMT_OMP_TEAMS_DISTRIBUTE_DIRECTIVE,
1846 STMT_OMP_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE,
1847 STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE,
1848 STMT_OMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE,
1849 STMT_OMP_TARGET_TEAMS_DIRECTIVE,
1850 STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE,
1851 STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE,
1852 STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE,
1853 STMT_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD_DIRECTIVE,
1854 EXPR_OMP_ARRAY_SECTION,
1857 EXPR_OBJC_BRIDGED_CAST, // ObjCBridgedCastExpr
1859 STMT_MS_DEPENDENT_EXISTS, // MSDependentExistsStmt
1860 EXPR_LAMBDA, // LambdaExpr
1861 STMT_COROUTINE_BODY,
1865 EXPR_DEPENDENT_COAWAIT,
1868 /// \brief The kinds of designators that can occur in a
1869 /// DesignatedInitExpr.
1870 enum DesignatorTypes {
1871 /// \brief Field designator where only the field name is known.
1872 DESIG_FIELD_NAME = 0,
1874 /// \brief Field designator where the field has been resolved to
1876 DESIG_FIELD_DECL = 1,
1878 /// \brief Array designator.
1881 /// \brief GNU array range designator.
1882 DESIG_ARRAY_RANGE = 3
1885 /// \brief The different kinds of data that can occur in a
1886 /// CtorInitializer.
1887 enum CtorInitializerType {
1888 CTOR_INITIALIZER_BASE,
1889 CTOR_INITIALIZER_DELEGATING,
1890 CTOR_INITIALIZER_MEMBER,
1891 CTOR_INITIALIZER_INDIRECT_MEMBER
1894 /// \brief Describes the redeclarations of a declaration.
1895 struct LocalRedeclarationsInfo {
1896 // The ID of the first declaration
1899 // Offset into the array of redeclaration chains.
1902 friend bool operator<(const LocalRedeclarationsInfo &X,
1903 const LocalRedeclarationsInfo &Y) {
1904 return X.FirstID < Y.FirstID;
1907 friend bool operator>(const LocalRedeclarationsInfo &X,
1908 const LocalRedeclarationsInfo &Y) {
1909 return X.FirstID > Y.FirstID;
1912 friend bool operator<=(const LocalRedeclarationsInfo &X,
1913 const LocalRedeclarationsInfo &Y) {
1914 return X.FirstID <= Y.FirstID;
1917 friend bool operator>=(const LocalRedeclarationsInfo &X,
1918 const LocalRedeclarationsInfo &Y) {
1919 return X.FirstID >= Y.FirstID;
1923 /// \brief Describes the categories of an Objective-C class.
1924 struct ObjCCategoriesInfo {
1925 // The ID of the definition
1926 DeclID DefinitionID;
1928 // Offset into the array of category lists.
1931 friend bool operator<(const ObjCCategoriesInfo &X,
1932 const ObjCCategoriesInfo &Y) {
1933 return X.DefinitionID < Y.DefinitionID;
1936 friend bool operator>(const ObjCCategoriesInfo &X,
1937 const ObjCCategoriesInfo &Y) {
1938 return X.DefinitionID > Y.DefinitionID;
1941 friend bool operator<=(const ObjCCategoriesInfo &X,
1942 const ObjCCategoriesInfo &Y) {
1943 return X.DefinitionID <= Y.DefinitionID;
1946 friend bool operator>=(const ObjCCategoriesInfo &X,
1947 const ObjCCategoriesInfo &Y) {
1948 return X.DefinitionID >= Y.DefinitionID;
1952 /// \brief A key used when looking up entities by \ref DeclarationName.
1954 /// Different \ref DeclarationNames are mapped to different keys, but the
1955 /// same key can occasionally represent multiple names (for names that
1956 /// contain types, in particular).
1957 class DeclarationNameKey {
1958 using NameKind = unsigned;
1964 DeclarationNameKey() = default;
1965 DeclarationNameKey(DeclarationName Name);
1966 DeclarationNameKey(NameKind Kind, uint64_t Data)
1967 : Kind(Kind), Data(Data) {}
1969 NameKind getKind() const { return Kind; }
1971 IdentifierInfo *getIdentifier() const {
1972 assert(Kind == DeclarationName::Identifier ||
1973 Kind == DeclarationName::CXXLiteralOperatorName ||
1974 Kind == DeclarationName::CXXDeductionGuideName);
1975 return (IdentifierInfo *)Data;
1978 Selector getSelector() const {
1979 assert(Kind == DeclarationName::ObjCZeroArgSelector ||
1980 Kind == DeclarationName::ObjCOneArgSelector ||
1981 Kind == DeclarationName::ObjCMultiArgSelector);
1982 return Selector(Data);
1985 OverloadedOperatorKind getOperatorKind() const {
1986 assert(Kind == DeclarationName::CXXOperatorName);
1987 return (OverloadedOperatorKind)Data;
1990 /// Compute a fingerprint of this key for use in on-disk hash table.
1991 unsigned getHash() const;
1993 friend bool operator==(const DeclarationNameKey &A,
1994 const DeclarationNameKey &B) {
1995 return A.Kind == B.Kind && A.Data == B.Data;
2001 } // namespace serialization
2002 } // namespace clang
2006 template <> struct DenseMapInfo<clang::serialization::DeclarationNameKey> {
2007 static clang::serialization::DeclarationNameKey getEmptyKey() {
2008 return clang::serialization::DeclarationNameKey(-1, 1);
2011 static clang::serialization::DeclarationNameKey getTombstoneKey() {
2012 return clang::serialization::DeclarationNameKey(-1, 2);
2016 getHashValue(const clang::serialization::DeclarationNameKey &Key) {
2017 return Key.getHash();
2020 static bool isEqual(const clang::serialization::DeclarationNameKey &L,
2021 const clang::serialization::DeclarationNameKey &R) {
2028 #endif // LLVM_CLANG_SERIALIZATION_ASTBITCODES_H