ASTDeserializationListener;
85classFileSystemOptions;
87classGlobalModuleIndex;
89classHeaderSearchOptions;
92classInMemoryModuleCache;
95classObjCCategoryDecl;
96classObjCInterfaceDecl;
97classPCHContainerReader;
99classPreprocessorOptions;
106classTypedefNameDecl;
135StringRef ModuleFilename,
boolComplain,
136 boolAllowCompatibleDifferences) {
145StringRef ModuleFilename,
boolComplain,
146 boolAllowCompatibleDifferences) {
156StringRef ModuleFilename,
boolComplain) {
178StringRef ModuleFilename,
179StringRef SpecificModuleCachePath,
207StringRef ModuleFilename,
208 boolReadMacros,
boolComplain,
209std::string &SuggestedPredefines) {
236 boolisOverridden,
boolisExplicitModule) {
255std::unique_ptr<ASTReaderListener> First;
256std::unique_ptr<ASTReaderListener> Second;
261std::unique_ptr<ASTReaderListener> Second)
265std::unique_ptr<ASTReaderListener>
takeSecond() {
returnstd::move(Second); }
271StringRef ModuleFilename,
boolComplain,
272 boolAllowCompatibleDifferences)
override;
274StringRef ModuleFilename,
boolComplain,
275 boolAllowCompatibleDifferences)
override;
277StringRef ModuleFilename,
boolComplain)
override;
279 boolComplain)
override;
282StringRef ModuleFilename,
283StringRef SpecificModuleCachePath,
284 boolComplain)
override;
286StringRef ModuleFilename,
boolReadMacros,
288std::string &SuggestedPredefines)
override;
296 boolisOverridden,
boolisExplicitModule)
override;
309: PP(PP), Reader(Reader) {}
312StringRef ModuleFilename,
boolComplain,
313 boolAllowCompatibleDifferences)
override;
315StringRef ModuleFilename,
boolComplain,
316 boolAllowCompatibleDifferences)
override;
318StringRef ModuleFilename,
boolComplain)
override;
320StringRef ModuleFilename,
boolReadMacros,
322std::string &SuggestedPredefines)
override;
324StringRef ModuleFilename,
325StringRef SpecificModuleCachePath,
326 boolComplain)
override;
341StringRef ModuleFilename,
boolReadMacros,
343std::string &SuggestedPredefines)
override;
346namespaceserialization {
348classReadMethodPoolVisitor;
441std::unique_ptr<ASTReaderListener> Listener;
446 boolOwnsDeserializationListener =
false;
458 Sema*SemaObj =
nullptr;
478llvm::StringMap<std::shared_ptr<ModuleFileExtension>> ModuleFileExtensions;
481std::unique_ptr<llvm::Timer> ReadTimer;
488std::optional<ModuleKind> CurrentDeserializingModuleKind;
491std::unique_ptr<GlobalModuleIndex> GlobalIndex;
511llvm::PagedVector<QualType> TypesLoaded;
517llvm::PagedVector<Decl *> DeclsLoaded;
519 usingFileOffset = std::pair<ModuleFile *, uint64_t>;
521 usingDeclUpdateOffsetsMap = llvm::DenseMap<GlobalDeclID, FileOffsetsTy>;
525DeclUpdateOffsetsMap DeclUpdateOffsets;
527 structLookupBlockOffsets {
528uint64_t LexicalOffset;
529uint64_t VisibleOffset;
530uint64_t ModuleLocalOffset;
531uint64_t TULocalOffset;
534 usingDelayedNamespaceOffsetMapTy =
535llvm::DenseMap<GlobalDeclID, LookupBlockOffsets>;
545DelayedNamespaceOffsetMapTy DelayedNamespaceOffsetMap;
561llvm::DenseMap<GlobalDeclID, SmallVector<GlobalDeclID, 4>> RelatedDeclsMap;
563 structPendingUpdateRecord {
571:
D(
D), ID(ID), JustLoaded(JustLoaded) {}
578 enum classPendingFakeDefinitionKind { NotFake, Fake, FakeLoaded };
582llvm::DenseMap<void *, PendingFakeDefinitionKind> PendingFakeDefinitionData;
588llvm::SmallMapVector<Decl *, FunctionDecl *, 4> PendingExceptionSpecUpdates;
593llvm::SmallMapVector<FunctionDecl *, QualType, 4> PendingDeducedTypeUpdates;
601llvm::DenseMap<std::pair<DeclContext *, IdentifierInfo *>, NamedDecl *>
602ImportedTypedefNamesForLinkage;
606llvm::DenseMap<Decl*, llvm::SmallVector<NamedDecl*, 2>>
607AnonymousDeclarationsForMerging;
610llvm::DenseMap<std::pair<const Decl *, unsigned>, NamedDecl *>
611LambdaDeclarationsForMerging;
615 usingLETemporaryKey = std::pair<Decl *, unsigned>;
618llvm::DenseMap<LETemporaryKey, LifetimeExtendedTemporaryDecl *>
619LETemporaryForMerging;
621 structFileDeclsInfo {
623ArrayRef<serialization::unaligned_decl_id_t> Decls;
625FileDeclsInfo() =
default;
627ArrayRef<serialization::unaligned_decl_id_t> Decls)
628: Mod(Mod), Decls(Decls) {}
632llvm::DenseMap<FileID, FileDeclsInfo> FileDeclIDs;
636 usingLexicalContents = ArrayRef<serialization::unaligned_decl_id_t>;
639llvm::DenseMap<const DeclContext*, std::pair<ModuleFile*, LexicalContents>>
643std::vector<std::pair<ModuleFile*, LexicalContents>> TULexicalDecls;
646llvm::DenseMap<
constDeclContext *,
647serialization::reader::DeclContextLookupTable> Lookups;
648llvm::DenseMap<
constDeclContext *,
649serialization::reader::ModuleLocalLookupTable>
651llvm::DenseMap<
constDeclContext *,
652serialization::reader::DeclContextLookupTable>
655 usingSpecLookupTableTy =
656llvm::DenseMap<
const Decl*,
657serialization::reader::LazySpecializationInfoLookupTable>;
659SpecLookupTableTy SpecializationsLookups;
661SpecLookupTableTy PartialSpecializationsLookups;
663 boolLoadExternalSpecializationsImpl(SpecLookupTableTy &SpecLookups,
665 boolLoadExternalSpecializationsImpl(SpecLookupTableTy &SpecLookups,
667ArrayRef<TemplateArgument> TemplateArgs);
675 const unsigned char*
Data;
677 usingDeclContextVisibleUpdates = SmallVector<UpdateData, 1>;
681llvm::DenseMap<GlobalDeclID, DeclContextVisibleUpdates> PendingVisibleUpdates;
682llvm::DenseMap<GlobalDeclID, DeclContextVisibleUpdates>
683PendingModuleLocalVisibleUpdates;
684llvm::DenseMap<GlobalDeclID, DeclContextVisibleUpdates> TULocalUpdates;
686 usingSpecializationsUpdate = SmallVector<UpdateData, 1>;
687 usingSpecializationsUpdateMap =
688llvm::DenseMap<GlobalDeclID, SpecializationsUpdate>;
689SpecializationsUpdateMap PendingSpecializationsUpdates;
690SpecializationsUpdateMap PendingPartialSpecializationsUpdates;
696 usingPendingBodiesMap =
698llvm::SmallDenseMap<Decl *, unsigned, 4>,
699SmallVector<std::pair<Decl *, uint64_t>, 4>>;
702PendingBodiesMap PendingBodies;
706llvm::SetVector<NamedDecl *> PendingMergedDefinitionsToDeduplicate;
712PendingWarningForDuplicatedDefsInModuleUnits;
715 boolReadLexicalDeclContextStorage(
ModuleFile&M,
716llvm::BitstreamCursor &Cursor,
717uint64_t Offset, DeclContext *DC);
719 enum classVisibleDeclContextStorageKind {
726 boolReadVisibleDeclContextStorage(
ModuleFile&M,
727llvm::BitstreamCursor &Cursor,
728uint64_t Offset, GlobalDeclID ID,
729VisibleDeclContextStorageKind VisibleKind);
731 boolReadSpecializations(
ModuleFile&M, llvm::BitstreamCursor &Cursor,
732uint64_t Offset, Decl *
D,
boolIsPartial);
733 voidAddSpecializations(
constDecl *
D,
const unsigned char*
Data,
742std::vector<IdentifierInfo *> IdentifiersLoaded;
750std::vector<MacroInfo *> MacrosLoaded;
752 usingLoadedMacroInfo =
753std::pair<IdentifierInfo *, serialization::SubmoduleID>;
758llvm::DenseSet<LoadedMacroInfo> LoadedUndefs;
760 usingGlobalMacroMapType =
761ContinuousRangeMap<serialization::MacroID, ModuleFile *, 4>;
766GlobalMacroMapType GlobalMacroMap;
772SmallVector<Module *, 2> SubmodulesLoaded;
774 usingGlobalSubmoduleMapType =
775ContinuousRangeMap<serialization::SubmoduleID, ModuleFile *, 4>;
780GlobalSubmoduleMapType GlobalSubmoduleMap;
783 usingHiddenNames = SmallVector<Decl *, 2>;
784 usingHiddenNamesMapType = llvm::DenseMap<Module *, HiddenNames>;
788HiddenNamesMapType HiddenNamesMap;
791 structUnresolvedModuleRef {
799 enum{
Import, Export, Conflict, Affecting }
Kind;
805LLVM_PREFERRED_TYPE(
bool)
806 unsignedIsWildcard : 1;
814SmallVector<UnresolvedModuleRef, 2> UnresolvedModuleRefs;
821SmallVector<Selector, 16> SelectorsLoaded;
823 usingGlobalSelectorMapType =
824ContinuousRangeMap<serialization::SelectorID, ModuleFile *, 4>;
828GlobalSelectorMapType GlobalSelectorMap;
832llvm::DenseMap<Selector, unsigned> SelectorGeneration;
836llvm::DenseMap<Selector, bool> SelectorOutOfDate;
838 structPendingMacroInfo {
843PendingMacroInfo(
ModuleFile*M, uint32_t MacroDirectivesOffset)
844: M(M), MacroDirectivesOffset(MacroDirectivesOffset) {}
847 usingPendingMacroIDsMap =
848llvm::MapVector<IdentifierInfo *, SmallVector<PendingMacroInfo, 2>>;
852PendingMacroIDsMap PendingMacroIDs;
854 usingGlobalPreprocessedEntityMapType =
855ContinuousRangeMap<unsigned, ModuleFile *, 4>;
860GlobalPreprocessedEntityMapType GlobalPreprocessedEntityMap;
862 usingGlobalSkippedRangeMapType =
863ContinuousRangeMap<unsigned, ModuleFile *, 4>;
867GlobalSkippedRangeMapType GlobalSkippedRangeMap;
879SmallVector<GlobalDeclID, 16> EagerlyDeserializedDecls;
884SmallVector<GlobalDeclID, 16> VTablesToEmit;
891SmallVector<GlobalDeclID, 16> TentativeDefinitions;
903SmallVector<VTableUse> VTableUses;
911 structPendingInstantiation {
915SmallVector<PendingInstantiation, 64> PendingInstantiations;
925SmallVector<GlobalDeclID, 16> UnusedFileScopedDecls;
929SmallVector<GlobalDeclID, 4> DelegatingCtorDecls;
933SmallVector<serialization::SelectorID, 64> ReferencedSelectorsData;
937SmallVector<serialization::IdentifierID, 64> WeakUndeclaredIdentifiers;
942SmallVector<GlobalDeclID, 4> ExtVectorDecls;
953SmallVector<GlobalDeclID, 16> UnusedLocalTypedefNameCandidates;
957 unsignedForceHostDeviceDepth = 0;
962SmallVector<GlobalDeclID, 4> SemaDeclRefs;
967SmallVector<serialization::TypeID, 16> SpecialTypes;
973SmallVector<GlobalDeclID, 2> CUDASpecialDeclRefs;
976SmallVector<uint64_t, 1> FPPragmaOptions;
979SourceLocation OptimizeOffPragmaLocation;
982 intPragmaMSStructState = -1;
985 intPragmaMSPointersToMembersState = -1;
986SourceLocation PointersToMembersPragmaLocation;
989std::optional<FPOptionsOverride> FpPragmaCurrentValue;
990SourceLocation FpPragmaCurrentLocation;
991 structFpPragmaStackEntry {
992FPOptionsOverride
Value;
993SourceLocation Location;
994SourceLocation PushLocation;
1001std::optional<Sema::AlignPackInfo> PragmaAlignPackCurrentValue;
1002SourceLocation PragmaAlignPackCurrentLocation;
1003 structPragmaAlignPackStackEntry {
1004Sema::AlignPackInfo
Value;
1005SourceLocation Location;
1006SourceLocation PushLocation;
1007StringRef SlotLabel;
1013OpenCLOptions OpenCLExtensions;
1016llvm::DenseMap<const Type *, std::set<std::string>> OpenCLTypeExtMap;
1019llvm::DenseMap<const Decl *, std::set<std::string>> OpenCLDeclExtMap;
1022SmallVector<GlobalDeclID, 4> KnownNamespaces;
1026 structUndefinedButUsedDecl {
1030SmallVector<UndefinedButUsedDecl, 8> UndefinedButUsed;
1033SmallVector<uint64_t, 8> DelayedDeleteExprs;
1036SmallVector<std::pair<ModuleFile *, SmallVector<uint64_t, 1>>, 4>
1037LateParsedTemplates;
1045SmallVector<GlobalDeclID> DeclsWithEffectsToVerify;
1048 structImportedSubmodule {
1050SourceLocation ImportLoc;
1053:
ID(
ID), ImportLoc(ImportLoc) {}
1060SmallVector<ImportedSubmodule, 2> PendingImportedModules;
1064SmallVector<ImportedSubmodule, 2> PendingImportedModulesSema;
1069std::string isysroot;
1076 boolAllowASTWithCompilerErrors;
1080 boolAllowConfigurationMismatch;
1083 boolValidateSystemInputs;
1086 boolValidateASTInputFilesContent;
1089 boolUseGlobalIndex;
1092 boolTriedLoadingGlobalIndex =
false;
1095 boolProcessingUpdateRecords =
false;
1097 usingSwitchCaseMapTy = llvm::DenseMap<unsigned, SwitchCase *>;
1103SwitchCaseMapTy SwitchCaseStmts;
1105SwitchCaseMapTy *CurrSwitchCaseStmts;
1109 unsignedNumSLocEntriesRead = 0;
1112 unsignedTotalNumSLocEntries = 0;
1116 unsignedNumStatementsRead = 0;
1120 unsignedTotalNumStatements = 0;
1123 unsignedNumMacrosRead = 0;
1126 unsignedTotalNumMacros = 0;
1129 unsignedNumIdentifierLookups = 0;
1132 unsignedNumIdentifierLookupHits = 0;
1135 unsignedNumSelectorsRead = 0;
1138 unsignedNumMethodPoolEntriesRead = 0;
1142 unsignedNumMethodPoolLookups = 0;
1146 unsignedNumMethodPoolHits = 0;
1150 unsignedNumMethodPoolTableLookups = 0;
1154 unsignedNumMethodPoolTableHits = 0;
1157 unsignedTotalNumMethodPoolEntries = 0;
1160 unsignedNumLexicalDeclContextsRead = 0, TotalLexicalDeclContexts = 0;
1163 unsignedNumVisibleDeclContextsRead = 0, TotalVisibleDeclContexts = 0;
1166 unsignedNumModuleLocalVisibleDeclContexts = 0,
1167TotalModuleLocalVisibleDeclContexts = 0;
1170 unsignedNumTULocalVisibleDeclContexts = 0,
1171TotalTULocalVisibleDeclContexts = 0;
1174 uint64_tTotalModulesSizeInBits = 0;
1177 unsignedNumCurrentElementsDeserializing = 0;
1183 boolPassingDeclsToConsumer =
false;
1190llvm::MapVector<IdentifierInfo *, SmallVector<GlobalDeclID, 4>>
1191PendingIdentifierInfos;
1195llvm::SmallMapVector<const IdentifierInfo *, SmallVector<NamedDecl *, 2>, 16>
1196PendingFakeLookupResults;
1200llvm::DenseMap<const IdentifierInfo *, unsigned> IdentifierGeneration;
1208std::deque<Decl *> PotentiallyInterestingDecls;
1213SmallVector<std::pair<FunctionDecl *, serialization::TypeID>, 16>
1214PendingDeducedFunctionTypes;
1219SmallVector<std::pair<VarDecl *, serialization::TypeID>, 16>
1220PendingDeducedVarTypes;
1225SmallVector<std::pair<Decl *, uint64_t>, 16> PendingDeclChains;
1229SmallVector<Decl *, 16> PendingIncompleteDeclChains;
1233 structPendingDeclContextInfo {
1235GlobalDeclID SemaDC;
1236GlobalDeclID LexicalDC;
1244std::deque<PendingDeclContextInfo> PendingDeclContextInfos;
1246 template<
typenameDeclTy>
1247 usingDuplicateObjCDecls = std::pair<DeclTy *, DeclTy *>;
1253llvm::SmallMapVector<DuplicateObjCDecls<ObjCCategoryDecl>,
1256PendingObjCExtensionIvarRedeclarations;
1261SmallVector<std::pair<CXXRecordDecl*, Decl*>, 4> PendingAddedClassMembers;
1271 usingDataPointers =
1272std::pair<CXXRecordDecl *, struct CXXRecordDecl::DefinitionData *>;
1273 usingObjCInterfaceDataPointers =
1274std::pair<ObjCInterfaceDecl *,
1275 structObjCInterfaceDecl::DefinitionData *>;
1276 usingObjCProtocolDataPointers =
1277std::pair<ObjCProtocolDecl *, struct ObjCProtocolDecl::DefinitionData *>;
1280llvm::SmallDenseMap<CXXRecordDecl *, llvm::SmallVector<DataPointers, 2>, 2>
1281PendingOdrMergeFailures;
1284llvm::SmallDenseMap<RecordDecl *, llvm::SmallVector<RecordDecl *, 2>, 2>
1285PendingRecordOdrMergeFailures;
1288llvm::SmallDenseMap<FunctionDecl *, llvm::SmallVector<FunctionDecl *, 2>, 2>
1289PendingFunctionOdrMergeFailures;
1292llvm::SmallDenseMap<EnumDecl *, llvm::SmallVector<EnumDecl *, 2>, 2>
1293PendingEnumOdrMergeFailures;
1296llvm::SmallDenseMap<ObjCInterfaceDecl *,
1298PendingObjCInterfaceOdrMergeFailures;
1301llvm::SmallDenseMap<ObjCProtocolDecl *,
1303PendingObjCProtocolOdrMergeFailures;
1315SmallVector<ObjCInterfaceDecl *, 16> ObjCClassesLoaded;
1317 usingKeyDeclsMap = llvm::DenseMap<Decl *, SmallVector<GlobalDeclID, 2>>;
1324KeyDeclsMap KeyDecls;
1329llvm::DenseMap<DeclContext *, DeclContext *> MergedDeclContexts;
1333llvm::DenseMap<EnumDecl *, EnumDecl *> EnumDefinitions;
1337llvm::DenseMap<RecordDecl *, RecordDecl *> RecordDefinitions;
1340SmallVector<Stmt *, 16> StmtStack;
1344Read_None, Read_Decl, Read_Type, Read_Stmt
1348ReadingKind ReadingKind = Read_None;
1351 classReadingKindTracker {
1353 enumReadingKind PrevKind;
1356ReadingKindTracker(
enumReadingKind newKind, ASTReader &reader)
1357: Reader(reader), PrevKind(Reader.ReadingKind) {
1358Reader.ReadingKind = newKind;
1361ReadingKindTracker(
constReadingKindTracker &) =
delete;
1362ReadingKindTracker &operator=(
constReadingKindTracker &) =
delete;
1363~ReadingKindTracker() { Reader.ReadingKind = PrevKind; }
1367 classProcessingUpdatesRAIIObj {
1372ProcessingUpdatesRAIIObj(ASTReader &reader)
1373: Reader(reader), PrevState(Reader.ProcessingUpdateRecords) {
1374Reader.ProcessingUpdateRecords =
true;
1377ProcessingUpdatesRAIIObj(
constProcessingUpdatesRAIIObj &) =
delete;
1378ProcessingUpdatesRAIIObj &
1379operator=(
constProcessingUpdatesRAIIObj &) =
delete;
1380~ProcessingUpdatesRAIIObj() { Reader.ProcessingUpdateRecords = PrevState; }
1391std::string SuggestedPredefines;
1393llvm::DenseMap<const Decl *, bool> DefinitionSource;
1395 boolshouldDisableValidationForFile(
constserialization::ModuleFile &M)
const;
1401serialization::InputFileInfo getInputFileInfo(
ModuleFile&F,
unsignedID);
1405serialization::InputFile getInputFile(
ModuleFile&F,
unsignedID,
1406 boolComplain =
true);
1409SmallString<0> PathBuf;
1412 classTemporarilyOwnedStringRef {
1417TemporarilyOwnedStringRef(StringRef S, SmallString<0> &UnderlyingBuffer)
1418: String(S), UnderlyingBuffer(UnderlyingBuffer, {}) {}
1421 constStringRef *operator->() const & {
return&String; }
1422 constStringRef &
operator*() const & {
returnString; }
1425 constStringRef *operator->() && =
delete;
1426 constStringRef &
operator*() && =
delete;
1435 staticTemporarilyOwnedStringRef
1439 staticTemporarilyOwnedStringRef
1455 D=
D->getCanonicalDecl();
1456 if(
D->isFromASTFile())
1459 autoI = KeyDecls.find(
D);
1460 if(I == KeyDecls.end() || I->second.empty())
1469 template<
typenameFn>
1471 D=
D->getCanonicalDecl();
1472 if(
D->isFromASTFile())
1475 autoIt = KeyDecls.find(
const_cast<Decl*
>(
D));
1476 if(It != KeyDecls.end())
1477 for(
autoID : It->second)
1500 structImportedModule {
1508: Mod(Mod), ImportedBy(ImportedBy), ImportLoc(ImportLoc) {}
1512SourceLocation ImportLoc,
ModuleFile*ImportedBy,
1513SmallVectorImpl<ImportedModule> &Loaded,
1514off_t ExpectedSize, time_t ExpectedModTime,
1515ASTFileSignature ExpectedSignature,
1516 unsignedClientLoadCapabilities);
1518SmallVectorImpl<ImportedModule> &Loaded,
1520 unsignedClientLoadCapabilities);
1522ReadOptionsBlock(llvm::BitstreamCursor &Stream, StringRef
Filename,
1523 unsignedClientLoadCapabilities,
1524 boolAllowCompatibleConfigurationMismatch,
1525ASTReaderListener &Listener,
1526std::string &SuggestedPredefines);
1533 unsignedClientLoadCapabilities);
1537 unsignedClientLoadCapabilities,
1538 boolAllowCompatibleConfigurationMismatch, ASTReaderListener *Listener,
1539 boolValidateDiagnosticOptions);
1541llvm::Error ReadASTBlock(
ModuleFile&F,
unsignedClientLoadCapabilities);
1542llvm::Error ReadExtensionBlock(
ModuleFile&F);
1543 voidReadModuleOffsetMap(
ModuleFile&F)
const;
1545llvm::Error ReadSourceManagerBlock(
ModuleFile&F);
1546SourceLocation getImportLocation(
ModuleFile*F);
1549 unsignedClientLoadCapabilities);
1550llvm::Error ReadSubmoduleBlock(
ModuleFile&F,
1551 unsignedClientLoadCapabilities);
1553StringRef ModuleFilename,
boolComplain,
1554ASTReaderListener &Listener,
1555 boolAllowCompatibleDifferences);
1557StringRef ModuleFilename,
boolComplain,
1558ASTReaderListener &Listener,
1559 boolAllowCompatibleDifferences);
1561StringRef ModuleFilename,
boolComplain,
1562ASTReaderListener &Listener);
1563 static boolParseFileSystemOptions(
const RecordData&
Record,
boolComplain,
1564ASTReaderListener &Listener);
1566StringRef ModuleFilename,
boolComplain,
1567ASTReaderListener &Listener);
1568 static boolParseHeaderSearchPaths(
const RecordData&
Record,
boolComplain,
1569ASTReaderListener &Listener);
1571StringRef ModuleFilename,
boolComplain,
1572ASTReaderListener &Listener,
1573std::string &SuggestedPredefines);
1575 structRecordLocation {
1579RecordLocation(
ModuleFile*M, uint64_t O) : F(M), Offset(O) {}
1584 voidLoadedDecl(
unsignedIndex, Decl *
D);
1585 Decl*ReadDeclRecord(GlobalDeclID ID);
1586 voidmarkIncompleteDeclChain(Decl *
D);
1591 Decl*getMostRecentExistingDecl(Decl *
D);
1593RecordLocation DeclCursorForID(GlobalDeclID ID, SourceLocation &Location);
1594 voidloadDeclUpdateRecords(PendingUpdateRecord &
Record);
1595 voidloadPendingDeclChain(Decl *
D, uint64_t LocalOffset);
1596 voidloadObjCCategories(GlobalDeclID ID, ObjCInterfaceDecl *
D,
1597 unsignedPreviousGeneration = 0);
1599RecordLocation getLocalBitOffset(uint64_t GlobalOffset);
1605findPreprocessedEntity(SourceLocation
Loc,
boolEndsAfter)
const;
1614findNextPreprocessedEntity(
1619std::pair<ModuleFile *, unsigned>
1620getModulePreprocessedEntity(
unsignedGlobalIndex);
1624llvm::iterator_range<PreprocessingRecord::iterator>
1625getModulePreprocessedEntities(
ModuleFile&Mod)
const;
1627 boolcanRecoverFromOutOfDate(StringRef ModuleFileName,
1628 unsignedClientLoadCapabilities);
1632:
publicllvm::iterator_adaptor_base<
1633ModuleDeclIterator, const serialization::unaligned_decl_id_t *,
1634std::random_access_iterator_tag, const Decl *, ptrdiff_t,
1635const Decl *, const Decl *> {
1644: iterator_adaptor_base(Pos), Reader(Reader), Mod(Mod) {}
1654assert(Reader == RHS.Reader && Mod == RHS.Mod);
1659llvm::iterator_range<ModuleDeclIterator>
1663 boolisConsumerInterestedIn(
Decl*
D);
1664 voidPassInterestingDeclsToConsumer();
1665 voidPassInterestingDeclToConsumer(
Decl*
D);
1668 voidfinishPendingActions();
1669 voiddiagnoseOdrViolations();
1676PendingDeclContextInfo Info = {
D, SemaDC, LexicalDC };
1677PendingDeclContextInfos.push_back(Info);
1684 voidError(StringRef Msg)
const;
1685 voidError(
unsignedDiagID, StringRef Arg1 = StringRef(),
1686StringRef Arg2 = StringRef(), StringRef Arg3 = StringRef())
const;
1687 voidError(llvm::Error &&Err)
const;
1690 unsignedtranslateGlobalDeclIDToIndex(GlobalDeclID ID)
const;
1694std::pair<ModuleFile *, unsigned>
1699std::pair<ModuleFile *, unsigned>
1745 ASTReader(Preprocessor &PP, InMemoryModuleCache &ModuleCache,
1746ASTContext *Context,
constPCHContainerReader &PCHContainerRdr,
1747ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
1748StringRef isysroot =
"",
1751 boolAllowASTWithCompilerErrors =
false,
1752 boolAllowConfigurationMismatch =
false,
1753 boolValidateSystemInputs =
false,
1754 boolValidateASTInputFilesContent =
false,
1755 boolUseGlobalIndex =
true,
1756std::unique_ptr<llvm::Timer> ReadTimer = {});
1819 unsignedClientLoadCapabilities,
1820 ModuleFile**NewLoadedModuleFile =
nullptr);
1844 returnstd::move(Listener);
1849this->Listener = std::move(Listener);
1857L = std::make_unique<ChainedASTReaderListener>(std::move(L),
1858std::move(Listener));
1859Listener = std::move(L);
1865 boolChained =
false;
1873L = std::make_unique<ChainedASTReaderListener>(std::move(L),
1889 boolTakeOwnership =
false);
1893 returnDeserializationListener;
1922std::unique_ptr<llvm::MemoryBuffer> Buffer) {
1972StringRef ExistingModuleCachePath,
1973 boolRequireStrictOptionMatches =
false);
1988std::pair<unsigned, unsigned>
2006 returnTotalNumSLocEntries;
2011 return static_cast<unsigned>(IdentifiersLoaded.size());
2016 return static_cast<unsigned>(MacrosLoaded.size());
2021 return static_cast<unsigned>(TypesLoaded.size());
2026 return static_cast<unsigned>(DeclsLoaded.size());
2031 return static_cast<unsigned>(SubmodulesLoaded.size());
2036 return static_cast<unsigned>(SelectorsLoaded.size());
2043 for(
const auto&M : ModuleMgr)
2044 Result+= M.NumPreprocessedEntities;
2062 if(Idx >=
Record.size())
2130 template<
typenameT>
2154uint64_t *StartOfBlockOffset =
nullptr);
2184llvm::function_ref<
bool(
Decl::Kind)> IsKindWeWant,
2253llvm::MapVector<NamedDecl *, SourceLocation> &Undefined)
override;
2277 SmallVectorImpl<std::pair<Selector, SourceLocation>> &Sels)
override;
2280 SmallVectorImpl<std::pair<IdentifierInfo *, WeakInfo>> &WeakIDs)
override;
2289llvm::MapVector<
const FunctionDecl*, std::unique_ptr<LateParsedTemplate>>
2309llvm::function_ref<
void()> Fn);
2355 unsignedLocalID)
const;
2394 unsignedLocalID)
const;
2408std::pair<SourceLocation, unsigned>
2418ReadModuleOffsetMap(MF);
2425 "Run out source location space");
2434 if(
Loc.isInvalid())
2455 unsigned&Idx)
const{
2461assert(FID.ID >= 0 &&
"Reading non-local FileID.");
2469 unsigned&Idx, LocSeq *
Seq=
nullptr);
2472 constStringRef Blob);
2486 unsigned&Idx, StringRef &Blob);
2502assert(ReadingKind == Read_Stmt &&
2503 "Should be called only during statement reading!");
2506assert(!StmtStack.empty() &&
"Read too many sub-statements!");
2507 returnStmtStack.pop_back_val();
2531uint32_t MacroDirectivesOffset);
2547assert(ContextObj &&
"requested AST context when not loading AST");
2594 boolIncludeSystem,
boolComplain,
2596 boolisSystem)> Visitor);
2609 constexpr staticuint32_t BitsIndexUpbound = 32;
2621CurrentBitsIndex = 0;
2624 void advance(uint32_t BitsWidth) { CurrentBitsIndex += BitsWidth; }
2628 return Value& (1 << CurrentBitsIndex++);
2633assert(Width < BitsIndexUpbound);
2634uint32_t Ret = (
Value>> CurrentBitsIndex) & ((1 << Width) - 1);
2635CurrentBitsIndex += Width;
2640 returnCurrentBitsIndex + Width < BitsIndexUpbound;
2644 boolisValid()
const{
returnCurrentBitsIndex < BitsIndexUpbound; }
2647uint32_t CurrentBitsIndex = ~0;
Defines the Diagnostic-related interfaces.
clang::CharUnits operator*(clang::CharUnits::QuantityType Scale, const clang::CharUnits &CU)
enum clang::sema::@1704::IndirectLocalPathEntry::EntryKind Kind
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
llvm::MachO::Record Record
Defines the clang::OpenCLOptions class.
Defines the clang::SourceLocation class and associated facilities.
Defines a utilitiy for warning once when close to out of stack space.
C Language Family Type Representation.
Defines version macros and version-related utility functions for Clang.
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const LangOptions & getLangOpts() const
An identifier-lookup iterator that enumerates all of the identifiers stored within a set of AST files...
Abstract interface for callback invocations by the ASTReader.
virtual void ReadModuleMapFile(StringRef ModuleMapPath)
virtual bool needsInputFileVisitation()
Returns true if this ASTReaderListener wants to receive the input files of the AST file via visitInpu...
virtual bool ReadTargetOptions(const TargetOptions &TargetOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences)
Receives the target options.
virtual bool visitInputFile(StringRef Filename, bool isSystem, bool isOverridden, bool isExplicitModule)
if needsInputFileVisitation returns true, this is called for each non-system input file of the AST Fi...
virtual bool ReadDiagnosticOptions(IntrusiveRefCntPtr< DiagnosticOptions > DiagOpts, StringRef ModuleFilename, bool Complain)
Receives the diagnostic options.
virtual bool ReadHeaderSearchPaths(const HeaderSearchOptions &HSOpts, bool Complain)
Receives the header search paths.
virtual bool ReadFileSystemOptions(const FileSystemOptions &FSOpts, bool Complain)
Receives the file system options.
virtual ~ASTReaderListener()
virtual bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, StringRef ModuleFilename, bool ReadMacros, bool Complain, std::string &SuggestedPredefines)
Receives the preprocessor options.
virtual bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef ModuleFilename, StringRef SpecificModuleCachePath, bool Complain)
Receives the header search options.
virtual void readModuleFileExtension(const ModuleFileExtensionMetadata &Metadata)
Indicates that a particular module file extension has been read.
virtual bool ReadLanguageOptions(const LangOptions &LangOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences)
Receives the language options.
virtual void visitImport(StringRef ModuleName, StringRef Filename)
If needsImportVisitation returns true, this is called for each AST file imported by this AST file.
virtual void visitModuleFile(StringRef Filename, serialization::ModuleKind Kind)
This is called for each AST file loaded.
virtual bool needsImportVisitation() const
Returns true if this ASTReaderListener wants to receive the imports of the AST file via visitImport,...
virtual bool ReadFullVersionInformation(StringRef FullVersion)
Receives the full Clang version information.
virtual void ReadCounter(const serialization::ModuleFile &M, unsigned Value)
Receives COUNTER value.
virtual void ReadModuleName(StringRef ModuleName)
virtual bool needsSystemInputFileVisitation()
Returns true if this ASTReaderListener wants to receive the system input files of the AST file via vi...
RAII object to temporarily add an AST callback listener.
ListenerScope(ASTReader &Reader, std::unique_ptr< ASTReaderListener > L)
value_type operator*() const
value_type operator->() const
bool operator==(const ModuleDeclIterator &RHS) const
ModuleDeclIterator(ASTReader *Reader, ModuleFile *Mod, const serialization::unaligned_decl_id_t *Pos)
Reads an AST files chain containing the contents of a translation unit.
std::optional< bool > isPreprocessedEntityInFileID(unsigned Index, FileID FID) override
Optionally returns true or false if the preallocated preprocessed entity with index Index came from f...
PreprocessedEntity * ReadPreprocessedEntity(unsigned Index) override
Read a preallocated preprocessed entity from the external source.
void markIdentifierUpToDate(const IdentifierInfo *II)
Note that this identifier is up-to-date.
void visitTopLevelModuleMaps(serialization::ModuleFile &MF, llvm::function_ref< void(FileEntryRef)> Visitor)
Visit all the top-level module maps loaded when building the given module file.
void setDeserializationListener(ASTDeserializationListener *Listener, bool TakeOwnership=false)
Set the AST deserialization listener.
SmallVectorImpl< uint64_t > RecordDataImpl
serialization::SubmoduleID getGlobalSubmoduleID(ModuleFile &M, unsigned LocalID) const
Retrieve the global submodule ID given a module and its local ID number.
ExtKind hasExternalDefinitions(const Decl *D) override
IdentifierTable & getIdentifierTable()
Retrieve the identifier table associated with the preprocessor.
SourceLocationEncoding::RawLocEncoding RawLocEncoding
ModuleManager & getModuleManager()
Retrieve the module manager.
ASTReader & operator=(const ASTReader &)=delete
bool isDeclIDFromModule(GlobalDeclID ID, ModuleFile &M) const
Returns true if global DeclID ID originated from module M.
bool ReadSLocEntry(int ID) override
Read the source location entry with index ID.
void RecordSwitchCaseID(SwitchCase *SC, unsigned ID)
Record that the given ID maps to the given switch-case statement.
DiagnosticBuilder Diag(unsigned DiagID) const
Report a diagnostic.
unsigned getTotalNumPreprocessedEntities() const
Returns the number of preprocessed entities known to the AST reader.
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
Decl * ReadDecl(ModuleFile &F, const RecordDataImpl &R, unsigned &I)
Reads a declaration from the given position in a record in the given module.
ModuleManager::ModuleIterator ModuleIterator
static std::string ReadString(const RecordDataImpl &Record, unsigned &Idx)
void ReadDeclsToCheckForDeferredDiags(llvm::SmallSetVector< Decl *, 4 > &Decls) override
Read the set of decls to be checked for deferred diags.
void InitializeSema(Sema &S) override
Initialize the semantic source with the Sema instance being used to perform semantic analysis on the ...
LoadFailureCapabilities
Flags that indicate what kind of AST loading failures the client of the AST reader can directly handl...
@ ARR_Missing
The client can handle an AST file that cannot load because it is missing.
@ ARR_None
The client can't handle any AST loading failures.
@ ARR_ConfigurationMismatch
The client can handle an AST file that cannot load because it's compiled configuration doesn't match ...
@ ARR_OutOfDate
The client can handle an AST file that cannot load because it is out-of-date relative to its input fi...
@ ARR_TreatModuleWithErrorsAsOutOfDate
If a module file is marked with errors treat it as out-of-date so the caller can rebuild it.
@ ARR_VersionMismatch
The client can handle an AST file that cannot load because it was built with a different version of C...
void ReadMismatchingDeleteExpressions(llvm::MapVector< FieldDecl *, llvm::SmallVector< std::pair< SourceLocation, bool >, 4 > > &Exprs) override
void FindFileRegionDecls(FileID File, unsigned Offset, unsigned Length, SmallVectorImpl< Decl * > &Decls) override
Get the decls that are contained in a file in the Offset/Length range.
std::string ReadPathBlob(StringRef BaseDirectory, const RecordData &Record, unsigned &Idx, StringRef &Blob)
SourceRange ReadSkippedRange(unsigned Index) override
Read a preallocated skipped range from the external source.
serialization::TypeID getGlobalTypeID(ModuleFile &F, serialization::LocalTypeID LocalID) const
Map a local type ID within a given AST file into a global type ID.
const std::string & getSuggestedPredefines()
Returns the suggested contents of the predefines buffer, which contains a (typically-empty) subset of...
void dump()
Dump information about the AST reader to standard error.
MacroInfo * ReadMacroRecord(ModuleFile &F, uint64_t Offset)
Reads the macro record located at the given offset.
SmallVector< std::pair< llvm::BitstreamCursor, serialization::ModuleFile * >, 8 > CommentsCursors
Cursors for comments blocks.
Selector getLocalSelector(ModuleFile &M, unsigned LocalID)
Retrieve a selector from the given module with its local ID number.
void FindExternalLexicalDecls(const DeclContext *DC, llvm::function_ref< bool(Decl::Kind)> IsKindWeWant, SmallVectorImpl< Decl * > &Decls) override
Read all of the declarations lexically stored in a declaration context.
ModuleFile * getOwningModuleFile(const Decl *D) const
Retrieve the module file that owns the given declaration, or NULL if the declaration is not from a mo...
std::optional< ASTSourceDescriptor > getSourceDescriptor(unsigned ID) override
Return a descriptor for the corresponding module.
const serialization::reader::DeclContextLookupTable * getLoadedLookupTables(DeclContext *Primary) const
Get the loaded lookup tables for Primary, if any.
T * ReadDeclAs(ModuleFile &F, const RecordDataImpl &R, unsigned &I)
Reads a declaration from the given position in a record in the given module.
QualType getLocalType(ModuleFile &F, serialization::LocalTypeID LocalID)
Resolve a local type ID within a given AST file into a type.
void ClearSwitchCaseIDs()
Sema::AlignPackInfo ReadAlignPackInfo(uint32_t Raw) const
Read a AlignPackInfo from raw form.
QualType readType(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a type from the current position in the given record, which was read from the given AST file.
SourceLocation ReadSourceLocation(ModuleFile &MF, RawLocEncoding Raw, LocSeq *Seq=nullptr) const
Read a source location from raw form.
void SetGloballyVisibleDecls(IdentifierInfo *II, const SmallVectorImpl< GlobalDeclID > &DeclIDs, SmallVectorImpl< Decl * > *Decls=nullptr)
Set the globally-visible declarations associated with the given identifier.
serialization::ModuleKind ModuleKind
bool loadGlobalIndex()
Attempts to load the global index.
void ReadComments() override
Loads comments ranges.
SourceManager & getSourceManager() const
const serialization::reader::ModuleLocalLookupTable * getModuleLocalLookupTables(DeclContext *Primary) const
SourceLocation getSourceLocationForDeclID(GlobalDeclID ID)
Returns the source location for the decl ID.
void makeModuleVisible(Module *Mod, Module::NameVisibilityKind NameVisibility, SourceLocation ImportLoc)
Make the entities in the given module and any of its (non-explicit) submodules visible to name lookup...
unsigned getTotalNumSubmodules() const
Returns the number of submodules known.
ASTReader(const ASTReader &)=delete
bool LoadExternalSpecializations(const Decl *D, bool OnlyPartial) override
Load all the external specializations for the Decl.
void finalizeForWriting()
Finalizes the AST reader's state before writing an AST file to disk.
Sema * getSema()
Retrieve the semantic analysis object used to analyze the translation unit in which the precompiled h...
static std::string ResolveImportedPathAndAllocate(SmallString< 0 > &Buf, StringRef Path, ModuleFile &ModF)
Resolve Path in the context of module file M.
static StringRef ReadStringBlob(const RecordDataImpl &Record, unsigned &Idx, StringRef &Blob)
unsigned getTotalNumIdentifiers() const
Returns the number of identifiers found in the chain.
CXXCtorInitializer ** GetExternalCXXCtorInitializers(uint64_t Offset) override
Read the contents of a CXXCtorInitializer array.
void visitInputFileInfos(serialization::ModuleFile &MF, bool IncludeSystem, llvm::function_ref< void(const serialization::InputFileInfo &IFI, bool IsSystem)> Visitor)
Visit all the input file infos of the given module file.
const ModuleManager & getModuleManager() const
unsigned getTotalNumSLocs() const
Returns the number of source locations found in the chain.
void StartTranslationUnit(ASTConsumer *Consumer) override
Function that will be invoked when we begin parsing a new translation unit involving this external AS...
LocalDeclID mapGlobalIDToModuleFileGlobalID(ModuleFile &M, GlobalDeclID GlobalID)
Map a global declaration ID into the declaration ID used to refer to this declaration within the give...
void resolvePendingMacro(IdentifierInfo *II, const PendingMacroInfo &PMInfo)
void ReadTentativeDefinitions(SmallVectorImpl< VarDecl * > &TentativeDefs) override
Read the set of tentative definitions known to the external Sema source.
Decl * GetExternalDecl(GlobalDeclID ID) override
Resolve a declaration ID into a declaration, potentially building a new declaration.
std::pair< SourceLocation, unsigned > ReadUntranslatedSourceLocation(RawLocEncoding Raw, LocSeq *Seq=nullptr) const
Read a source location from raw form and return it in its originating module file's source location s...
GlobalDeclID ReadDeclID(ModuleFile &F, const RecordDataImpl &Record, unsigned &Idx)
Reads a declaration ID from the given position in a record in the given module.
llvm::Expected< SourceLocation::UIntTy > readSLocOffset(ModuleFile *F, unsigned Index)
Try to read the offset of the SLocEntry at the given index in the given module file.
void forEachImportedKeyDecl(const Decl *D, Fn Visit)
Run a callback on each imported key declaration of D.
bool haveUnloadedSpecializations(const Decl *D) const
If we have any unloaded specialization for D.
Stmt * ReadSubStmt()
Reads a sub-statement operand during statement reading.
void CompleteRedeclChain(const Decl *D) override
If any redeclarations of D have been imported since it was last checked, this digs out those redeclar...
Expr * ReadSubExpr()
Reads a sub-expression operand during statement reading.
SourceLocation TranslateSourceLocation(ModuleFile &ModuleFile, SourceLocation Loc) const
Translate a source location from another module file's source location space into ours.
static llvm::Error ReadBlockAbbrevs(llvm::BitstreamCursor &Cursor, unsigned BlockID, uint64_t *StartOfBlockOffset=nullptr)
ReadBlockAbbrevs - Enter a subblock of the specified BlockID with the specified cursor.
void SetIdentifierInfo(serialization::IdentifierID ID, IdentifierInfo *II)
serialization::PreprocessedEntityID getGlobalPreprocessedEntityID(ModuleFile &M, unsigned LocalID) const
Determine the global preprocessed entity ID that corresponds to the given local ID within the given m...
std::pair< unsigned, unsigned > findPreprocessedEntitiesInRange(SourceRange Range) override
Returns a pair of [Begin, End) indices of preallocated preprocessed entities that Range encompasses.
IdentifierInfo * get(StringRef Name) override
Retrieve the IdentifierInfo for the named identifier.
IdentifierInfo * getLocalIdentifier(ModuleFile &M, uint64_t LocalID)
void visitInputFiles(serialization::ModuleFile &MF, bool IncludeSystem, bool Complain, llvm::function_ref< void(const serialization::InputFile &IF, bool isSystem)> Visitor)
Visit all the input files of the given module file.
Module * getModule(unsigned ID) override
Retrieve the module that corresponds to the given module ID.
llvm::iterator_range< ModuleDeclIterator > getModuleFileLevelDecls(ModuleFile &Mod)
Stmt * GetExternalDeclStmt(uint64_t Offset) override
Resolve the offset of a statement into a statement.
Selector GetExternalSelector(serialization::SelectorID ID) override
Resolve a selector ID into a selector.
unsigned getTotalNumSelectors() const
Returns the number of selectors found in the chain.
MacroInfo * getMacro(serialization::MacroID ID)
Retrieve the macro with the given ID.
void ReadUndefinedButUsed(llvm::MapVector< NamedDecl *, SourceLocation > &Undefined) override
Load the set of used but not defined functions or variables with internal linkage,...
void ReadDelegatingConstructors(SmallVectorImpl< CXXConstructorDecl * > &Decls) override
Read the set of delegating constructors known to the external Sema source.
unsigned getTotalNumTypes() const
Returns the number of types found in the chain.
QualType GetType(serialization::TypeID ID)
Resolve a type ID into a type, potentially building a new type.
void addPendingMacro(IdentifierInfo *II, ModuleFile *M, uint32_t MacroDirectivesOffset)
Add a macro to deserialize its macro directive history.
SourceRange ReadSourceRange(ModuleFile &F, const RecordData &Record, unsigned &Idx, LocSeq *Seq=nullptr)
Read a source range.
GlobalDeclID getGlobalDeclID(ModuleFile &F, LocalDeclID LocalID) const
Map from a local declaration ID within a given module to a global declaration ID.
Expr * ReadExpr(ModuleFile &F)
Reads an expression.
void ReadWeakUndeclaredIdentifiers(SmallVectorImpl< std::pair< IdentifierInfo *, WeakInfo > > &WeakIDs) override
Read the set of weak, undeclared identifiers known to the external Sema source.
void completeVisibleDeclsMap(const DeclContext *DC) override
Load all external visible decls in the given DeclContext.
void AssignedLambdaNumbering(CXXRecordDecl *Lambda) override
Notify the external source that a lambda was assigned a mangling number.
void ReadUnusedLocalTypedefNameCandidates(llvm::SmallSetVector< const TypedefNameDecl *, 4 > &Decls) override
Read the set of potentially unused typedefs known to the source.
IdentifierResolver & getIdResolver()
Get the identifier resolver used for name lookup / updates in the translation unit scope.
static bool readASTFileControlBlock(StringRef Filename, FileManager &FileMgr, const InMemoryModuleCache &ModuleCache, const PCHContainerReader &PCHContainerRdr, bool FindModuleFileExtensions, ASTReaderListener &Listener, bool ValidateDiagnosticOptions, unsigned ClientLoadCapabilities=ARR_ConfigurationMismatch|ARR_OutOfDate)
Read the control block for the named AST file.
void ReadExtVectorDecls(SmallVectorImpl< TypedefNameDecl * > &Decls) override
Read the set of ext_vector type declarations known to the external Sema source.
SmallVector< GlobalDeclID, 16 > PreloadedDeclIDs
std::pair< SourceLocation, StringRef > getModuleImportLoc(int ID) override
Retrieve the module import location and module name for the given source manager entry ID.
void ReadUnusedFileScopedDecls(SmallVectorImpl< const DeclaratorDecl * > &Decls) override
Read the set of unused file-scope declarations known to the external Sema source.
void ReadReferencedSelectors(SmallVectorImpl< std::pair< Selector, SourceLocation > > &Sels) override
Read the set of referenced selectors known to the external Sema source.
Selector DecodeSelector(serialization::SelectorID Idx)
ASTReadResult ReadAST(StringRef FileName, ModuleKind Type, SourceLocation ImportLoc, unsigned ClientLoadCapabilities, ModuleFile **NewLoadedModuleFile=nullptr)
Load the AST file designated by the given file name.
StringRef getOriginalSourceFile()
Retrieve the name of the original source file name for the primary module file.
std::string ReadPath(ModuleFile &F, const RecordData &Record, unsigned &Idx)
ASTDeserializationListener * getDeserializationListener()
Get the AST deserialization listener.
void addListener(std::unique_ptr< ASTReaderListener > L)
Add an AST callback listener.
unsigned getModuleFileID(ModuleFile *M)
Get an ID for the given module file.
Decl * getKeyDeclaration(Decl *D)
Returns the first key declaration for the given declaration.
bool FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name, const DeclContext *OriginalDC) override
Finds all the visible declarations with a given name.
void setListener(std::unique_ptr< ASTReaderListener > Listener)
Set the AST callbacks listener.
Selector ReadSelector(ModuleFile &M, const RecordData &Record, unsigned &Idx)
ModuleManager::ModuleReverseIterator ModuleReverseIterator
IdentifierInfo * DecodeIdentifierInfo(serialization::IdentifierID ID)
ASTReadResult
The result of reading the control block of an AST file, which can fail for various reasons.
@ Success
The control block was read successfully.
@ ConfigurationMismatch
The AST file was written with a different language/target configuration.
@ OutOfDate
The AST file is out-of-date relative to its input files, and needs to be regenerated.
@ Failure
The AST file itself appears corrupted.
@ VersionMismatch
The AST file was written by a different version of Clang.
@ HadErrors
The AST file has errors.
@ Missing
The AST file was missing.
void addInMemoryBuffer(StringRef &FileName, std::unique_ptr< llvm::MemoryBuffer > Buffer)
Add in-memory (virtual file) buffer.
static VersionTuple ReadVersionTuple(const RecordData &Record, unsigned &Idx)
Read a version tuple.
SmallString< 0 > & getPathBuf()
Get the buffer for resolving paths.
Token ReadToken(ModuleFile &M, const RecordDataImpl &Record, unsigned &Idx)
Reads a token out of a record.
SwitchCase * getSwitchCaseWithID(unsigned ID)
Retrieve the switch-case statement with the given ID.
serialization::IdentifierID getGlobalIdentifierID(ModuleFile &M, uint64_t LocalID)
FileID TranslateFileID(ModuleFile &F, FileID FID) const
Translate a FileID from another module file's FileID space into ours.
void ReadLateParsedTemplates(llvm::MapVector< const FunctionDecl *, std::unique_ptr< LateParsedTemplate > > &LPTMap) override
Read the set of late parsed template functions for this source.
IdentifierIterator * getIdentifiers() override
Retrieve an iterator into the set of all identifiers in all loaded AST files.
void ReadUsedVTables(SmallVectorImpl< ExternalVTableUse > &VTables) override
Read the set of used vtables known to the external Sema source.
bool isGlobalIndexUnavailable() const
Determine whether we tried to load the global index, but failed, e.g., because it is out-of-date or d...
uint32_t GetNumExternalSelectors() override
Returns the number of selectors known to the external AST source.
static TemporarilyOwnedStringRef ResolveImportedPath(SmallString< 0 > &Buf, StringRef Path, ModuleFile &ModF)
Resolve Path in the context of module file M.
void updateOutOfDateSelector(Selector Sel) override
Load the contents of the global method pool for a given selector if necessary.
Decl * GetExistingDecl(GlobalDeclID ID)
Resolve a declaration ID into a declaration.
Stmt * ReadStmt(ModuleFile &F)
Reads a statement.
static llvm::BitVector ReadBitVector(const RecordData &Record, const StringRef Blob)
ModuleFile * getLocalModuleFile(ModuleFile &M, unsigned ID) const
Retrieve the module file with a given local ID within the specified ModuleFile.
void ForgetSema() override
Inform the semantic consumer that Sema is no longer available.
DiagnosticsEngine & getDiags() const
void LoadSelector(Selector Sel)
Load a selector from disk, registering its ID if it exists.
void ReadPragmaDiagnosticMappings(DiagnosticsEngine &Diag)
void makeNamesVisible(const HiddenNames &Names, Module *Owner)
Make the names within this set of hidden names visible.
void UpdateSema()
Update the state of Sema after loading some additional modules.
Decl * GetDecl(GlobalDeclID ID)
Resolve a declaration ID into a declaration, potentially building a new declaration.
Decl * GetLocalDecl(ModuleFile &F, LocalDeclID LocalID)
Reads a declaration with the given local ID in the given module.
bool isProcessingUpdateRecords()
T * GetLocalDeclAs(ModuleFile &F, LocalDeclID LocalID)
Reads a declaration with the given local ID in the given module.
ASTReader(Preprocessor &PP, InMemoryModuleCache &ModuleCache, ASTContext *Context, const PCHContainerReader &PCHContainerRdr, ArrayRef< std::shared_ptr< ModuleFileExtension > > Extensions, StringRef isysroot="", DisableValidationForModuleKind DisableValidationKind=DisableValidationForModuleKind::None, bool AllowASTWithCompilerErrors=false, bool AllowConfigurationMismatch=false, bool ValidateSystemInputs=false, bool ValidateASTInputFilesContent=false, bool UseGlobalIndex=true, std::unique_ptr< llvm::Timer > ReadTimer={})
Load the AST file and validate its contents against the given Preprocessor.
int getSLocEntryID(SourceLocation::UIntTy SLocOffset) override
Get the index ID for the loaded SourceLocation offset.
void ReadPendingInstantiations(SmallVectorImpl< std::pair< ValueDecl *, SourceLocation > > &Pending) override
Read the set of pending instantiations known to the external Sema source.
Preprocessor & getPreprocessor() const
Retrieve the preprocessor.
serialization::reader::LazySpecializationInfoLookupTable * getLoadedSpecializationsLookupTables(const Decl *D, bool IsPartial)
Get the loaded specializations lookup tables for D, if any.
CXXTemporary * ReadCXXTemporary(ModuleFile &F, const RecordData &Record, unsigned &Idx)
void ReadKnownNamespaces(SmallVectorImpl< NamespaceDecl * > &Namespaces) override
Load the set of namespaces that are known to the external source, which will be used during typo corr...
const Decl * getKeyDeclaration(const Decl *D)
ModuleManager::ModuleConstIterator ModuleConstIterator
Module * getSubmodule(serialization::SubmoduleID GlobalID)
Retrieve the submodule that corresponds to a global submodule ID.
void PrintStats() override
Print some statistics about AST usage.
void mergeDefinitionVisibility(NamedDecl *Def, NamedDecl *MergedDef)
Note that MergedDef is a redefinition of the canonical definition Def, so Def should be visible whene...
serialization::SelectorID getGlobalSelectorID(ModuleFile &M, unsigned LocalID) const
Retrieve the global selector ID that corresponds to this the local selector ID in a given module.
void runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)
SmallVector< uint64_t, 64 > RecordData
unsigned getTotalNumMacros() const
Returns the number of macros found in the chain.
FileID ReadFileID(ModuleFile &F, const RecordDataImpl &Record, unsigned &Idx) const
Read a FileID.
void StartedDeserializing() override
Notify ASTReader that we started deserialization of a decl or type so until FinishedDeserializing is ...
void ReadMethodPool(Selector Sel) override
Load the contents of the global method pool for a given selector.
void InitializeContext()
Initializes the ASTContext.
CXXBaseSpecifier * GetExternalCXXBaseSpecifiers(uint64_t Offset) override
Resolve the offset of a set of C++ base specifiers in the decl stream into an array of specifiers.
std::unique_ptr< ASTReaderListener > takeListener()
Take the AST callbacks listener.
const serialization::reader::DeclContextLookupTable * getTULocalLookupTables(DeclContext *Primary) const
void resetForReload()
Reset reader for a reload try.
FileManager & getFileManager() const
unsigned getTotalNumDecls() const
Returns the number of declarations found in the chain.
static bool isAcceptableASTFile(StringRef Filename, FileManager &FileMgr, const InMemoryModuleCache &ModuleCache, const PCHContainerReader &PCHContainerRdr, const LangOptions &LangOpts, const TargetOptions &TargetOpts, const PreprocessorOptions &PPOpts, StringRef ExistingModuleCachePath, bool RequireStrictOptionMatches=false)
Determine whether the given AST file is acceptable to load into a translation unit with the given lan...
void FinishedDeserializing() override
Notify ASTReader that we finished the deserialization of a decl or type.
IdentifierInfo * readIdentifier(ModuleFile &M, const RecordData &Record, unsigned &Idx)
void updateOutOfDateIdentifier(const IdentifierInfo &II) override
Update an out-of-date identifier.
void ReadDefinedMacros() override
Read the set of macros defined by this external macro source.
GlobalModuleIndex * getGlobalIndex()
Return global module index.
IdentifierInfo * GetIdentifier(serialization::IdentifierID ID) override
Return the identifier associated with the given ID number.
HeaderFileInfo GetHeaderFileInfo(FileEntryRef FE) override
Read the header file information for the given file entry.
SourceLocation ReadSourceLocation(ModuleFile &ModuleFile, const RecordDataImpl &Record, unsigned &Idx, LocSeq *Seq=nullptr)
Read a source location.
serialization::MacroID getGlobalMacroID(ModuleFile &M, unsigned LocalID)
Retrieve the global macro ID corresponding to the given local ID within the given module file.
serialization::ModuleFile ModuleFile
bool hasGlobalIndex() const
Determine whether this AST reader has a global index.
An object for streaming information from a record.
Utility class for loading a ASTContext from an AST file.
Writes an AST file containing the contents of a translation unit.
A simple helper class to unpack an integer to bits and consuming the bits in order.
BitsUnpacker operator=(const BitsUnpacker &)=delete
uint32_t getNextBits(uint32_t Width)
void advance(uint32_t BitsWidth)
bool canGetNextNBits(uint32_t Width) const
BitsUnpacker(BitsUnpacker &&)=delete
BitsUnpacker(const BitsUnpacker &)=delete
void updateValue(uint32_t V)
BitsUnpacker operator=(BitsUnpacker &&)=delete
Represents a base class of a C++ class.
Represents a C++ base or member initializer.
Represents a C++ struct/union/class.
Represents a C++ temporary.
Simple wrapper class for chaining listeners.
bool visitInputFile(StringRef Filename, bool isSystem, bool isOverridden, bool isExplicitModule) override
if needsInputFileVisitation returns true, this is called for each non-system input file of the AST Fi...
std::unique_ptr< ASTReaderListener > takeSecond()
bool ReadFullVersionInformation(StringRef FullVersion) override
Receives the full Clang version information.
bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef ModuleFilename, StringRef SpecificModuleCachePath, bool Complain) override
Receives the header search options.
bool ReadFileSystemOptions(const FileSystemOptions &FSOpts, bool Complain) override
Receives the file system options.
std::unique_ptr< ASTReaderListener > takeFirst()
void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override
Receives COUNTER value.
void ReadModuleMapFile(StringRef ModuleMapPath) override
bool ReadLanguageOptions(const LangOptions &LangOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override
Receives the language options.
bool ReadTargetOptions(const TargetOptions &TargetOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override
Receives the target options.
void ReadModuleName(StringRef ModuleName) override
bool needsInputFileVisitation() override
Returns true if this ASTReaderListener wants to receive the input files of the AST file via visitInpu...
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, StringRef ModuleFilename, bool ReadMacros, bool Complain, std::string &SuggestedPredefines) override
Receives the preprocessor options.
ChainedASTReaderListener(std::unique_ptr< ASTReaderListener > First, std::unique_ptr< ASTReaderListener > Second)
Takes ownership of First and Second.
void readModuleFileExtension(const ModuleFileExtensionMetadata &Metadata) override
Indicates that a particular module file extension has been read.
void visitModuleFile(StringRef Filename, serialization::ModuleKind Kind) override
This is called for each AST file loaded.
bool ReadDiagnosticOptions(IntrusiveRefCntPtr< DiagnosticOptions > DiagOpts, StringRef ModuleFilename, bool Complain) override
Receives the diagnostic options.
bool needsSystemInputFileVisitation() override
Returns true if this ASTReaderListener wants to receive the system input files of the AST file via vi...
A map from continuous integer ranges to some value, with a very specialized interface.
typename Representation::const_iterator const_iterator
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Decl - This represents one declaration (or definition), e.g.
bool isFromGlobalModule() const
Whether this declaration comes from global module.
ASTContext & getASTContext() const LLVM_READONLY
Kind
Lists the kind of concrete classes of Decl.
bool isFromHeaderUnit() const
Whether this declaration comes from a header unit.
The name of a declaration.
A little helper class used to produce diagnostics.
Concrete class used by the front-end to report problems and issues.
This represents one expression.
RAII class for safely pairing a StartedDeserializing call with FinishedDeserializing.
MemoryBufferSizes getMemoryBufferSizes() const
Return the amount of memory used by memory buffers, breaking down by heap-backed versus mmap'ed memor...
An abstract class that should be subclassed by any external source of preprocessing record entries.
Abstract interface for external sources of preprocessor information.
External source of source location entries.
An abstract interface that should be implemented by external AST sources that also provide informatio...
Represents a member of a struct/union/class.
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...
Implements support for file system lookup, file system caching, and directory search management.
Keeps track of options that affect how file operations are performed.
Represents a function declaration or definition.
A global index for a set of module files, providing information about the identifiers within those mo...
Provides lookups to, and iteration over, IdentiferInfo objects.
One of these records is kept for each identifier that is lexed.
An iterator that walks over all of the known identifiers in the lookup table.
IdentifierResolver - Keeps track of shadowed decls on enclosing scopes.
Implements an efficient mapping from strings to IdentifierInfo nodes.
In-memory cache for modules.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
static LocalDeclID get(ASTReader &Reader, serialization::ModuleFile &MF, DeclID ID)
Encapsulates the data about a macro definition (e.g.
Describes a module or submodule.
NameVisibilityKind
Describes the visibility of the various names within a particular module.
This represents a decl that may have a name.
This abstract interface provides operations for unwrapping containers for serialized ASTs (precompile...
ASTReaderListener implementation to validate the information of the PCH file against an initialized P...
bool ReadLanguageOptions(const LangOptions &LangOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override
Receives the language options.
bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef ModuleFilename, StringRef SpecificModuleCachePath, bool Complain) override
Receives the header search options.
bool ReadDiagnosticOptions(IntrusiveRefCntPtr< DiagnosticOptions > DiagOpts, StringRef ModuleFilename, bool Complain) override
Receives the diagnostic options.
PCHValidator(Preprocessor &PP, ASTReader &Reader)
void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override
Receives COUNTER value.
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, StringRef ModuleFilename, bool ReadMacros, bool Complain, std::string &SuggestedPredefines) override
Receives the preprocessor options.
bool ReadTargetOptions(const TargetOptions &TargetOpts, StringRef ModuleFilename, bool Complain, bool AllowCompatibleDifferences) override
Receives the target options.
Base class that describes a preprocessed entity, which may be a preprocessor directive or macro expan...
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
A (possibly-)qualified type.
Smart pointer class that efficiently represents Objective-C method names.
static AlignPackInfo getFromRawEncoding(unsigned Encoding)
Sema - This implements semantic analysis and AST building for C.
ASTReaderListenter implementation to set SuggestedPredefines of ASTReader which is required to use a ...
SimpleASTReaderListener(Preprocessor &PP)
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, StringRef ModuleFilename, bool ReadMacros, bool Complain, std::string &SuggestedPredefines) override
Receives the preprocessor options.
static std::pair< SourceLocation, unsigned > decode(RawLocEncoding, SourceLocationSequence *=nullptr)
Serialized encoding of a sequence of SourceLocations.
Encodes a location in the source.
This class handles loading and caching of source files into memory.
bool isLoadedSourceLocation(SourceLocation Loc) const
Returns true if Loc came from a PCH/Module.
A trivial tuple used to represent a source range.
Stmt - This represents one statement.
Options for controlling the target.
Token - This structure provides full information about a lexed token.
The base class of the type hierarchy.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
The input file that has been loaded from this AST file, along with bools indicating whether this was ...
Information about a module that has been loaded by the ASTReader.
int SLocEntryBaseID
The base ID in the source manager's view of this module.
std::string OriginalSourceFileName
The original source file name that was used to build the primary AST file, which may have been modifi...
StringRef ModuleOffsetMap
The module offset map data for this file.
SourceLocation::UIntTy SLocEntryBaseOffset
The base offset in the source manager's view of this module.
llvm::SmallVector< ModuleFile *, 16 > TransitiveImports
List of modules which this modules dependent on.
Manages the set of modules loaded by an AST reader.
ModuleFile & getPrimaryModule()
Returns the primary module associated with the manager, that is, the first module loaded.
llvm::pointee_iterator< SmallVectorImpl< std::unique_ptr< ModuleFile > >::const_iterator > ModuleConstIterator
void addInMemoryBuffer(StringRef FileName, std::unique_ptr< llvm::MemoryBuffer > Buffer)
Add an in-memory buffer the list of known buffers.
llvm::pointee_iterator< SmallVectorImpl< std::unique_ptr< ModuleFile > >::reverse_iterator > ModuleReverseIterator
llvm::pointee_iterator< SmallVectorImpl< std::unique_ptr< ModuleFile > >::iterator > ModuleIterator
Class that performs lookup for an identifier stored in an AST file.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
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
TypeID LocalTypeID
Same with TypeID except that the LocalTypeID is only meaningful with the corresponding ModuleFile.
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.
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.
@ Seq
'seq' clause, allowed on 'loop' and 'routine' directives.
@ Module
Module linkage, which indicates that the entity can be referred to from other translation units withi...
PredefinedDeclIDs
Predefined declaration IDs.
@ Result
The result type of a method or function.
std::optional< unsigned > getPrimaryModuleHash(const Module *M)
Calculate a hash value for the primary module name of the given module.
const FunctionProtoType * T
DisableValidationForModuleKind
Whether to disable the normal validation performed on precompiled headers and module files when they ...
@ None
Perform validation, don't disable it.
bool shouldSkipCheckingODR(const Decl *D)
std::string getClangFullRepositoryVersion()
Retrieves the full repository version that is an amalgamation of the information in getClangRepositor...
The input file info that has been loaded from an AST file.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4