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