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

source code of clang/include/clang/Serialization/ASTBitCodes.h