clang: include/clang/Serialization/ModuleFile.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_CLANG_SERIALIZATION_MODULEFILE_H

15#define LLVM_CLANG_SERIALIZATION_MODULEFILE_H

16

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

33#include

34#include

35#include

36#include

37

39

40namespace serialization {

41

42

44

46

47

49

50

52

53

55

56

58

59

62

63

67

75

78 }

79};

80

81

82

83

85 enum {

86 Overridden = 1,

87 OutOfDate = 2,

88 NotFound = 3

89 };

90 llvm::PointerIntPair<const FileEntryRef::MapEntry *, 2, unsigned> Val;

91

92public:

94

97 unsigned intVal = 0;

98

99

101 intVal = OutOfDate;

103 intVal = Overridden;

104 Val.setPointerAndInt(&File.getMapEntry(), intVal);

105 }

106

109 File.Val.setInt(NotFound);

111 }

112

114 if (auto *P = Val.getPointer())

116 return std::nullopt;

117 }

118 bool isOverridden() const { return Val.getInt() == Overridden; }

119 bool isOutOfDate() const { return Val.getInt() == OutOfDate; }

120 bool isNotFound() const { return Val.getInt() == NotFound; }

121};

122

123

124

125

126

127

128

129

131public:

135

136

137

138

140

141

143

144

146

147

149

150

152

154 return (FileName + ".timestamp").str();

155 }

156

157

158

159

161

162

163

165

166

167

169

171

172

174

175

177

178

180

181

183

184

186

187

188

190

191

192

194

195

197

198

200

201

202

204

205

207

208

209

210 llvm::MemoryBuffer *Buffer = nullptr;

211

212

214

215

217

218

220

221

223

224

226

227

228

229

230

231

232

233

234

235

237

238

240

241

243

244

245

246 std::vector<std::unique_ptr> ExtensionReaders;

247

248

249

251

252

253

254

256

257

259

260

262

263

265

266

268

269

270

272

273

274

275

276

278

279

280

281

283

284

286

287

289

290

292

293

295

296

297

299

300

301

303

304

305

306

308

309

310

311

312

313

315

316

318

319

320

321

322

324

325

326

328

329

330

332

333

334

335

336

338

339

341

342

343

345

346

347

348

349

350

352

353

355

356

358

359

361

362

363

364

365

367

368

370

371

372

374

375

377

380

381

383

386

387

388

389

391

392

393

394

395

396

398

399

400

402

403

404

405

407

408

410

411

413

414

415

416

417

418

420

421

422

424

425

427

428

430

431

432

433

435

436

437

438

439

440

442

443

444

445

446

447

449

450

452

453

455

456

457

459

460

462

463

466

467

468

470

471

473

474

475

477

478

479

480

482

483

484

486

487

488

490

491

492

493

495

496

498

499

500 llvm::SetVector<ModuleFile *> Imports;

501

502

503

504

505

506

507

509

510

511

513

514

518 }

519

520

522};

523

524}

525

526}

527

528#endif

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...

An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...

Encodes a location in the source.

Source location and bit offset of a declaration.

The input file that has been loaded from this AST file, along with bools indicating whether this was ...

InputFile(FileEntryRef File, bool isOverridden=false, bool isOutOfDate=false)

bool isOverridden() const

OptionalFileEntryRef getFile() const

static InputFile getNotFound()

Information about a module that has been loaded by the ASTReader.

const PPEntityOffset * PreprocessedEntityOffsets

void * IdentifierLookupTable

A pointer to an on-disk hash table of opaque type IdentifierHashTable.

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.

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.

llvm::MemoryBuffer * Buffer

The memory buffer that stores the data associated with this AST file, owned by the InMemoryModuleCach...

serialization::IdentifierID BaseIdentifierID

Base identifier ID for identifiers local to this module.

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.

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.

ModuleFile(ModuleKind Kind, FileEntryRef File, unsigned Generation)

const serialization::unaligned_decl_id_t * FileSortedDecls

Array of file-level DeclIDs sorted by file.

const uint32_t * SLocEntryOffsets

Offsets for all of the source location entries in the AST file.

static std::string getTimestampFilename(StringRef FileName)

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.

FileEntryRef File

The file entry for the module file.

std::string ActualOriginalSourceFileName

The actual original source file name that was used to build this AST file.

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 BaseDeclIndex

Base declaration index in ASTReader for declarations local to this module.

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.

const UnalignedUInt64 * TypeOffsets

Offset of each type within the bitstream, indexed by the type ID, or the representation of a Type*.

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 directly imported.

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).

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.

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).

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.

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.

llvm::BitVector VFSUsage

The bit vector denoting usage of each VFS entry (true = used).

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.

llvm::SmallVector< ModuleFile *, 16 > TransitiveImports

List of modules which this modules dependent on.

Source range/offset of a preprocessed entity.

Source range of a skipped preprocessor region.

32 aligned uint64_t in the AST file.

uint64_t TypeID

An ID number that refers to a type in an AST file.

llvm::support::detail::packed_endian_specific_integral< serialization::DeclID, llvm::endianness::native, llvm::support::unaligned > unaligned_decl_id_t

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.

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.

uint64_t IdentifierID

An ID number that refers to an identifier in an AST file.

uint32_t MacroID

An ID number that refers to a macro in an AST file.

The JSON file list parser is used to communicate input to InstallAPI.

The signature of a module, which is a hash of the AST content.

The input file info that has been loaded from an AST file.

StringRef UnresolvedImportedFilename

StringRef UnresolvedImportedFilenameAsRequested

Describes the categories of an Objective-C class.