14#ifndef LLVM_CLANG_SERIALIZATION_MODULEFILE_H
15#define LLVM_CLANG_SERIALIZATION_MODULEFILE_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"
39namespace serialization {
84 llvm::PointerIntPair<const FileEntryRef::MapEntry *, 2, unsigned> Val;
92 "an overridden cannot be out-of-date");
98 Val.setPointerAndInt(&
File.getMapEntry(), intVal);
103 File.Val.setInt(NotFound);
108 if (
auto *
P = Val.getPointer())
Defines the clang::FileManager interface and associated types.
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...
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Wrapper around OptionalFileEntryRef that degrades to 'const FileEntry*', facilitating incremental pat...
Encodes a location in the source.
Information about a module that has been loaded by the ASTReader.
const PPEntityOffset * PreprocessedEntityOffsets
serialization::IdentID BaseIdentifierID
Base identifier ID for identifiers local to this module.
void * IdentifierLookupTable
A pointer to an on-disk hash table of opaque type IdentifierHashTable.
serialization::DeclID BaseDeclID
Base declaration ID for declarations local to this module.
bool DirectlyImported
Whether this module has been directly imported by the user.
void * SelectorLookupTable
A pointer to an on-disk hash table of opaque type ASTSelectorLookupTable.
const UnderalignedInt64 * TypeOffsets
Offset of each type within the bitstream, indexed by the type ID, or the representation of a Type*.
std::vector< std::unique_ptr< ModuleFileExtensionReader > > ExtensionReaders
The list of extension readers that are attached to this module file.
SourceLocation DirectImportLoc
The source location where the module was explicitly or implicitly imported in the local translation u...
StringRef Data
The serialized bitstream data for this file.
const serialization::ObjCCategoriesInfo * ObjCCategoriesMap
Array of category list location information within this module file, sorted by the definition ID.
ContinuousRangeMap< uint32_t, int, 2 > PreprocessedEntityRemap
Remapping table for preprocessed entity IDs in this module.
int SLocEntryBaseID
The base ID in the source manager's view of this module.
ContinuousRangeMap< uint32_t, int, 2 > DeclRemap
Remapping table for declaration IDs in this module.
llvm::MemoryBuffer * Buffer
The memory buffer that stores the data associated with this AST file, owned by the InMemoryModuleCach...
serialization::PreprocessedEntityID BasePreprocessedEntityID
Base preprocessed entity ID for preprocessed entities local to this module.
serialization::TypeID BaseTypeIndex
Base type ID for types local to this module as represented in the global type ID space.
unsigned LocalNumObjCCategoriesInMap
The number of redeclaration info entries in ObjCCategoriesMap.
uint64_t MacroOffsetsBase
Base file offset for the offsets in MacroOffsets.
const llvm::support::unaligned_uint64_t * InputFileOffsets
Relative offsets for all of the input file entries in the AST file.
std::vector< unsigned > PreloadIdentifierOffsets
Offsets of identifiers that we're going to preload within IdentifierTableData.
unsigned LocalNumIdentifiers
The number of identifiers in this AST file.
SmallVector< uint64_t, 4 > PreloadSLocEntries
SLocEntries that we're going to preload.
llvm::BitstreamCursor DeclsCursor
DeclsCursor - This is a cursor to the start of the DECLTYPES_BLOCK block.
const unsigned char * IdentifierTableData
Actual data for the on-disk hash table of identifiers.
uint64_t SLocEntryOffsetsBase
Base file offset for the offsets in SLocEntryOffsets.
llvm::BitstreamCursor InputFilesCursor
The cursor to the start of the input-files block.
std::vector< InputFile > InputFilesLoaded
The input files that have been loaded from this AST file.
serialization::SelectorID BaseSelectorID
Base selector ID for selectors local to this module.
llvm::SetVector< ModuleFile * > ImportedBy
List of modules which depend on this module.
const char * HeaderFileInfoTableData
Actual data for the on-disk hash table of header file information.
SourceLocation ImportLoc
The source location where this module was first imported.
ContinuousRangeMap< uint32_t, int, 2 > TypeRemap
Remapping table for type IDs in this module.
const uint32_t * SLocEntryOffsets
Offsets for all of the source location entries in the AST file.
llvm::BitstreamCursor MacroCursor
The cursor to the start of the preprocessor block, which stores all of the macro definitions.
FileID OriginalSourceFileID
The file ID for the original source file that was used to build this AST file.
std::string ActualOriginalSourceFileName
The actual original source file name that was used to build this AST file.
ContinuousRangeMap< uint32_t, int, 2 > IdentifierRemap
Remapping table for identifier IDs in this module.
uint64_t PreprocessorDetailStartOffset
The offset of the start of the preprocessor detail cursor.
std::vector< InputFileInfo > InputFileInfosLoaded
The input file infos that have been loaded from this AST file.
unsigned LocalNumSubmodules
The number of submodules in this module.
SourceLocation FirstLoc
The first source location in this module.
ASTFileSignature ASTBlockHash
The signature of the AST block of the module file, this can be used to unique module files based on A...
uint64_t SourceManagerBlockStartOffset
The bit offset to the start of the SOURCE_MANAGER_BLOCK.
bool DidReadTopLevelSubmodule
Whether the top-level module has been read from the AST file.
std::string OriginalSourceFileName
The original source file name that was used to build the primary AST file, which may have been modifi...
bool isModule() const
Is this a module file for a module (rather than a PCH or similar).
bool HasTimestamps
Whether timestamps are included in this module file.
uint64_t InputFilesOffsetBase
Absolute offset of the start of the input-files block.
llvm::BitstreamCursor SLocEntryCursor
Cursor used to read source location entries.
unsigned NumPreprocessedEntities
bool RelocatablePCH
Whether this precompiled header is a relocatable PCH file.
const uint32_t * SelectorOffsets
Offsets into the selector lookup table's data array where each selector resides.
unsigned NumFileSortedDecls
unsigned LocalNumSLocEntries
The number of source location entries in this AST file.
void * HeaderFileInfoTable
The on-disk hash table that contains information about each of the header files.
unsigned Index
The index of this module in the list of modules.
unsigned NumUserInputFiles
llvm::BitstreamCursor Stream
The main bitstream cursor for the main block.
serialization::SubmoduleID BaseSubmoduleID
Base submodule ID for submodules local to this module.
uint64_t SizeInBits
The size of this file, in bits.
uint64_t GlobalBitOffset
The global bit offset (or base) of this module.
bool StandardCXXModule
Whether this module file is a standard C++ module.
unsigned LocalNumTypes
The number of types in this AST file.
StringRef ModuleOffsetMap
The module offset map data for this file.
const PPSkippedRange * PreprocessedSkippedRangeOffsets
std::string FileName
The file name of the module file.
uint64_t InputFilesValidationTimestamp
If non-zero, specifies the time when we last validated input files.
llvm::BitstreamCursor PreprocessorDetailCursor
The cursor to the start of the (optional) detailed preprocessing record block.
llvm::SetVector< ModuleFile * > Imports
List of modules which this module depends on.
SourceLocation::UIntTy SLocEntryBaseOffset
The base offset in the source manager's view of this module.
bool isDirectlyImported() const
Determine whether this module was directly imported at any point during translation.
std::string ModuleMapPath
const DeclOffset * DeclOffsets
Offset of each declaration within the bitstream, indexed by the declaration ID (-1).
std::string getTimestampFilename() const
OptionalFileEntryRefDegradesToFileEntryPtr File
The file entry for the module file.
uint64_t MacroStartOffset
The offset of the start of the set of defined macros.
ASTFileSignature Signature
The signature of the module file, which may be used instead of the size and modification time to iden...
unsigned LocalNumMacros
The number of macros in this AST file.
unsigned NumPreprocessedSkippedRanges
const unsigned char * SelectorLookupTableData
A pointer to the character data that comprises the selector table.
const serialization::DeclID * FileSortedDecls
Array of file-level DeclIDs sorted by file.
void dump()
Dump debugging output for this module.
unsigned LocalNumDecls
The number of declarations in this AST file.
unsigned LocalNumHeaderFileInfos
The number of local HeaderFileInfo structures.
llvm::BitVector SearchPathUsage
The bit vector denoting usage of each header search entry (true = used).
ContinuousRangeMap< SourceLocation::UIntTy, SourceLocation::IntTy, 2 > SLocRemap
Remapping table for source locations in this module.
unsigned Generation
The generation of which this module file is a part.
const uint32_t * IdentifierOffsets
Offsets into the identifier table data.
ContinuousRangeMap< uint32_t, int, 2 > SelectorRemap
Remapping table for selector IDs in this module.
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...
ContinuousRangeMap< uint32_t, int, 2 > MacroRemap
Remapping table for macro IDs in this module.
const uint32_t * MacroOffsets
Offsets of macros in the preprocessor block.
uint64_t ASTBlockStartOffset
The bit offset of the AST block of this module.
ContinuousRangeMap< uint32_t, int, 2 > SubmoduleRemap
Remapping table for submodule IDs in this module.
ModuleFile(ModuleKind Kind, unsigned Generation)
uint64_t DeclsBlockStartOffset
The offset to the start of the DECLTYPES_BLOCK block.
SmallVector< uint64_t, 8 > PragmaDiagMappings
Diagnostic IDs and their mappings that the user changed.
unsigned BasePreprocessedSkippedRangeID
Base ID for preprocessed skipped ranges local to this module.
unsigned LocalNumSelectors
The number of selectors new to this file.
ModuleKind Kind
The type of this module.
std::string ModuleName
The name of the module.
serialization::MacroID BaseMacroID
Base macro ID for macros local to this module.
SmallVector< uint64_t, 1 > ObjCCategories
The Objective-C category lists for categories known to this module.
std::string BaseDirectory
The base directory of the module.
uint32_t TypeID
An ID number that refers to a type in an AST file.
uint32_t SubmoduleID
An ID number that refers to a submodule in a module file.
uint32_t SelectorID
An ID number that refers to an ObjC selector in an AST file.
uint32_t PreprocessedEntityID
An ID number that refers to an entity in the detailed preprocessing record.
uint32_t IdentID
An ID number that refers to an identifier in an AST file.
uint32_t DeclID
An ID number that refers to a declaration in an AST file.
ModuleKind
Specifies the kind of module that has been loaded.
@ MK_PCH
File is a PCH file treated as such.
@ MK_Preamble
File is a PCH file treated as the preamble.
@ MK_MainFile
File is a PCH file treated as the actual main file.
@ MK_ExplicitModule
File is an explicitly-loaded module.
@ MK_ImplicitModule
File is an implicitly-loaded module.
@ MK_PrebuiltModule
File is from a prebuilt module path.
uint32_t MacroID
An ID number that refers to a macro in an AST file.
The signature of a module, which is a hash of the AST content.
Source location and bit offset of a declaration.
Describes the categories of an Objective-C class.
Source range/offset of a preprocessed entity.
Source range of a skipped preprocessor region.