Coverage Report

Created: 2022-05-14 11:35

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