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