clang  15.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/Module.h"
23 #include "llvm/ADT/BitVector.h"
24 #include "llvm/ADT/DenseMap.h"
25 #include "llvm/ADT/PointerIntPair.h"
26 #include "llvm/ADT/SetVector.h"
27 #include "llvm/ADT/SmallVector.h"
28 #include "llvm/ADT/StringRef.h"
29 #include "llvm/Bitstream/BitstreamReader.h"
30 #include "llvm/Support/Endian.h"
31 #include <cassert>
32 #include <cstdint>
33 #include <memory>
34 #include <string>
35 #include <vector>
36 
37 namespace clang {
38 
39 namespace serialization {
40 
41 /// Specifies the kind of module that has been loaded.
42 enum ModuleKind {
43  /// File is an implicitly-loaded module.
45 
46  /// File is an explicitly-loaded module.
48 
49  /// File is a PCH file treated as such.
51 
52  /// File is a PCH file treated as the preamble.
54 
55  /// File is a PCH file treated as the actual main file.
57 
58  /// File is from a prebuilt module path.
60 };
61 
62 /// The input file that has been loaded from this AST file, along with
63 /// bools indicating whether this was an overridden buffer or if it was
64 /// out-of-date or not-found.
65 class InputFile {
66  enum {
67  Overridden = 1,
68  OutOfDate = 2,
69  NotFound = 3
70  };
71  llvm::PointerIntPair<const FileEntryRef::MapEntry *, 2, unsigned> Val;
72 
73 public:
74  InputFile() = default;
75 
76  InputFile(FileEntryRef File, bool isOverridden = false,
77  bool isOutOfDate = false) {
78  assert(!(isOverridden && isOutOfDate) &&
79  "an overridden cannot be out-of-date");
80  unsigned intVal = 0;
81  if (isOverridden)
82  intVal = Overridden;
83  else if (isOutOfDate)
84  intVal = OutOfDate;
85  Val.setPointerAndInt(&File.getMapEntry(), intVal);
86  }
87 
90  File.Val.setInt(NotFound);
91  return File;
92  }
93 
95  if (auto *P = Val.getPointer())
96  return FileEntryRef(*P);
97  return None;
98  }
99  bool isOverridden() const { return Val.getInt() == Overridden; }
100  bool isOutOfDate() const { return Val.getInt() == OutOfDate; }
101  bool isNotFound() const { return Val.getInt() == NotFound; }
102 };
103 
104 /// Information about a module that has been loaded by the ASTReader.
105 ///
106 /// Each instance of the Module class corresponds to a single AST file, which
107 /// may be a precompiled header, precompiled preamble, a module, or an AST file
108 /// of some sort loaded as the main file, all of which are specific formulations
109 /// of the general notion of a "module". A module may depend on any number of
110 /// other modules.
111 class ModuleFile {
112 public:
115  ~ModuleFile();
116 
117  // === General information ===
118 
119  /// The index of this module in the list of modules.
120  unsigned Index = 0;
121 
122  /// The type of this module.
124 
125  /// The file name of the module file.
127 
128  /// The name of the module.
130 
131  /// The base directory of the module.
133 
135  return FileName + ".timestamp";
136  }
137 
138  /// The original source file name that was used to build the
139  /// primary AST file, which may have been modified for
140  /// relocatable-pch support.
142 
143  /// The actual original source file name that was used to
144  /// build this AST file.
146 
147  /// The file ID for the original source file that was used to
148  /// build this AST file.
150 
151  /// The directory that the PCH was originally created in. Used to
152  /// allow resolving headers even after headers+PCH was moved to a new path.
154 
156 
157  /// Whether this precompiled header is a relocatable PCH file.
158  bool RelocatablePCH = false;
159 
160  /// Whether timestamps are included in this module file.
161  bool HasTimestamps = false;
162 
163  /// Whether the top-level module has been read from the AST file.
165 
166  /// The file entry for the module file.
168 
169  /// The signature of the module file, which may be used instead of the size
170  /// and modification time to identify this particular file.
172 
173  /// The signature of the AST block of the module file, this can be used to
174  /// unique module files based on AST contents.
176 
177  /// The bit vector denoting usage of each header search entry (true = used).
178  llvm::BitVector SearchPathUsage;
179 
180  /// Whether this module has been directly imported by the
181  /// user.
182  bool DirectlyImported = false;
183 
184  /// The generation of which this module file is a part.
185  unsigned Generation;
186 
187  /// The memory buffer that stores the data associated with
188  /// this AST file, owned by the InMemoryModuleCache.
189  llvm::MemoryBuffer *Buffer;
190 
191  /// The size of this file, in bits.
193 
194  /// The global bit offset (or base) of this module
196 
197  /// The bit offset of the AST block of this module.
199 
200  /// The serialized bitstream data for this file.
201  StringRef Data;
202 
203  /// The main bitstream cursor for the main block.
204  llvm::BitstreamCursor Stream;
205 
206  /// The source location where the module was explicitly or implicitly
207  /// imported in the local translation unit.
208  ///
209  /// If module A depends on and imports module B, both modules will have the
210  /// same DirectImportLoc, but different ImportLoc (B's ImportLoc will be a
211  /// source location inside module A).
212  ///
213  /// WARNING: This is largely useless. It doesn't tell you when a module was
214  /// made visible, just when the first submodule of that module was imported.
216 
217  /// The source location where this module was first imported.
219 
220  /// The first source location in this module.
222 
223  /// The list of extension readers that are attached to this module
224  /// file.
225  std::vector<std::unique_ptr<ModuleFileExtensionReader>> ExtensionReaders;
226 
227  /// The module offset map data for this file. If non-empty, the various
228  /// ContinuousRangeMaps described below have not yet been populated.
229  StringRef ModuleOffsetMap;
230 
231  // === Input Files ===
232 
233  /// The cursor to the start of the input-files block.
234  llvm::BitstreamCursor InputFilesCursor;
235 
236  /// Offsets for all of the input file entries in the AST file.
237  const llvm::support::unaligned_uint64_t *InputFileOffsets = nullptr;
238 
239  /// The input files that have been loaded from this AST file.
240  std::vector<InputFile> InputFilesLoaded;
241 
242  // All user input files reside at the index range [0, NumUserInputFiles), and
243  // system input files reside at [NumUserInputFiles, InputFilesLoaded.size()).
244  unsigned NumUserInputFiles = 0;
245 
246  /// If non-zero, specifies the time when we last validated input
247  /// files. Zero means we never validated them.
248  ///
249  /// The time is specified in seconds since the start of the Epoch.
251 
252  // === Source Locations ===
253 
254  /// Cursor used to read source location entries.
255  llvm::BitstreamCursor SLocEntryCursor;
256 
257  /// The bit offset to the start of the SOURCE_MANAGER_BLOCK.
259 
260  /// The number of source location entries in this AST file.
261  unsigned LocalNumSLocEntries = 0;
262 
263  /// The base ID in the source manager's view of this module.
265 
266  /// The base offset in the source manager's view of this module.
268 
269  /// Base file offset for the offsets in SLocEntryOffsets. Real file offset
270  /// for the entry is SLocEntryOffsetsBase + SLocEntryOffsets[i].
272 
273  /// Offsets for all of the source location entries in the
274  /// AST file.
275  const uint32_t *SLocEntryOffsets = nullptr;
276 
277  /// SLocEntries that we're going to preload.
279 
280  /// Remapping table for source locations in this module.
283 
284  // === Identifiers ===
285 
286  /// The number of identifiers in this AST file.
287  unsigned LocalNumIdentifiers = 0;
288 
289  /// Offsets into the identifier table data.
290  ///
291  /// This array is indexed by the identifier ID (-1), and provides
292  /// the offset into IdentifierTableData where the string data is
293  /// stored.
294  const uint32_t *IdentifierOffsets = nullptr;
295 
296  /// Base identifier ID for identifiers local to this module.
298 
299  /// Remapping table for identifier IDs in this module.
301 
302  /// Actual data for the on-disk hash table of identifiers.
303  ///
304  /// This pointer points into a memory buffer, where the on-disk hash
305  /// table for identifiers actually lives.
306  const unsigned char *IdentifierTableData = nullptr;
307 
308  /// A pointer to an on-disk hash table of opaque type
309  /// IdentifierHashTable.
310  void *IdentifierLookupTable = nullptr;
311 
312  /// Offsets of identifiers that we're going to preload within
313  /// IdentifierTableData.
314  std::vector<unsigned> PreloadIdentifierOffsets;
315 
316  // === Macros ===
317 
318  /// The cursor to the start of the preprocessor block, which stores
319  /// all of the macro definitions.
320  llvm::BitstreamCursor MacroCursor;
321 
322  /// The number of macros in this AST file.
323  unsigned LocalNumMacros = 0;
324 
325  /// Base file offset for the offsets in MacroOffsets. Real file offset for
326  /// the entry is MacroOffsetsBase + MacroOffsets[i].
328 
329  /// Offsets of macros in the preprocessor block.
330  ///
331  /// This array is indexed by the macro ID (-1), and provides
332  /// the offset into the preprocessor block where macro definitions are
333  /// stored.
334  const uint32_t *MacroOffsets = nullptr;
335 
336  /// Base macro ID for macros local to this module.
338 
339  /// Remapping table for macro IDs in this module.
341 
342  /// The offset of the start of the set of defined macros.
344 
345  // === Detailed PreprocessingRecord ===
346 
347  /// The cursor to the start of the (optional) detailed preprocessing
348  /// record block.
349  llvm::BitstreamCursor PreprocessorDetailCursor;
350 
351  /// The offset of the start of the preprocessor detail cursor.
353 
354  /// Base preprocessed entity ID for preprocessed entities local to
355  /// this module.
357 
358  /// Remapping table for preprocessed entity IDs in this module.
360 
363 
364  /// Base ID for preprocessed skipped ranges local to this module.
366 
369 
370  // === Header search information ===
371 
372  /// The number of local HeaderFileInfo structures.
374 
375  /// Actual data for the on-disk hash table of header file
376  /// information.
377  ///
378  /// This pointer points into a memory buffer, where the on-disk hash
379  /// table for header file information actually lives.
380  const char *HeaderFileInfoTableData = nullptr;
381 
382  /// The on-disk hash table that contains information about each of
383  /// the header files.
384  void *HeaderFileInfoTable = nullptr;
385 
386  // === Submodule information ===
387 
388  /// The number of submodules in this module.
389  unsigned LocalNumSubmodules = 0;
390 
391  /// Base submodule ID for submodules local to this module.
393 
394  /// Remapping table for submodule IDs in this module.
396 
397  // === Selectors ===
398 
399  /// The number of selectors new to this file.
400  ///
401  /// This is the number of entries in SelectorOffsets.
402  unsigned LocalNumSelectors = 0;
403 
404  /// Offsets into the selector lookup table's data array
405  /// where each selector resides.
406  const uint32_t *SelectorOffsets = nullptr;
407 
408  /// Base selector ID for selectors local to this module.
410 
411  /// Remapping table for selector IDs in this module.
413 
414  /// A pointer to the character data that comprises the selector table
415  ///
416  /// The SelectorOffsets table refers into this memory.
417  const unsigned char *SelectorLookupTableData = nullptr;
418 
419  /// A pointer to an on-disk hash table of opaque type
420  /// ASTSelectorLookupTable.
421  ///
422  /// This hash table provides the IDs of all selectors, and the associated
423  /// instance and factory methods.
424  void *SelectorLookupTable = nullptr;
425 
426  // === Declarations ===
427 
428  /// DeclsCursor - This is a cursor to the start of the DECLTYPES_BLOCK block.
429  /// It has read all the abbreviations at the start of the block and is ready
430  /// to jump around with these in context.
431  llvm::BitstreamCursor DeclsCursor;
432 
433  /// The offset to the start of the DECLTYPES_BLOCK block.
435 
436  /// The number of declarations in this AST file.
437  unsigned LocalNumDecls = 0;
438 
439  /// Offset of each declaration within the bitstream, indexed
440  /// by the declaration ID (-1).
441  const DeclOffset *DeclOffsets = nullptr;
442 
443  /// Base declaration ID for declarations local to this module.
445 
446  /// Remapping table for declaration IDs in this module.
448 
449  /// Mapping from the module files that this module file depends on
450  /// to the base declaration ID for that module as it is understood within this
451  /// module.
452  ///
453  /// This is effectively a reverse global-to-local mapping for declaration
454  /// IDs, so that we can interpret a true global ID (for this translation unit)
455  /// as a local ID (for this module file).
456  llvm::DenseMap<ModuleFile *, serialization::DeclID> GlobalToLocalDeclIDs;
457 
458  /// Array of file-level DeclIDs sorted by file.
460  unsigned NumFileSortedDecls = 0;
461 
462  /// Array of category list location information within this
463  /// module file, sorted by the definition ID.
465 
466  /// The number of redeclaration info entries in ObjCCategoriesMap.
468 
469  /// The Objective-C category lists for categories known to this
470  /// module.
472 
473  // === Types ===
474 
475  /// The number of types in this AST file.
476  unsigned LocalNumTypes = 0;
477 
478  /// Offset of each type within the bitstream, indexed by the
479  /// type ID, or the representation of a Type*.
480  const UnderalignedInt64 *TypeOffsets = nullptr;
481 
482  /// Base type ID for types local to this module as represented in
483  /// the global type ID space.
485 
486  /// Remapping table for type IDs in this module.
488 
489  // === Miscellaneous ===
490 
491  /// Diagnostic IDs and their mappings that the user changed.
493 
494  /// List of modules which depend on this module
495  llvm::SetVector<ModuleFile *> ImportedBy;
496 
497  /// List of modules which this module depends on
498  llvm::SetVector<ModuleFile *> Imports;
499 
500  /// Determine whether this module was directly imported at
501  /// any point during translation.
502  bool isDirectlyImported() const { return DirectlyImported; }
503 
504  /// Is this a module file for a module (rather than a PCH or similar).
505  bool isModule() const {
506  return Kind == MK_ImplicitModule || Kind == MK_ExplicitModule ||
508  }
509 
510  /// Dump debugging output for this module.
511  void dump();
512 };
513 
514 } // namespace serialization
515 
516 } // namespace clang
517 
518 #endif // LLVM_CLANG_SERIALIZATION_MODULEFILE_H
clang::serialization::ModuleFile::BasePreprocessedEntityID
serialization::PreprocessedEntityID BasePreprocessedEntityID
Base preprocessed entity ID for preprocessed entities local to this module.
Definition: ModuleFile.h:356
clang::serialization::ModuleFile::DirectlyImported
bool DirectlyImported
Whether this module has been directly imported by the user.
Definition: ModuleFile.h:182
clang::serialization::ModuleFile::PreloadIdentifierOffsets
std::vector< unsigned > PreloadIdentifierOffsets
Offsets of identifiers that we're going to preload within IdentifierTableData.
Definition: ModuleFile.h:314
clang::serialization::ModuleFile::ObjCCategories
SmallVector< uint64_t, 1 > ObjCCategories
The Objective-C category lists for categories known to this module.
Definition: ModuleFile.h:471
clang::serialization::ModuleFile::InputFileOffsets
const llvm::support::unaligned_uint64_t * InputFileOffsets
Offsets for all of the input file entries in the AST file.
Definition: ModuleFile.h:237
clang::serialization::ModuleFile::IdentifierLookupTable
void * IdentifierLookupTable
A pointer to an on-disk hash table of opaque type IdentifierHashTable.
Definition: ModuleFile.h:310
clang::serialization::ModuleFile::SourceManagerBlockStartOffset
uint64_t SourceManagerBlockStartOffset
The bit offset to the start of the SOURCE_MANAGER_BLOCK.
Definition: ModuleFile.h:258
clang::FileEntryRef
A reference to a FileEntry that includes the name of the file as it was accessed by the FileManager's...
Definition: FileEntry.h:60
clang::serialization::InputFile::getFile
OptionalFileEntryRefDegradesToFileEntryPtr getFile() const
Definition: ModuleFile.h:94
clang::serialization::ModuleFile::SelectorOffsets
const uint32_t * SelectorOffsets
Offsets into the selector lookup table's data array where each selector resides.
Definition: ModuleFile.h:406
clang::serialization::ModuleFile::InputFilesCursor
llvm::BitstreamCursor InputFilesCursor
The cursor to the start of the input-files block.
Definition: ModuleFile.h:234
clang::DeclaratorContext::File
@ File
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::serialization::ModuleFile::SizeInBits
uint64_t SizeInBits
The size of this file, in bits.
Definition: ModuleFile.h:192
clang::serialization::ModuleFile::LocalNumMacros
unsigned LocalNumMacros
The number of macros in this AST file.
Definition: ModuleFile.h:323
clang::serialization::DeclOffset
Source location and bit offset of a declaration.
Definition: ASTBitCodes.h:241
clang::serialization::ModuleFile::ObjCCategoriesMap
const serialization::ObjCCategoriesInfo * ObjCCategoriesMap
Array of category list location information within this module file, sorted by the definition ID.
Definition: ModuleFile.h:464
clang::serialization::ModuleFile::SLocEntryBaseID
int SLocEntryBaseID
The base ID in the source manager's view of this module.
Definition: ModuleFile.h:264
clang::serialization::ModuleFile::BaseSubmoduleID
serialization::SubmoduleID BaseSubmoduleID
Base submodule ID for submodules local to this module.
Definition: ModuleFile.h:392
llvm::SmallVector< uint64_t, 4 >
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:86
clang::serialization::IdentID
uint32_t IdentID
An ID number that refers to an identifier in an AST file.
Definition: ASTBitCodes.h:134
clang::serialization::ModuleFile::DeclsBlockStartOffset
uint64_t DeclsBlockStartOffset
The offset to the start of the DECLTYPES_BLOCK block.
Definition: ModuleFile.h:434
clang::serialization::ModuleFile::Generation
unsigned Generation
The generation of which this module file is a part.
Definition: ModuleFile.h:185
clang::serialization::ModuleFile::PreprocessedEntityOffsets
const PPEntityOffset * PreprocessedEntityOffsets
Definition: ModuleFile.h:361
clang::serialization::ModuleFile::HeaderFileInfoTable
void * HeaderFileInfoTable
The on-disk hash table that contains information about each of the header files.
Definition: ModuleFile.h:384
Module.h
clang::serialization::ModuleFile::LocalNumIdentifiers
unsigned LocalNumIdentifiers
The number of identifiers in this AST file.
Definition: ModuleFile.h:287
clang::serialization::ModuleFile::Stream
llvm::BitstreamCursor Stream
The main bitstream cursor for the main block.
Definition: ModuleFile.h:204
clang::OptionalFileEntryRefDegradesToFileEntryPtr
Wrapper around Optional<FileEntryRef> that degrades to 'const FileEntry*', facilitating incremental p...
Definition: FileEntry.h:279
clang::serialization::ModuleFile::BaseDeclID
serialization::DeclID BaseDeclID
Base declaration ID for declarations local to this module.
Definition: ModuleFile.h:444
clang::serialization::ModuleFile::GlobalBitOffset
uint64_t GlobalBitOffset
The global bit offset (or base) of this module.
Definition: ModuleFile.h:195
ContinuousRangeMap.h
clang::serialization::ModuleFile::BaseIdentifierID
serialization::IdentID BaseIdentifierID
Base identifier ID for identifiers local to this module.
Definition: ModuleFile.h:297
clang::serialization::ModuleFile::PreprocessedEntityRemap
ContinuousRangeMap< uint32_t, int, 2 > PreprocessedEntityRemap
Remapping table for preprocessed entity IDs in this module.
Definition: ModuleFile.h:359
clang::serialization::ModuleFile::SelectorRemap
ContinuousRangeMap< uint32_t, int, 2 > SelectorRemap
Remapping table for selector IDs in this module.
Definition: ModuleFile.h:412
clang::serialization::ModuleFile::ASTBlockHash
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:175
clang::serialization::ModuleFile::NumPreprocessedEntities
unsigned NumPreprocessedEntities
Definition: ModuleFile.h:362
clang::serialization::ModuleFile::PreprocessedSkippedRangeOffsets
const PPSkippedRange * PreprocessedSkippedRangeOffsets
Definition: ModuleFile.h:367
clang::serialization::MacroID
uint32_t MacroID
An ID number that refers to a macro in an AST file.
Definition: ASTBitCodes.h:140
clang::serialization::ModuleFile::LocalNumHeaderFileInfos
unsigned LocalNumHeaderFileInfos
The number of local HeaderFileInfo structures.
Definition: ModuleFile.h:373
clang::serialization::ModuleFile::MacroRemap
ContinuousRangeMap< uint32_t, int, 2 > MacroRemap
Remapping table for macro IDs in this module.
Definition: ModuleFile.h:340
clang::serialization::ModuleFile::ModuleMapPath
std::string ModuleMapPath
Definition: ModuleFile.h:155
uint64_t
unsigned long uint64_t
Definition: hlsl_basic_types.h:24
clang::serialization::SubmoduleID
uint32_t SubmoduleID
An ID number that refers to a submodule in a module file.
Definition: ASTBitCodes.h:171
clang::serialization::ModuleFile::OriginalDir
std::string OriginalDir
The directory that the PCH was originally created in.
Definition: ModuleFile.h:153
clang::serialization::ModuleFile::DeclsCursor
llvm::BitstreamCursor DeclsCursor
DeclsCursor - This is a cursor to the start of the DECLTYPES_BLOCK block.
Definition: ModuleFile.h:431
clang::serialization::ModuleFile::isDirectlyImported
bool isDirectlyImported() const
Determine whether this module was directly imported at any point during translation.
Definition: ModuleFile.h:502
clang::serialization::ModuleFile::HeaderFileInfoTableData
const char * HeaderFileInfoTableData
Actual data for the on-disk hash table of header file information.
Definition: ModuleFile.h:380
clang::serialization::InputFile::isNotFound
bool isNotFound() const
Definition: ModuleFile.h:101
clang::serialization::MK_Preamble
@ MK_Preamble
File is a PCH file treated as the preamble.
Definition: ModuleFile.h:53
clang::serialization::ModuleFile::BasePreprocessedSkippedRangeID
unsigned BasePreprocessedSkippedRangeID
Base ID for preprocessed skipped ranges local to this module.
Definition: ModuleFile.h:365
clang::serialization::ModuleFile::PreprocessorDetailCursor
llvm::BitstreamCursor PreprocessorDetailCursor
The cursor to the start of the (optional) detailed preprocessing record block.
Definition: ModuleFile.h:349
clang::serialization::ModuleFile::NumFileSortedDecls
unsigned NumFileSortedDecls
Definition: ModuleFile.h:460
clang::serialization::ModuleFile::SLocEntryBaseOffset
SourceLocation::UIntTy SLocEntryBaseOffset
The base offset in the source manager's view of this module.
Definition: ModuleFile.h:267
clang::serialization::ModuleFile::SubmoduleRemap
ContinuousRangeMap< uint32_t, int, 2 > SubmoduleRemap
Remapping table for submodule IDs in this module.
Definition: ModuleFile.h:395
clang::serialization::InputFile
The input file that has been loaded from this AST file, along with bools indicating whether this was ...
Definition: ModuleFile.h:65
clang::serialization::ModuleFile::ImportedBy
llvm::SetVector< ModuleFile * > ImportedBy
List of modules which depend on this module.
Definition: ModuleFile.h:495
clang::serialization::ModuleFile::SLocEntryOffsets
const uint32_t * SLocEntryOffsets
Offsets for all of the source location entries in the AST file.
Definition: ModuleFile.h:275
clang::serialization::ModuleFile::FileSortedDecls
const serialization::DeclID * FileSortedDecls
Array of file-level DeclIDs sorted by file.
Definition: ModuleFile.h:459
clang::serialization::ModuleFile::ExtensionReaders
std::vector< std::unique_ptr< ModuleFileExtensionReader > > ExtensionReaders
The list of extension readers that are attached to this module file.
Definition: ModuleFile.h:225
clang::serialization::ModuleFile::SLocRemap
ContinuousRangeMap< SourceLocation::UIntTy, SourceLocation::IntTy, 2 > SLocRemap
Remapping table for source locations in this module.
Definition: ModuleFile.h:282
clang::serialization::InputFile::getNotFound
static InputFile getNotFound()
Definition: ModuleFile.h:88
clang::serialization::InputFile::isOverridden
bool isOverridden() const
Definition: ModuleFile.h:99
clang::serialization::ModuleFile::DeclOffsets
const DeclOffset * DeclOffsets
Offset of each declaration within the bitstream, indexed by the declaration ID (-1).
Definition: ModuleFile.h:441
clang::serialization::ModuleFile::DeclRemap
ContinuousRangeMap< uint32_t, int, 2 > DeclRemap
Remapping table for declaration IDs in this module.
Definition: ModuleFile.h:447
clang::serialization::TypeID
uint32_t TypeID
An ID number that refers to a type in an AST file.
Definition: ASTBitCodes.h:85
clang::serialization::ModuleFile::Buffer
llvm::MemoryBuffer * Buffer
The memory buffer that stores the data associated with this AST file, owned by the InMemoryModuleCach...
Definition: ModuleFile.h:189
clang::serialization::ModuleFile::LocalNumSLocEntries
unsigned LocalNumSLocEntries
The number of source location entries in this AST file.
Definition: ModuleFile.h:261
clang::serialization::PPSkippedRange
Source range of a skipped preprocessor region.
Definition: ASTBitCodes.h:201
clang::serialization::ModuleFile::NumUserInputFiles
unsigned NumUserInputFiles
Definition: ModuleFile.h:244
clang::serialization::MK_ImplicitModule
@ MK_ImplicitModule
File is an implicitly-loaded module.
Definition: ModuleFile.h:44
clang::serialization::ObjCCategoriesInfo
Describes the categories of an Objective-C class.
Definition: ASTBitCodes.h:2061
clang::serialization::ModuleFile::SelectorLookupTable
void * SelectorLookupTable
A pointer to an on-disk hash table of opaque type ASTSelectorLookupTable.
Definition: ModuleFile.h:424
clang::serialization::ModuleFile::SelectorLookupTableData
const unsigned char * SelectorLookupTableData
A pointer to the character data that comprises the selector table.
Definition: ModuleFile.h:417
clang::ASTFileSignature
The signature of a module, which is a hash of the AST content.
Definition: Module.h:56
clang::serialization::ModuleFile::MacroOffsets
const uint32_t * MacroOffsets
Offsets of macros in the preprocessor block.
Definition: ModuleFile.h:334
clang::serialization::ModuleFile::Index
unsigned Index
The index of this module in the list of modules.
Definition: ModuleFile.h:120
clang::serialization::ModuleFile::TypeOffsets
const UnderalignedInt64 * TypeOffsets
Offset of each type within the bitstream, indexed by the type ID, or the representation of a Type*.
Definition: ModuleFile.h:480
clang::serialization::ModuleFile::TypeRemap
ContinuousRangeMap< uint32_t, int, 2 > TypeRemap
Remapping table for type IDs in this module.
Definition: ModuleFile.h:487
clang::serialization::ModuleFile::BaseTypeIndex
serialization::TypeID BaseTypeIndex
Base type ID for types local to this module as represented in the global type ID space.
Definition: ModuleFile.h:484
clang::serialization::ModuleFile::LocalNumSelectors
unsigned LocalNumSelectors
The number of selectors new to this file.
Definition: ModuleFile.h:402
clang::serialization::ModuleFile::MacroStartOffset
uint64_t MacroStartOffset
The offset of the start of the set of defined macros.
Definition: ModuleFile.h:343
clang::serialization::ModuleFile::InputFilesLoaded
std::vector< InputFile > InputFilesLoaded
The input files that have been loaded from this AST file.
Definition: ModuleFile.h:240
clang::serialization::ModuleFile::IdentifierOffsets
const uint32_t * IdentifierOffsets
Offsets into the identifier table data.
Definition: ModuleFile.h:294
clang::serialization::ModuleFile::LocalNumTypes
unsigned LocalNumTypes
The number of types in this AST file.
Definition: ModuleFile.h:476
clang::serialization::ModuleFile::isModule
bool isModule() const
Is this a module file for a module (rather than a PCH or similar).
Definition: ModuleFile.h:505
clang::serialization::PreprocessedEntityID
uint32_t PreprocessedEntityID
An ID number that refers to an entity in the detailed preprocessing record.
Definition: ASTBitCodes.h:168
clang::serialization::ModuleFile::File
OptionalFileEntryRefDegradesToFileEntryPtr File
The file entry for the module file.
Definition: ModuleFile.h:167
clang::serialization::InputFile::InputFile
InputFile()=default
clang::serialization::ModuleFile::IdentifierTableData
const unsigned char * IdentifierTableData
Actual data for the on-disk hash table of identifiers.
Definition: ModuleFile.h:306
ASTBitCodes.h
clang::serialization::ModuleFile::ModuleOffsetMap
StringRef ModuleOffsetMap
The module offset map data for this file.
Definition: ModuleFile.h:229
clang::serialization::MK_ExplicitModule
@ MK_ExplicitModule
File is an explicitly-loaded module.
Definition: ModuleFile.h:47
clang::serialization::ModuleFile::BaseDirectory
std::string BaseDirectory
The base directory of the module.
Definition: ModuleFile.h:132
clang::serialization::ModuleFile::ASTBlockStartOffset
uint64_t ASTBlockStartOffset
The bit offset of the AST block of this module.
Definition: ModuleFile.h:198
SourceLocation.h
P
StringRef P
Definition: ASTMatchersInternal.cpp:563
clang::serialization::ModuleFile::LocalNumObjCCategoriesInMap
unsigned LocalNumObjCCategoriesInMap
The number of redeclaration info entries in ObjCCategoriesMap.
Definition: ModuleFile.h:467
clang::serialization::ModuleFile::LocalNumDecls
unsigned LocalNumDecls
The number of declarations in this AST file.
Definition: ModuleFile.h:437
clang::serialization::PPEntityOffset
Source range/offset of a preprocessed entity.
Definition: ASTBitCodes.h:177
clang::serialization::ModuleFile::BaseSelectorID
serialization::SelectorID BaseSelectorID
Base selector ID for selectors local to this module.
Definition: ModuleFile.h:409
clang::serialization::ModuleFile::HasTimestamps
bool HasTimestamps
Whether timestamps are included in this module file.
Definition: ModuleFile.h:161
clang::serialization::ModuleFile::SearchPathUsage
llvm::BitVector SearchPathUsage
The bit vector denoting usage of each header search entry (true = used).
Definition: ModuleFile.h:178
clang::serialization::InputFile::InputFile
InputFile(FileEntryRef File, bool isOverridden=false, bool isOutOfDate=false)
Definition: ModuleFile.h:76
clang::serialization::ModuleFile::DidReadTopLevelSubmodule
bool DidReadTopLevelSubmodule
Whether the top-level module has been read from the AST file.
Definition: ModuleFile.h:164
clang::serialization::MK_PrebuiltModule
@ MK_PrebuiltModule
File is from a prebuilt module path.
Definition: ModuleFile.h:59
clang::serialization::ModuleFile::dump
void dump()
Dump debugging output for this module.
Definition: ModuleFile.cpp:47
clang::serialization::ModuleFile::GlobalToLocalDeclIDs
llvm::DenseMap< ModuleFile *, serialization::DeclID > GlobalToLocalDeclIDs
Mapping from the module files that this module file depends on to the base declaration ID for that mo...
Definition: ModuleFile.h:456
clang::serialization::ModuleFile::getTimestampFilename
std::string getTimestampFilename() const
Definition: ModuleFile.h:134
ModuleFileExtension.h
clang::serialization::ModuleFile::ModuleName
std::string ModuleName
The name of the module.
Definition: ModuleFile.h:129
clang::serialization::ModuleFile::PreprocessorDetailStartOffset
uint64_t PreprocessorDetailStartOffset
The offset of the start of the preprocessor detail cursor.
Definition: ModuleFile.h:352
clang::serialization::ModuleFile::PreloadSLocEntries
SmallVector< uint64_t, 4 > PreloadSLocEntries
SLocEntries that we're going to preload.
Definition: ModuleFile.h:278
clang::serialization::ModuleFile::LocalNumSubmodules
unsigned LocalNumSubmodules
The number of submodules in this module.
Definition: ModuleFile.h:389
clang::serialization::UnderalignedInt64
Offset in the AST file.
Definition: ASTBitCodes.h:223
clang
Definition: CalledOnceCheck.h:17
clang::serialization::ModuleFile::Imports
llvm::SetVector< ModuleFile * > Imports
List of modules which this module depends on.
Definition: ModuleFile.h:498
clang::serialization::ModuleFile::ImportLoc
SourceLocation ImportLoc
The source location where this module was first imported.
Definition: ModuleFile.h:218
clang::ContinuousRangeMap< SourceLocation::UIntTy, SourceLocation::IntTy, 2 >
clang::serialization::ModuleFile::OriginalSourceFileID
FileID OriginalSourceFileID
The file ID for the original source file that was used to build this AST file.
Definition: ModuleFile.h:149
clang::FileID
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Definition: SourceLocation.h:38
clang::serialization::ModuleFile::DirectImportLoc
SourceLocation DirectImportLoc
The source location where the module was explicitly or implicitly imported in the local translation u...
Definition: ModuleFile.h:215
clang::serialization::ModuleFile::Signature
ASTFileSignature Signature
The signature of the module file, which may be used instead of the size and modification time to iden...
Definition: ModuleFile.h:171
clang::serialization::ModuleFile::ModuleFile
ModuleFile(ModuleKind Kind, unsigned Generation)
Definition: ModuleFile.h:113
clang::serialization::ModuleFile::~ModuleFile
~ModuleFile()
Definition: ModuleFile.cpp:25
clang::serialization::ModuleFile::NumPreprocessedSkippedRanges
unsigned NumPreprocessedSkippedRanges
Definition: ModuleFile.h:368
clang::serialization::InputFile::isOutOfDate
bool isOutOfDate() const
Definition: ModuleFile.h:100
clang::serialization::ModuleFile::ActualOriginalSourceFileName
std::string ActualOriginalSourceFileName
The actual original source file name that was used to build this AST file.
Definition: ModuleFile.h:145
clang::serialization::ModuleFile::SLocEntryOffsetsBase
uint64_t SLocEntryOffsetsBase
Base file offset for the offsets in SLocEntryOffsets.
Definition: ModuleFile.h:271
clang::serialization::MK_MainFile
@ MK_MainFile
File is a PCH file treated as the actual main file.
Definition: ModuleFile.h:56
clang::serialization::ModuleFile::OriginalSourceFileName
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:141
clang::serialization::ModuleKind
ModuleKind
Specifies the kind of module that has been loaded.
Definition: ModuleFile.h:42
clang::serialization::ModuleFile::RelocatablePCH
bool RelocatablePCH
Whether this precompiled header is a relocatable PCH file.
Definition: ModuleFile.h:158
clang::serialization::MK_PCH
@ MK_PCH
File is a PCH file treated as such.
Definition: ModuleFile.h:50
clang::serialization::ModuleFile::FirstLoc
SourceLocation FirstLoc
The first source location in this module.
Definition: ModuleFile.h:221
clang::serialization::ModuleFile::FileName
std::string FileName
The file name of the module file.
Definition: ModuleFile.h:126
FileManager.h
clang::serialization::ModuleFile::IdentifierRemap
ContinuousRangeMap< uint32_t, int, 2 > IdentifierRemap
Remapping table for identifier IDs in this module.
Definition: ModuleFile.h:300
clang::serialization::ModuleFile::InputFilesValidationTimestamp
uint64_t InputFilesValidationTimestamp
If non-zero, specifies the time when we last validated input files.
Definition: ModuleFile.h:250
clang::serialization::DeclID
uint32_t DeclID
An ID number that refers to a declaration in an AST file.
Definition: ASTBitCodes.h:68
clang::serialization::ModuleFile::PragmaDiagMappings
SmallVector< uint64_t, 8 > PragmaDiagMappings
Diagnostic IDs and their mappings that the user changed.
Definition: ModuleFile.h:492
clang::serialization::ModuleFile::SLocEntryCursor
llvm::BitstreamCursor SLocEntryCursor
Cursor used to read source location entries.
Definition: ModuleFile.h:255
clang::serialization::ModuleFile::Data
StringRef Data
The serialized bitstream data for this file.
Definition: ModuleFile.h:201
clang::serialization::SelectorID
uint32_t SelectorID
An ID number that refers to an ObjC selector in an AST file.
Definition: ASTBitCodes.h:153
clang::serialization::ModuleFile
Information about a module that has been loaded by the ASTReader.
Definition: ModuleFile.h:111
clang::serialization::ModuleFile::BaseMacroID
serialization::MacroID BaseMacroID
Base macro ID for macros local to this module.
Definition: ModuleFile.h:337
clang::serialization::ModuleFile::MacroCursor
llvm::BitstreamCursor MacroCursor
The cursor to the start of the preprocessor block, which stores all of the macro definitions.
Definition: ModuleFile.h:320
clang::serialization::ModuleFile::MacroOffsetsBase
uint64_t MacroOffsetsBase
Base file offset for the offsets in MacroOffsets.
Definition: ModuleFile.h:327
clang::SourceLocation::UIntTy
uint32_t UIntTy
Definition: SourceLocation.h:93
clang::serialization::ModuleFile::Kind
ModuleKind Kind
The type of this module.
Definition: ModuleFile.h:123