Coverage Report

Created: 2021-09-21 08:58

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