clang 24.0.0git
ModuleFile.h
Go to the documentation of this file.
1//===- ModuleFile.h - Module file description -------------------*- 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 file defines the Module class, which describes a module that has
10// been loaded from an AST file.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_SERIALIZATION_MODULEFILE_H
15#define LLVM_CLANG_SERIALIZATION_MODULEFILE_H
16
18#include "clang/Basic/LLVM.h"
19#include "clang/Basic/Module.h"
24#include "llvm/ADT/BitVector.h"
25#include "llvm/ADT/DenseMap.h"
26#include "llvm/ADT/PointerIntPair.h"
27#include "llvm/ADT/SetVector.h"
28#include "llvm/ADT/SmallVector.h"
29#include "llvm/ADT/StringRef.h"
30#include "llvm/Bitstream/BitstreamReader.h"
31#include "llvm/Support/Endian.h"
32#include <cassert>
33#include <cstdint>
34#include <memory>
35#include <optional>
36#include <string>
37#include <vector>
38
39namespace clang {
40
41namespace serialization {
42
43/// Specifies the kind of module that has been loaded.
45 /// File is an implicitly-loaded module.
47
48 /// File is an explicitly-loaded module.
50
51 /// File is a PCH file treated as such.
53
54 /// File is a PCH file treated as the preamble.
56
57 /// File is a PCH file treated as the actual main file.
59
60 /// File is from a prebuilt module path.
62};
63
64/// The input file info that has been loaded from an AST file.
81
82/// The input file that has been loaded from this AST file, along with
83/// bools indicating whether this was an overridden buffer or if it was
84/// out-of-date or not-found.
85class InputFile {
86 enum {
87 Overridden = 1,
88 OutOfDate = 2,
89 NotFound = 3
90 };
91 llvm::PointerIntPair<const FileEntryRef::MapEntry *, 2, unsigned> Val;
92
93public:
94 InputFile() = default;
95
97 bool isOutOfDate = false) {
98 unsigned intVal = 0;
99 // Make isOutOfDate with higher priority than isOverridden.
100 // It is possible if the recorded hash value mismatches.
101 if (isOutOfDate)
102 intVal = OutOfDate;
103 else if (isOverridden)
104 intVal = Overridden;
105 Val.setPointerAndInt(&File.getMapEntry(), intVal);
106 }
107
110 File.Val.setInt(NotFound);
111 return File;
112 }
113
115 if (auto *P = Val.getPointer())
116 return FileEntryRef(*P);
117 return std::nullopt;
118 }
119 bool isOverridden() const { return Val.getInt() == Overridden; }
120 bool isOutOfDate() const { return Val.getInt() == OutOfDate; }
121 bool isNotFound() const { return Val.getInt() == NotFound; }
122};
123
124/// Describes a single change detected in a module file or input file.
125struct Change {
132 std::optional<int64_t> Old = std::nullopt;
133 std::optional<int64_t> New = std::nullopt;
134};
135
136/// Specifies the high-level result of validating input files.
138 /// Initial value, before the validation has been performed.
140 /// When the validation is disabled. For example, for a precompiled header.
142 /// When the validation is skipped because it was already done in the current
143 /// build session.
145 /// When the validation is done only for user files as an optimization.
147 /// When the validation is done both for user files and system files.
149};
150
151/// Information about a module that has been loaded by the ASTReader.
152///
153/// Each instance of the Module class corresponds to a single AST file, which
154/// may be a precompiled header, precompiled preamble, a module, or an AST file
155/// of some sort loaded as the main file, all of which are specific formulations
156/// of the general notion of a "module". A module may depend on any number of
157/// other modules.
159public:
166 ~ModuleFile();
167
168 // === General information ===
169
170 /// The index of this module in the list of modules.
171 unsigned Index = 0;
172
173 /// The type of this module.
175
176 /// The file name of the module file.
178
179 /// The key ModuleManager used for the module file.
181
182 /// The name of the module.
183 std::string ModuleName;
184
185 /// The base directory of the module.
186 std::string BaseDirectory;
187
188 static std::string getTimestampFilename(StringRef FileName) {
189 return (FileName + ".timestamp").str();
190 }
191
192 /// The original source file name that was used to build the
193 /// primary AST file, which may have been modified for
194 /// relocatable-pch support.
196
197 /// The actual original source file name that was used to
198 /// build this AST file.
200
201 /// The file ID for the original source file that was used to
202 /// build this AST file.
204
205 std::string ModuleMapPath;
206
207 /// Directories this module file depends on the listing of.
208 std::vector<std::string> DirectoryDependencies;
209
210 /// Whether this precompiled header is a relocatable PCH file.
211 bool RelocatablePCH = false;
212
213 /// Whether this module file is a standard C++ module.
214 bool StandardCXXModule = false;
215
216 /// Whether timestamps are included in this module file.
217 bool HasTimestamps = false;
218
219 /// Whether the top-level module has been read from the AST file.
221
222 /// Size of the module file.
223 off_t Size = 0;
224
225 /// Modification of the module file.
226 time_t ModTime = 0;
227
228 /// The signature of the module file, which may be used instead of the size
229 /// and modification time to identify this particular file.
231
232 /// The signature of the AST block of the module file, this can be used to
233 /// unique module files based on AST contents.
235
236 /// The bit vector denoting usage of each header search entry (true = used).
237 llvm::BitVector SearchPathUsage;
238
239 /// The bit vector denoting usage of each VFS entry (true = used).
240 llvm::BitVector VFSUsage;
241
242 /// Whether this module has been directly imported by the
243 /// user.
244 bool DirectlyImported = false;
245
246 /// The generation of which this module file is a part.
247 unsigned Generation;
248
249 /// The memory buffer that stores the data associated with
250 /// this AST file, owned by the InMemoryModuleCache.
251 llvm::MemoryBuffer *Buffer = nullptr;
252
253 /// The size of this file, in bits.
254 uint64_t SizeInBits = 0;
255
256 /// The global bit offset (or base) of this module
257 uint64_t GlobalBitOffset = 0;
258
259 /// The bit offset of the AST block of this module.
261
262 /// The serialized bitstream data for this file.
263 StringRef Data;
264
265 /// The main bitstream cursor for the main block.
266 llvm::BitstreamCursor Stream;
267
268 /// The source location where the module was explicitly or implicitly
269 /// imported in the local translation unit.
270 ///
271 /// If module A depends on and imports module B, both modules will have the
272 /// same DirectImportLoc, but different ImportLoc (B's ImportLoc will be a
273 /// source location inside module A).
274 ///
275 /// WARNING: This is largely useless. It doesn't tell you when a module was
276 /// made visible, just when the first submodule of that module was imported.
278
279 /// The source location where this module was first imported.
281
282 /// The first source location in this module.
284
285 /// The list of extension readers that are attached to this module
286 /// file.
287 std::vector<std::unique_ptr<ModuleFileExtensionReader>> ExtensionReaders;
288
289 /// The module offset map data for this file. If non-empty, the various
290 /// ContinuousRangeMaps described below have not yet been populated.
292
293 // === Input Files ===
294
295 /// The cursor to the start of the input-files block.
296 llvm::BitstreamCursor InputFilesCursor;
297
298 /// Absolute offset of the start of the input-files block.
300
301 /// Relative offsets for all of the input file entries in the AST file.
302 const llvm::support::unaligned_uint64_t *InputFileOffsets = nullptr;
303
304 /// The input files that have been loaded from this AST file.
305 std::vector<InputFile> InputFilesLoaded;
306
307 /// The input file infos that have been loaded from this AST file.
308 std::vector<InputFileInfo> InputFileInfosLoaded;
309
310 // All user input files reside at the index range [0, NumUserInputFiles), and
311 // system input files reside at [NumUserInputFiles, InputFilesLoaded.size()).
312 unsigned NumUserInputFiles = 0;
313
314 /// If non-zero, specifies the time when we last validated input
315 /// files. Zero means we never validated them.
316 ///
317 /// The time is specified in seconds since the start of the Epoch.
319
320 /// Captures the high-level result of validating input files.
321 ///
322 /// Useful when encountering a changed input file. This way, we can check
323 /// what kind of validation has been done already and can try to figure out
324 /// why a changed file hasn't been discovered earlier.
326
327 // === Source Locations ===
328
329 /// Cursor used to read source location entries.
330 llvm::BitstreamCursor SLocEntryCursor;
331
332 /// The bit offset to the start of the SOURCE_MANAGER_BLOCK.
334
335 /// The number of source location entries in this AST file.
337
338 /// The base ID in the source manager's view of this module.
340
341 /// The base offset in the source manager's view of this module.
343
344 /// Base file offset for the offsets in SLocEntryOffsets. Real file offset
345 /// for the entry is SLocEntryOffsetsBase + SLocEntryOffsets[i].
347
348 /// Offsets for all of the source location entries in the
349 /// AST file.
350 const uint32_t *SLocEntryOffsets = nullptr;
351
352 // === Identifiers ===
353
354 /// The number of identifiers in this AST file.
356
357 /// Offsets into the identifier table data.
358 ///
359 /// This array is indexed by the identifier ID (-1), and provides
360 /// the offset into IdentifierTableData where the string data is
361 /// stored.
362 const uint32_t *IdentifierOffsets = nullptr;
363
364 /// Base identifier ID for identifiers local to this module.
366
367 /// Actual data for the on-disk hash table of identifiers.
368 ///
369 /// This pointer points into a memory buffer, where the on-disk hash
370 /// table for identifiers actually lives.
371 const unsigned char *IdentifierTableData = nullptr;
372
373 /// A pointer to an on-disk hash table of opaque type
374 /// IdentifierHashTable.
375 void *IdentifierLookupTable = nullptr;
376
377 /// Offsets of identifiers that we're going to preload within
378 /// IdentifierTableData.
379 std::vector<unsigned> PreloadIdentifierOffsets;
380
381 // === Macros ===
382
383 /// The cursor to the start of the preprocessor block, which stores
384 /// all of the macro definitions.
385 llvm::BitstreamCursor MacroCursor;
386
387 /// The number of macros in this AST file.
388 unsigned LocalNumMacros = 0;
389
390 /// Base file offset for the offsets in MacroOffsets. Real file offset for
391 /// the entry is MacroOffsetsBase + MacroOffsets[i].
392 uint64_t MacroOffsetsBase = 0;
393
394 /// Offsets of macros in the preprocessor block.
395 ///
396 /// This array is indexed by the macro ID (-1), and provides
397 /// the offset into the preprocessor block where macro definitions are
398 /// stored.
399 const uint32_t *MacroOffsets = nullptr;
400
401 /// Base macro ID for macros local to this module.
403
404 /// The offset of the start of the set of defined macros.
405 uint64_t MacroStartOffset = 0;
406
407 // === Detailed PreprocessingRecord ===
408
409 /// The cursor to the start of the (optional) detailed preprocessing
410 /// record block.
411 llvm::BitstreamCursor PreprocessorDetailCursor;
412
413 /// The offset of the start of the preprocessor detail cursor.
415
416 /// Base preprocessed entity ID for preprocessed entities local to
417 /// this module.
419
422
423 /// Base ID for preprocessed skipped ranges local to this module.
425
428
429 // === Header search information ===
430
431 /// The number of local HeaderFileInfo structures.
433
434 /// Actual data for the on-disk hash table of header file
435 /// information.
436 ///
437 /// This pointer points into a memory buffer, where the on-disk hash
438 /// table for header file information actually lives.
439 const char *HeaderFileInfoTableData = nullptr;
440
441 /// The on-disk hash table that contains information about each of
442 /// the header files.
443 void *HeaderFileInfoTable = nullptr;
444
445 // === Submodule information ===
446
447 /// The number of submodules in this module.
448 unsigned LocalNumSubmodules = 0;
449
450 /// Base submodule ID for submodules local to this module.
452
453 /// Base submodule ID for submodules local to this module within its own
454 /// address space.
456
457 /// Local submodule ID of the top-level module.
459
460 /// Remapping table for submodule IDs in this module.
462
463 /// The cursor to the start of the submodules block.
464 llvm::BitstreamCursor SubmodulesCursor;
465
466 /// Absolute offset of the start of the submodules block.
468
469 /// Relative offsets for all submodule entries in the AST file.
470 const llvm::support::unaligned_uint64_t *SubmoduleOffsets = nullptr;
471
472 // === Selectors ===
473
474 /// The number of selectors new to this file.
475 ///
476 /// This is the number of entries in SelectorOffsets.
477 unsigned LocalNumSelectors = 0;
478
479 /// Offsets into the selector lookup table's data array
480 /// where each selector resides.
481 const uint32_t *SelectorOffsets = nullptr;
482
483 /// Base selector ID for selectors local to this module.
485
486 /// Remapping table for selector IDs in this module.
488
489 /// A pointer to the character data that comprises the selector table
490 ///
491 /// The SelectorOffsets table refers into this memory.
492 const unsigned char *SelectorLookupTableData = nullptr;
493
494 /// A pointer to an on-disk hash table of opaque type
495 /// ASTSelectorLookupTable.
496 ///
497 /// This hash table provides the IDs of all selectors, and the associated
498 /// instance and factory methods.
499 void *SelectorLookupTable = nullptr;
500
501 // === Declarations ===
502
503 /// DeclsCursor - This is a cursor to the start of the DECLTYPES_BLOCK block.
504 /// It has read all the abbreviations at the start of the block and is ready
505 /// to jump around with these in context.
506 llvm::BitstreamCursor DeclsCursor;
507
508 /// The offset to the start of the DECLTYPES_BLOCK block.
510
511 /// The number of declarations in this AST file.
512 unsigned LocalNumDecls = 0;
513
514 /// Offset of each declaration within the bitstream, indexed
515 /// by the declaration ID (-1).
516 const DeclOffset *DeclOffsets = nullptr;
517
518 /// Base declaration index in ASTReader for declarations local to this module.
519 unsigned BaseDeclIndex = 0;
520
521 /// Array of file-level DeclIDs sorted by file.
523 unsigned NumFileSortedDecls = 0;
524
525 /// Array of category list location information within this
526 /// module file, sorted by the definition ID.
528
529 /// The number of redeclaration info entries in ObjCCategoriesMap.
531
532 /// The Objective-C category lists for categories known to this
533 /// module.
535
536 // === Types ===
537
538 /// The number of types in this AST file.
539 unsigned LocalNumTypes = 0;
540
541 /// Offset of each type within the bitstream, indexed by the
542 /// type ID, or the representation of a Type*.
543 const UnalignedUInt64 *TypeOffsets = nullptr;
544
545 /// Base type ID for types local to this module as represented in
546 /// the global type ID space.
548
549 // === Miscellaneous ===
550
551 /// Diagnostic IDs and their mappings that the user changed.
553
554 /// List of modules which depend on this module
555 llvm::SetVector<ModuleFile *> ImportedBy;
556
557 /// List of modules which this module directly imported
558 llvm::SetVector<ModuleFile *> Imports;
559
560 /// List of modules which this modules dependent on. Different
561 /// from `Imports`, this includes indirectly imported modules too.
562 /// The order of TransitiveImports is significant. It should keep
563 /// the same order with that module file manager when we write
564 /// the current module file. The value of the member will be initialized
565 /// in `ASTReader::ReadModuleOffsetMap`.
567
568 /// Determine whether this module was directly imported at
569 /// any point during translation.
570 bool isDirectlyImported() const { return DirectlyImported; }
571
572 /// Is this a module file for a module (rather than a PCH or similar).
573 bool isModule() const {
576 }
577
578 /// Dump debugging output for this module.
579 void dump();
580};
581
582} // namespace serialization
583
584} // namespace clang
585
586#endif // LLVM_CLANG_SERIALIZATION_MODULEFILE_H
Defines the clang::FileManager interface and associated types.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::Module class, which describes a module in the source code.
Defines the clang::SourceLocation class and associated facilities.
A map from continuous integer ranges to some value, with a very specialized interface.
A reference to a FileEntry that includes the name of the file as it was accessed by the FileManager's...
Definition FileEntry.h:57
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Deduplication key for a loaded module file in ModuleManager.
Definition Module.h:79
Identifies a module file to be loaded.
Definition Module.h:109
Encodes a location in the source.
Source location and bit offset of a declaration.
InputFile(FileEntryRef File, bool isOverridden=false, bool isOutOfDate=false)
Definition ModuleFile.h:96
OptionalFileEntryRef getFile() const
Definition ModuleFile.h:114
static InputFile getNotFound()
Definition ModuleFile.h:108
ModuleFile(ModuleKind Kind, ModuleFileKey FileKey, unsigned Generation)
Definition ModuleFile.h:160
const PPEntityOffset * PreprocessedEntityOffsets
Definition ModuleFile.h:420
void * IdentifierLookupTable
A pointer to an on-disk hash table of opaque type IdentifierHashTable.
Definition ModuleFile.h:375
bool DirectlyImported
Whether this module has been directly imported by the user.
Definition ModuleFile.h:244
void * SelectorLookupTable
A pointer to an on-disk hash table of opaque type ASTSelectorLookupTable.
Definition ModuleFile.h:499
std::vector< std::unique_ptr< ModuleFileExtensionReader > > ExtensionReaders
The list of extension readers that are attached to this module file.
Definition ModuleFile.h:287
SourceLocation DirectImportLoc
The source location where the module was explicitly or implicitly imported in the local translation u...
Definition ModuleFile.h:277
StringRef Data
The serialized bitstream data for this file.
Definition ModuleFile.h:263
const serialization::ObjCCategoriesInfo * ObjCCategoriesMap
Array of category list location information within this module file, sorted by the definition ID.
Definition ModuleFile.h:527
uint64_t SubmodulesOffsetBase
Absolute offset of the start of the submodules block.
Definition ModuleFile.h:467
int SLocEntryBaseID
The base ID in the source manager's view of this module.
Definition ModuleFile.h:339
std::vector< std::string > DirectoryDependencies
Directories this module file depends on the listing of.
Definition ModuleFile.h:208
ModuleFileKey FileKey
The key ModuleManager used for the module file.
Definition ModuleFile.h:180
llvm::MemoryBuffer * Buffer
The memory buffer that stores the data associated with this AST file, owned by the InMemoryModuleCach...
Definition ModuleFile.h:251
serialization::IdentifierID BaseIdentifierID
Base identifier ID for identifiers local to this module.
Definition ModuleFile.h:365
serialization::PreprocessedEntityID BasePreprocessedEntityID
Base preprocessed entity ID for preprocessed entities local to this module.
Definition ModuleFile.h:418
serialization::TypeID BaseTypeIndex
Base type ID for types local to this module as represented in the global type ID space.
Definition ModuleFile.h:547
unsigned LocalNumObjCCategoriesInMap
The number of redeclaration info entries in ObjCCategoriesMap.
Definition ModuleFile.h:530
uint64_t MacroOffsetsBase
Base file offset for the offsets in MacroOffsets.
Definition ModuleFile.h:392
const llvm::support::unaligned_uint64_t * InputFileOffsets
Relative offsets for all of the input file entries in the AST file.
Definition ModuleFile.h:302
std::vector< unsigned > PreloadIdentifierOffsets
Offsets of identifiers that we're going to preload within IdentifierTableData.
Definition ModuleFile.h:379
unsigned LocalNumIdentifiers
The number of identifiers in this AST file.
Definition ModuleFile.h:355
llvm::BitstreamCursor DeclsCursor
DeclsCursor - This is a cursor to the start of the DECLTYPES_BLOCK block.
Definition ModuleFile.h:506
const llvm::support::unaligned_uint64_t * SubmoduleOffsets
Relative offsets for all submodule entries in the AST file.
Definition ModuleFile.h:470
const unsigned char * IdentifierTableData
Actual data for the on-disk hash table of identifiers.
Definition ModuleFile.h:371
llvm::BitstreamCursor SubmodulesCursor
The cursor to the start of the submodules block.
Definition ModuleFile.h:464
uint64_t SLocEntryOffsetsBase
Base file offset for the offsets in SLocEntryOffsets.
Definition ModuleFile.h:346
llvm::BitstreamCursor InputFilesCursor
The cursor to the start of the input-files block.
Definition ModuleFile.h:296
std::vector< InputFile > InputFilesLoaded
The input files that have been loaded from this AST file.
Definition ModuleFile.h:305
serialization::SelectorID BaseSelectorID
Base selector ID for selectors local to this module.
Definition ModuleFile.h:484
llvm::SetVector< ModuleFile * > ImportedBy
List of modules which depend on this module.
Definition ModuleFile.h:555
const char * HeaderFileInfoTableData
Actual data for the on-disk hash table of header file information.
Definition ModuleFile.h:439
SourceLocation ImportLoc
The source location where this module was first imported.
Definition ModuleFile.h:280
const serialization::unaligned_decl_id_t * FileSortedDecls
Array of file-level DeclIDs sorted by file.
Definition ModuleFile.h:522
const uint32_t * SLocEntryOffsets
Offsets for all of the source location entries in the AST file.
Definition ModuleFile.h:350
static std::string getTimestampFilename(StringRef FileName)
Definition ModuleFile.h:188
llvm::BitstreamCursor MacroCursor
The cursor to the start of the preprocessor block, which stores all of the macro definitions.
Definition ModuleFile.h:385
FileID OriginalSourceFileID
The file ID for the original source file that was used to build this AST file.
Definition ModuleFile.h:203
time_t ModTime
Modification of the module file.
Definition ModuleFile.h:226
std::string ActualOriginalSourceFileName
The actual original source file name that was used to build this AST file.
Definition ModuleFile.h:199
uint64_t PreprocessorDetailStartOffset
The offset of the start of the preprocessor detail cursor.
Definition ModuleFile.h:414
std::vector< InputFileInfo > InputFileInfosLoaded
The input file infos that have been loaded from this AST file.
Definition ModuleFile.h:308
unsigned LocalNumSubmodules
The number of submodules in this module.
Definition ModuleFile.h:448
SourceLocation FirstLoc
The first source location in this module.
Definition ModuleFile.h:283
unsigned LocalTopLevelSubmoduleID
Local submodule ID of the top-level module.
Definition ModuleFile.h:458
ASTFileSignature ASTBlockHash
The signature of the AST block of the module file, this can be used to unique module files based on A...
Definition ModuleFile.h:234
uint64_t SourceManagerBlockStartOffset
The bit offset to the start of the SOURCE_MANAGER_BLOCK.
Definition ModuleFile.h:333
bool DidReadTopLevelSubmodule
Whether the top-level module has been read from the AST file.
Definition ModuleFile.h:220
std::string OriginalSourceFileName
The original source file name that was used to build the primary AST file, which may have been modifi...
Definition ModuleFile.h:195
bool isModule() const
Is this a module file for a module (rather than a PCH or similar).
Definition ModuleFile.h:573
bool HasTimestamps
Whether timestamps are included in this module file.
Definition ModuleFile.h:217
uint64_t InputFilesOffsetBase
Absolute offset of the start of the input-files block.
Definition ModuleFile.h:299
llvm::BitstreamCursor SLocEntryCursor
Cursor used to read source location entries.
Definition ModuleFile.h:330
bool RelocatablePCH
Whether this precompiled header is a relocatable PCH file.
Definition ModuleFile.h:211
const uint32_t * SelectorOffsets
Offsets into the selector lookup table's data array where each selector resides.
Definition ModuleFile.h:481
unsigned BaseDeclIndex
Base declaration index in ASTReader for declarations local to this module.
Definition ModuleFile.h:519
unsigned LocalNumSLocEntries
The number of source location entries in this AST file.
Definition ModuleFile.h:336
void * HeaderFileInfoTable
The on-disk hash table that contains information about each of the header files.
Definition ModuleFile.h:443
unsigned Index
The index of this module in the list of modules.
Definition ModuleFile.h:171
llvm::BitstreamCursor Stream
The main bitstream cursor for the main block.
Definition ModuleFile.h:266
serialization::SubmoduleID BaseSubmoduleID
Base submodule ID for submodules local to this module.
Definition ModuleFile.h:451
uint64_t SizeInBits
The size of this file, in bits.
Definition ModuleFile.h:254
const UnalignedUInt64 * TypeOffsets
Offset of each type within the bitstream, indexed by the type ID, or the representation of a Type*.
Definition ModuleFile.h:543
uint64_t GlobalBitOffset
The global bit offset (or base) of this module.
Definition ModuleFile.h:257
bool StandardCXXModule
Whether this module file is a standard C++ module.
Definition ModuleFile.h:214
unsigned LocalNumTypes
The number of types in this AST file.
Definition ModuleFile.h:539
StringRef ModuleOffsetMap
The module offset map data for this file.
Definition ModuleFile.h:291
const PPSkippedRange * PreprocessedSkippedRangeOffsets
Definition ModuleFile.h:426
uint64_t InputFilesValidationTimestamp
If non-zero, specifies the time when we last validated input files.
Definition ModuleFile.h:318
llvm::BitstreamCursor PreprocessorDetailCursor
The cursor to the start of the (optional) detailed preprocessing record block.
Definition ModuleFile.h:411
llvm::SetVector< ModuleFile * > Imports
List of modules which this module directly imported.
Definition ModuleFile.h:558
SourceLocation::UIntTy SLocEntryBaseOffset
The base offset in the source manager's view of this module.
Definition ModuleFile.h:342
bool isDirectlyImported() const
Determine whether this module was directly imported at any point during translation.
Definition ModuleFile.h:570
unsigned LocalBaseSubmoduleID
Base submodule ID for submodules local to this module within its own address space.
Definition ModuleFile.h:455
const DeclOffset * DeclOffsets
Offset of each declaration within the bitstream, indexed by the declaration ID (-1).
Definition ModuleFile.h:516
off_t Size
Size of the module file.
Definition ModuleFile.h:223
uint64_t MacroStartOffset
The offset of the start of the set of defined macros.
Definition ModuleFile.h:405
ASTFileSignature Signature
The signature of the module file, which may be used instead of the size and modification time to iden...
Definition ModuleFile.h:230
unsigned LocalNumMacros
The number of macros in this AST file.
Definition ModuleFile.h:388
const unsigned char * SelectorLookupTableData
A pointer to the character data that comprises the selector table.
Definition ModuleFile.h:492
void dump()
Dump debugging output for this module.
unsigned LocalNumDecls
The number of declarations in this AST file.
Definition ModuleFile.h:512
unsigned LocalNumHeaderFileInfos
The number of local HeaderFileInfo structures.
Definition ModuleFile.h:432
llvm::BitVector SearchPathUsage
The bit vector denoting usage of each header search entry (true = used).
Definition ModuleFile.h:237
InputFilesValidation InputFilesValidationStatus
Captures the high-level result of validating input files.
Definition ModuleFile.h:325
unsigned Generation
The generation of which this module file is a part.
Definition ModuleFile.h:247
const uint32_t * IdentifierOffsets
Offsets into the identifier table data.
Definition ModuleFile.h:362
ContinuousRangeMap< uint32_t, int, 2 > SelectorRemap
Remapping table for selector IDs in this module.
Definition ModuleFile.h:487
const uint32_t * MacroOffsets
Offsets of macros in the preprocessor block.
Definition ModuleFile.h:399
uint64_t ASTBlockStartOffset
The bit offset of the AST block of this module.
Definition ModuleFile.h:260
ModuleFileName FileName
The file name of the module file.
Definition ModuleFile.h:177
ContinuousRangeMap< uint32_t, int, 2 > SubmoduleRemap
Remapping table for submodule IDs in this module.
Definition ModuleFile.h:461
llvm::BitVector VFSUsage
The bit vector denoting usage of each VFS entry (true = used).
Definition ModuleFile.h:240
uint64_t DeclsBlockStartOffset
The offset to the start of the DECLTYPES_BLOCK block.
Definition ModuleFile.h:509
SmallVector< uint64_t, 8 > PragmaDiagMappings
Diagnostic IDs and their mappings that the user changed.
Definition ModuleFile.h:552
unsigned BasePreprocessedSkippedRangeID
Base ID for preprocessed skipped ranges local to this module.
Definition ModuleFile.h:424
unsigned LocalNumSelectors
The number of selectors new to this file.
Definition ModuleFile.h:477
ModuleKind Kind
The type of this module.
Definition ModuleFile.h:174
std::string ModuleName
The name of the module.
Definition ModuleFile.h:183
serialization::MacroID BaseMacroID
Base macro ID for macros local to this module.
Definition ModuleFile.h:402
SmallVector< uint64_t, 1 > ObjCCategories
The Objective-C category lists for categories known to this module.
Definition ModuleFile.h:534
std::string BaseDirectory
The base directory of the module.
Definition ModuleFile.h:186
llvm::SmallVector< ModuleFile *, 16 > TransitiveImports
List of modules which this modules dependent on.
Definition ModuleFile.h:566
Source range/offset of a preprocessed entity.
Source range of a skipped preprocessor region.
32 aligned uint64_t in the AST file.
uint32_t SelectorID
An ID number that refers to an ObjC selector in an AST file.
InputFilesValidation
Specifies the high-level result of validating input files.
Definition ModuleFile.h:137
@ SkippedInBuildSession
When the validation is skipped because it was already done in the current build session.
Definition ModuleFile.h:144
@ AllFiles
When the validation is done both for user files and system files.
Definition ModuleFile.h:148
@ Disabled
When the validation is disabled. For example, for a precompiled header.
Definition ModuleFile.h:141
@ UserFiles
When the validation is done only for user files as an optimization.
Definition ModuleFile.h:146
@ NotStarted
Initial value, before the validation has been performed.
Definition ModuleFile.h:139
uint64_t PreprocessedEntityID
An ID number that refers to an entity in the detailed preprocessing record.
llvm::support::detail::packed_endian_specific_integral< serialization::DeclID, llvm::endianness::native, llvm::support::unaligned > unaligned_decl_id_t
uint64_t MacroID
An ID number that refers to a macro in an AST file.
uint64_t TypeID
An ID number that refers to a type in an AST file.
Definition ASTBitCodes.h:88
ModuleKind
Specifies the kind of module that has been loaded.
Definition ModuleFile.h:44
@ MK_PCH
File is a PCH file treated as such.
Definition ModuleFile.h:52
@ MK_Preamble
File is a PCH file treated as the preamble.
Definition ModuleFile.h:55
@ MK_MainFile
File is a PCH file treated as the actual main file.
Definition ModuleFile.h:58
@ MK_ExplicitModule
File is an explicitly-loaded module.
Definition ModuleFile.h:49
@ MK_ImplicitModule
File is an implicitly-loaded module.
Definition ModuleFile.h:46
@ MK_PrebuiltModule
File is from a prebuilt module path.
Definition ModuleFile.h:61
uint32_t SubmoduleID
An ID number that refers to a submodule in a module file.
uint64_t IdentifierID
An ID number that refers to an identifier in an AST file.
Definition ASTBitCodes.h:63
Top level wrappers for InstallAPI frontend operations.
CustomizableOptional< FileEntryRef > OptionalFileEntryRef
Definition FileEntry.h:196
int32_t uint32_t
The signature of a module, which is a hash of the AST content.
Definition Module.h:198
Describes a single change detected in a module file or input file.
Definition ModuleFile.h:125
std::optional< int64_t > Old
Definition ModuleFile.h:132
std::optional< int64_t > New
Definition ModuleFile.h:133
The input file info that has been loaded from an AST file.
Definition ModuleFile.h:65
Describes the categories of an Objective-C class.