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