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