14 #ifndef LLVM_CLANG_SERIALIZATION_ASTREADER_H 15 #define LLVM_CLANG_SERIALIZATION_ASTREADER_H 42 #include "llvm/ADT/APFloat.h" 43 #include "llvm/ADT/APInt.h" 44 #include "llvm/ADT/APSInt.h" 45 #include "llvm/ADT/ArrayRef.h" 46 #include "llvm/ADT/DenseMap.h" 47 #include "llvm/ADT/DenseSet.h" 48 #include "llvm/ADT/IntrusiveRefCntPtr.h" 49 #include "llvm/ADT/MapVector.h" 50 #include "llvm/ADT/Optional.h" 51 #include "llvm/ADT/STLExtras.h" 52 #include "llvm/ADT/SetVector.h" 53 #include "llvm/ADT/SmallPtrSet.h" 54 #include "llvm/ADT/SmallVector.h" 55 #include "llvm/ADT/StringMap.h" 56 #include "llvm/ADT/StringRef.h" 57 #include "llvm/ADT/iterator.h" 58 #include "llvm/ADT/iterator_range.h" 59 #include "llvm/Bitcode/BitstreamReader.h" 60 #include "llvm/Support/Casting.h" 61 #include "llvm/Support/Endian.h" 62 #include "llvm/Support/MemoryBuffer.h" 63 #include "llvm/Support/Timer.h" 64 #include "llvm/Support/VersionTuple.h" 80 class ASTDeserializationListener;
82 class ASTRecordReader;
92 class FileSystemOptions;
94 class GlobalModuleIndex;
95 struct HeaderFileInfo;
96 class HeaderSearchOptions;
98 class LazyASTUnresolvedSet;
100 class MemoryBufferCache;
103 class ObjCCategoryDecl;
104 class ObjCInterfaceDecl;
105 class PCHContainerReader;
107 class PreprocessorOptions;
108 struct QualifierInfo;
114 class TemplateParameterList;
115 class TypedefNameDecl;
116 class TypeSourceInfo;
146 bool AllowCompatibleDifferences) {
155 bool AllowCompatibleDifferences) {
183 StringRef SpecificModuleCachePath,
198 std::string &SuggestedPredefines) {
225 bool isOverridden,
bool isExplicitModule) {
244 std::unique_ptr<ASTReaderListener>
First;
245 std::unique_ptr<ASTReaderListener> Second;
250 std::unique_ptr<ASTReaderListener> Second)
251 : First(
std::move(First)), Second(
std::move(Second)) {}
253 std::unique_ptr<ASTReaderListener>
takeFirst() {
return std::move(First); }
254 std::unique_ptr<ASTReaderListener>
takeSecond() {
return std::move(Second); }
260 bool AllowCompatibleDifferences)
override;
262 bool AllowCompatibleDifferences)
override;
264 bool Complain)
override;
266 bool Complain)
override;
269 StringRef SpecificModuleCachePath,
270 bool Complain)
override;
273 std::string &SuggestedPredefines)
override;
281 bool isOverridden,
bool isExplicitModule)
override;
294 : PP(PP), Reader(Reader) {}
297 bool AllowCompatibleDifferences)
override;
299 bool AllowCompatibleDifferences)
override;
301 bool Complain)
override;
303 std::string &SuggestedPredefines)
override;
305 StringRef SpecificModuleCachePath,
306 bool Complain)
override;
310 void Error(
const char *Msg);
324 std::string &SuggestedPredefines)
override;
327 namespace serialization {
329 class ReadMethodPoolVisitor;
415 std::unique_ptr<ASTReaderListener> Listener;
420 bool OwnsDeserializationListener =
false;
429 Sema *SemaObj =
nullptr;
452 llvm::StringMap<std::shared_ptr<ModuleFileExtension>> ModuleFileExtensions;
455 std::unique_ptr<llvm::Timer> ReadTimer;
462 std::unique_ptr<GlobalModuleIndex> GlobalIndex;
482 std::vector<QualType> TypesLoaded;
496 std::vector<Decl *> DeclsLoaded;
505 using FileOffset = std::pair<ModuleFile *, uint64_t>;
507 using DeclUpdateOffsetsMap =
508 llvm::DenseMap<serialization::DeclID, FileOffsetsTy>;
512 DeclUpdateOffsetsMap DeclUpdateOffsets;
514 struct PendingUpdateRecord {
523 : D(D),
ID(ID), JustLoaded(JustLoaded) {}
530 enum class PendingFakeDefinitionKind { NotFake, Fake, FakeLoaded };
534 llvm::DenseMap<void *, PendingFakeDefinitionKind> PendingFakeDefinitionData;
540 llvm::SmallMapVector<Decl *, FunctionDecl *, 4> PendingExceptionSpecUpdates;
544 llvm::DenseMap<std::pair<DeclContext *, IdentifierInfo *>,
NamedDecl *>
545 ImportedTypedefNamesForLinkage;
549 llvm::DenseMap<Decl*, llvm::SmallVector<NamedDecl*, 2>>
550 AnonymousDeclarationsForMerging;
552 struct FileDeclsInfo {
556 FileDeclsInfo() =
default;
558 : Mod(Mod), Decls(Decls) {}
562 llvm::DenseMap<FileID, FileDeclsInfo> FileDeclIDs;
569 llvm::DenseMap<const DeclContext*, std::pair<ModuleFile*, LexicalContents>>
573 std::vector<std::pair<ModuleFile*, LexicalContents>> TULexicalDecls;
583 struct PendingVisibleUpdate {
585 const unsigned char *Data;
591 llvm::DenseMap<serialization::DeclID, DeclContextVisibleUpdates>
592 PendingVisibleUpdates;
596 llvm::SmallPtrSet<Decl *, 4> PendingDefinitions;
598 using PendingBodiesMap =
599 llvm::MapVector<
Decl *, uint64_t,
600 llvm::SmallDenseMap<Decl *, unsigned, 4>,
604 PendingBodiesMap PendingBodies;
608 llvm::SetVector<NamedDecl *> PendingMergedDefinitionsToDeduplicate;
611 bool ReadLexicalDeclContextStorage(
ModuleFile &M,
612 llvm::BitstreamCursor &
Cursor,
613 uint64_t
Offset, DeclContext *DC);
616 bool ReadVisibleDeclContextStorage(
ModuleFile &M,
617 llvm::BitstreamCursor &Cursor,
626 std::vector<IdentifierInfo *> IdentifiersLoaded;
642 std::vector<MacroInfo *> MacrosLoaded;
644 using LoadedMacroInfo =
645 std::pair<IdentifierInfo *, serialization::SubmoduleID>;
676 using HiddenNamesMapType = llvm::DenseMap<Module *, HiddenNames>;
680 HiddenNamesMapType HiddenNamesMap;
683 struct UnresolvedModuleRef {
691 enum { Import, Export, Conflict }
Kind;
697 unsigned IsWildcard : 1;
723 llvm::DenseMap<Selector, unsigned> SelectorGeneration;
727 llvm::DenseMap<Selector, bool> SelectorOutOfDate;
729 struct PendingMacroInfo {
731 uint64_t MacroDirectivesOffset;
733 PendingMacroInfo(
ModuleFile *M, uint64_t MacroDirectivesOffset)
734 : M(M), MacroDirectivesOffset(MacroDirectivesOffset) {}
737 using PendingMacroIDsMap =
738 llvm::MapVector<IdentifierInfo *, SmallVector<PendingMacroInfo, 2>>;
742 PendingMacroIDsMap PendingMacroIDs;
833 unsigned ForceCUDAHostDeviceDepth = 0;
858 int PragmaMSStructState = -1;
861 int PragmaMSPointersToMembersState = -1;
867 struct PragmaPackStackEntry {
880 llvm::DenseMap<const Type *, std::set<std::string>> OpenCLTypeExtMap;
883 llvm::DenseMap<const Decl *, std::set<std::string>> OpenCLDeclExtMap;
904 : ID(ID), ImportLoc(ImportLoc) {}
915 std::string isysroot;
919 bool DisableValidation;
922 bool AllowASTWithCompilerErrors;
926 bool AllowConfigurationMismatch;
929 bool ValidateSystemInputs;
935 bool TriedLoadingGlobalIndex =
false;
938 bool ProcessingUpdateRecords =
false;
940 using SwitchCaseMapTy = llvm::DenseMap<unsigned, SwitchCase *>;
946 SwitchCaseMapTy SwitchCaseStmts;
948 SwitchCaseMapTy *CurrSwitchCaseStmts;
952 unsigned NumSLocEntriesRead = 0;
955 unsigned TotalNumSLocEntries = 0;
959 unsigned NumStatementsRead = 0;
963 unsigned TotalNumStatements = 0;
966 unsigned NumMacrosRead = 0;
969 unsigned TotalNumMacros = 0;
972 unsigned NumIdentifierLookups = 0;
975 unsigned NumIdentifierLookupHits = 0;
978 unsigned NumSelectorsRead = 0;
981 unsigned NumMethodPoolEntriesRead = 0;
985 unsigned NumMethodPoolLookups = 0;
989 unsigned NumMethodPoolHits = 0;
993 unsigned NumMethodPoolTableLookups = 0;
997 unsigned NumMethodPoolTableHits = 0;
1000 unsigned TotalNumMethodPoolEntries = 0;
1003 unsigned NumLexicalDeclContextsRead = 0, TotalLexicalDeclContexts = 0;
1006 unsigned NumVisibleDeclContextsRead = 0, TotalVisibleDeclContexts = 0;
1009 uint64_t TotalModulesSizeInBits = 0;
1012 unsigned NumCurrentElementsDeserializing = 0;
1018 bool PassingDeclsToConsumer =
false;
1025 llvm::MapVector<IdentifierInfo *, SmallVector<uint32_t, 4>>
1026 PendingIdentifierInfos;
1030 llvm::SmallMapVector<IdentifierInfo *, SmallVector<NamedDecl*, 2>, 16>
1031 PendingFakeLookupResults;
1035 llvm::DenseMap<IdentifierInfo *, unsigned> IdentifierGeneration;
1037 class InterestingDecl {
1039 bool DeclHasPendingBody;
1042 InterestingDecl(Decl *D,
bool HasBody)
1043 : D(D), DeclHasPendingBody(HasBody) {}
1045 Decl *getDecl() {
return D; }
1048 bool hasPendingBody() {
return DeclHasPendingBody; }
1057 std::deque<InterestingDecl> PotentiallyInterestingDecls;
1062 SmallVector<std::pair<Decl *, uint64_t>, 16> PendingDeclChains;
1070 struct PendingDeclContextInfo {
1081 std::deque<PendingDeclContextInfo> PendingDeclContextInfos;
1091 using DataPointers =
1092 std::pair<CXXRecordDecl *, struct CXXRecordDecl::DefinitionData *>;
1095 llvm::SmallDenseMap<CXXRecordDecl *, llvm::SmallVector<DataPointers, 2>, 2>
1096 PendingOdrMergeFailures;
1099 llvm::SmallDenseMap<FunctionDecl *, llvm::SmallVector<FunctionDecl *, 2>, 2>
1100 PendingFunctionOdrMergeFailures;
1103 llvm::SmallDenseMap<EnumDecl *, llvm::SmallVector<EnumDecl *, 2>, 2>
1104 PendingEnumOdrMergeFailures;
1107 llvm::SmallPtrSet<DeclContext*, 2> DiagnosedOdrMergeFailures;
1111 llvm::SmallPtrSet<ObjCCategoryDecl *, 16> CategoriesDeserialized;
1119 llvm::DenseMap<Decl *, SmallVector<serialization::DeclID, 2>>;
1126 KeyDeclsMap KeyDecls;
1131 llvm::DenseMap<DeclContext *, DeclContext *> MergedDeclContexts;
1135 llvm::DenseMap<EnumDecl *, EnumDecl *> EnumDefinitions;
1142 Read_None, Read_Decl, Read_Type, Read_Stmt
1146 ReadingKind ReadingKind = Read_None;
1149 class ReadingKindTracker {
1151 enum ReadingKind PrevKind;
1154 ReadingKindTracker(
enum ReadingKind newKind,
ASTReader &reader)
1155 : Reader(reader), PrevKind(Reader.ReadingKind) {
1156 Reader.ReadingKind = newKind;
1159 ReadingKindTracker(
const ReadingKindTracker &) =
delete;
1160 ReadingKindTracker &operator=(
const ReadingKindTracker &) =
delete;
1161 ~ReadingKindTracker() { Reader.ReadingKind = PrevKind; }
1165 class ProcessingUpdatesRAIIObj {
1170 ProcessingUpdatesRAIIObj(
ASTReader &reader)
1171 : Reader(reader), PrevState(Reader.ProcessingUpdateRecords) {
1172 Reader.ProcessingUpdateRecords =
true;
1175 ProcessingUpdatesRAIIObj(
const ProcessingUpdatesRAIIObj &) =
delete;
1176 ProcessingUpdatesRAIIObj &
1177 operator=(
const ProcessingUpdatesRAIIObj &) =
delete;
1178 ~ProcessingUpdatesRAIIObj() { Reader.ProcessingUpdateRecords = PrevState; }
1189 std::string SuggestedPredefines;
1191 llvm::DenseMap<const Decl *, bool> DefinitionSource;
1196 struct InputFileInfo {
1202 bool TopLevelModuleMap;
1206 InputFileInfo readInputFileInfo(
ModuleFile &F,
unsigned ID);
1211 bool Complain =
true);
1215 static void ResolveImportedPath(std::string &Filename, StringRef Prefix);
1225 auto I = KeyDecls.find(D);
1226 if (I == KeyDecls.end() || I->second.empty())
1228 return GetExistingDecl(I->second[0]);
1231 return getKeyDeclaration(const_cast<Decl*>(D));
1235 template <
typename Fn>
1241 auto It = KeyDecls.find(const_cast<Decl*>(D));
1242 if (It != KeyDecls.end())
1243 for (
auto ID : It->second)
1244 Visit(GetExistingDecl(ID));
1249 getLoadedLookupTables(DeclContext *Primary)
const;
1252 struct ImportedModule {
1260 : Mod(Mod), ImportedBy(ImportedBy), ImportLoc(ImportLoc) {}
1266 off_t ExpectedSize, time_t ExpectedModTime,
1268 unsigned ClientLoadCapabilities);
1272 unsigned ClientLoadCapabilities);
1274 llvm::BitstreamCursor &Stream,
unsigned ClientLoadCapabilities,
1276 std::string &SuggestedPredefines);
1283 unsigned ClientLoadCapabilities);
1286 readUnhashedControlBlockImpl(
ModuleFile *F, llvm::StringRef StreamData,
1287 unsigned ClientLoadCapabilities,
1288 bool AllowCompatibleConfigurationMismatch,
1290 bool ValidateDiagnosticOptions);
1294 void ReadModuleOffsetMap(
ModuleFile &F)
const;
1297 llvm::BitstreamCursor &SLocCursorForID(
int ID);
1301 unsigned ClientLoadCapabilities);
1303 unsigned ClientLoadCapabilities);
1304 static bool ParseLanguageOptions(
const RecordData &Record,
bool Complain,
1306 bool AllowCompatibleDifferences);
1307 static bool ParseTargetOptions(
const RecordData &Record,
bool Complain,
1309 bool AllowCompatibleDifferences);
1310 static bool ParseDiagnosticOptions(
const RecordData &Record,
bool Complain,
1312 static bool ParseFileSystemOptions(
const RecordData &Record,
bool Complain,
1314 static bool ParseHeaderSearchOptions(
const RecordData &Record,
bool Complain,
1316 static bool ParsePreprocessorOptions(
const RecordData &Record,
bool Complain,
1318 std::string &SuggestedPredefines);
1320 struct RecordLocation {
1327 QualType readTypeRecord(
unsigned Index);
1332 RecordLocation TypeCursorForIndex(
unsigned Index);
1333 void LoadedDecl(
unsigned Index, Decl *D);
1335 void markIncompleteDeclChain(Decl *Canon);
1340 Decl *getMostRecentExistingDecl(Decl *D);
1344 void loadDeclUpdateRecords(PendingUpdateRecord &Record);
1345 void loadPendingDeclChain(Decl *D, uint64_t LocalOffset);
1347 unsigned PreviousGeneration = 0);
1349 RecordLocation getLocalBitOffset(uint64_t GlobalOffset);
1350 uint64_t getGlobalBitOffset(ModuleFile &M, uint32_t LocalOffset);
1355 findPreprocessedEntity(
SourceLocation Loc,
bool EndsAfter)
const;
1364 findNextPreprocessedEntity(
1365 GlobalSLocOffsetMapType::const_iterator SLocMapI)
const;
1369 std::pair<ModuleFile *, unsigned>
1370 getModulePreprocessedEntity(
unsigned GlobalIndex);
1374 llvm::iterator_range<PreprocessingRecord::iterator>
1375 getModulePreprocessedEntities(ModuleFile &Mod)
const;
1379 :
public llvm::iterator_adaptor_base<
1380 ModuleDeclIterator, const serialization::LocalDeclID *,
1381 std::random_access_iterator_tag, const Decl *, ptrdiff_t,
1382 const Decl *, const Decl *> {
1384 ModuleFile *Mod =
nullptr;
1391 : iterator_adaptor_base(Pos), Reader(Reader), Mod(Mod) {}
1400 assert(Reader == RHS.Reader && Mod == RHS.Mod);
1405 llvm::iterator_range<ModuleDeclIterator>
1406 getModuleFileLevelDecls(ModuleFile &Mod);
1409 void PassInterestingDeclsToConsumer();
1410 void PassInterestingDeclToConsumer(Decl *D);
1412 void finishPendingActions();
1413 void diagnoseOdrViolations();
1417 void addPendingDeclContextInfo(Decl *D,
1421 PendingDeclContextInfo Info = { D, SemaDC, LexicalDC };
1422 PendingDeclContextInfos.push_back(Info);
1429 void Error(StringRef Msg)
const;
1430 void Error(
unsigned DiagID, StringRef Arg1 = StringRef(),
1431 StringRef Arg2 = StringRef())
const;
1475 ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
1476 StringRef isysroot =
"",
bool DisableValidation =
false,
1477 bool AllowASTWithCompilerErrors =
false,
1478 bool AllowConfigurationMismatch =
false,
1479 bool ValidateSystemInputs =
false,
bool UseGlobalIndex =
true,
1480 std::unique_ptr<llvm::Timer> ReadTimer = {});
1504 ARR_OutOfDate = 0x2,
1508 ARR_VersionMismatch = 0x4,
1513 ARR_ConfigurationMismatch = 0x8
1534 unsigned ClientLoadCapabilities,
1546 void makeModuleVisible(
Module *Mod,
1559 return std::move(Listener);
1564 this->Listener = std::move(Listener);
1572 L = llvm::make_unique<ChainedASTReaderListener>(std::move(L),
1573 std::move(Listener));
1574 Listener = std::move(L);
1580 bool Chained =
false;
1588 L = llvm::make_unique<ChainedASTReaderListener>(std::move(L),
1597 Reader.
setListener(static_cast<ChainedASTReaderListener *>(New.get())
1604 bool TakeOwnership =
false);
1608 return DeserializationListener;
1623 bool loadGlobalIndex();
1627 bool isGlobalIndexUnavailable()
const;
1630 void InitializeContext();
1637 std::unique_ptr<llvm::MemoryBuffer> Buffer) {
1646 void finalizeForWriting();
1663 getOriginalSourceFile(
const std::string &ASTFileName,
FileManager &FileMgr,
1671 readASTFileControlBlock(StringRef Filename,
FileManager &FileMgr,
1673 bool FindModuleFileExtensions,
1675 bool ValidateDiagnosticOptions);
1679 static bool isAcceptableASTFile(StringRef Filename,
FileManager &FileMgr,
1684 StringRef ExistingModuleCachePath);
1699 std::pair<unsigned, unsigned>
1700 findPreprocessedEntitiesInRange(
SourceRange Range)
override;
1708 SourceRange ReadSkippedRange(
unsigned Index)
override;
1717 return TotalNumSLocEntries;
1722 return static_cast<unsigned>(IdentifiersLoaded.size());
1727 return static_cast<unsigned>(MacrosLoaded.size());
1732 return static_cast<unsigned>(TypesLoaded.size());
1737 return static_cast<unsigned>(DeclsLoaded.size());
1742 return static_cast<unsigned>(SubmodulesLoaded.size());
1747 return static_cast<unsigned>(SelectorsLoaded.size());
1754 for (
const auto &M : ModuleMgr)
1767 ReadTemplateArgumentLoc(ModuleFile &F,
1771 ReadASTTemplateArgumentListInfo(ModuleFile &F,
1779 void ReadTypeLoc(ModuleFile &F,
const RecordData &Record,
unsigned &Idx,
1787 QualType getLocalType(ModuleFile &F,
unsigned LocalID);
1795 if (Idx >= Record.size())
1798 return getLocalType(F, Record[Idx++]);
1811 ModuleFile *getOwningModuleFile(
const Decl *D);
1815 std::string getOwningModuleNameForDiagnostic(
const Decl *D);
1823 Decl *GetExternalDecl(uint32_t ID)
override;
1831 return GetDecl(getGlobalDeclID(F, LocalID));
1837 template<
typename T>
1839 return cast_or_null<T>(GetLocalDecl(F, LocalID));
1848 mapGlobalIDToModuleFileGlobalID(ModuleFile &M,
1861 return GetDecl(ReadDeclID(F, R, I));
1869 template<
typename T>
1871 return cast_or_null<T>(GetDecl(ReadDeclID(F, R, I)));
1877 void CompleteRedeclChain(
const Decl *D)
override;
1886 Stmt *GetExternalDeclStmt(uint64_t Offset)
override;
1891 static bool ReadBlockAbbrevs(llvm::BitstreamCursor &Cursor,
unsigned BlockID);
1896 bool FindExternalVisibleDeclsByName(
const DeclContext *DC,
1913 FindExternalLexicalDecls(
const DeclContext *DC,
1914 llvm::function_ref<
bool(
Decl::Kind)> IsKindWeWant,
1920 void FindFileRegionDecls(
FileID File,
unsigned Offset,
unsigned Length,
1926 void StartedDeserializing()
override;
1930 void FinishedDeserializing()
override;
1937 void StartTranslationUnit(
ASTConsumer *Consumer)
override;
1940 void PrintStats()
override;
1952 void InitializeSema(
Sema &S)
override;
1971 void ReadMethodPool(
Selector Sel)
override;
1975 void updateOutOfDateSelector(
Selector Sel)
override;
1979 void ReadKnownNamespaces(
1982 void ReadUndefinedButUsed(
1983 llvm::MapVector<NamedDecl *, SourceLocation> &Undefined)
override;
1985 void ReadMismatchingDeleteExpressions(llvm::MapVector<
1989 void ReadTentativeDefinitions(
1992 void ReadUnusedFileScopedDecls(
1995 void ReadDelegatingConstructors(
2000 void ReadUnusedLocalTypedefNameCandidates(
2003 void ReadReferencedSelectors(
2006 void ReadWeakUndeclaredIdentifiers(
2011 void ReadPendingInstantiations(
2015 void ReadLateParsedTemplates(
2016 llvm::MapVector<
const FunctionDecl *, std::unique_ptr<LateParsedTemplate>>
2037 return DecodeIdentifierInfo(getGlobalIdentifierID(M, Record[Idx++]));
2044 return DecodeIdentifierInfo(ID);
2047 IdentifierInfo *getLocalIdentifier(ModuleFile &M,
unsigned LocalID);
2052 void resolvePendingMacro(
IdentifierInfo *II,
const PendingMacroInfo &PMInfo);
2062 bool ReadSLocEntry(
int ID)
override;
2066 std::pair<SourceLocation, StringRef> getModuleImportLoc(
int ID)
override;
2071 getGlobalSubmoduleID(ModuleFile &M,
unsigned LocalID);
2080 Module *getModule(
unsigned ID)
override;
2082 bool DeclIsFromPCHWithObjectFile(
const Decl *D)
override;
2086 ModuleFile *getLocalModuleFile(ModuleFile &M,
unsigned ID);
2089 unsigned getModuleFileID(ModuleFile *M);
2094 ExtKind hasExternalDefinitions(
const Decl *D)
override;
2098 Selector getLocalSelector(ModuleFile &M,
unsigned LocalID);
2103 uint32_t GetNumExternalSelectors()
override;
2106 return getLocalSelector(M, Record[Idx++]);
2112 unsigned LocalID)
const;
2117 void ReadDeclarationNameLoc(ModuleFile &F,
2141 bool Canonicalize =
false);
2151 unsigned &Idx,
bool Canonicalize =
false);
2163 ReadCXXCtorInitializers(ModuleFile &F,
const RecordData &Record,
2178 return TranslateSourceLocation(ModuleFile, Loc);
2186 ReadModuleOffsetMap(ModuleFile);
2189 "Cannot find offset to remap.");
2190 int Remap = ModuleFile.
SLocRemap.
find(Loc.getOffset())->second;
2198 return ReadSourceLocation(ModuleFile, Record[Idx++]);
2206 llvm::APInt ReadAPInt(
const RecordData &Record,
unsigned &Idx);
2209 llvm::APSInt ReadAPSInt(
const RecordData &Record,
unsigned &Idx);
2212 llvm::APFloat ReadAPFloat(
const RecordData &Record,
2213 const llvm::fltSemantics &Sem,
unsigned &Idx);
2216 static std::string ReadString(
const RecordData &Record,
unsigned &Idx);
2220 Idx += Record[Idx] + 1;
2224 std::string ReadPath(ModuleFile &F,
const RecordData &Record,
unsigned &Idx);
2228 SkipString(Record, Idx);
2232 static VersionTuple ReadVersionTuple(
const RecordData &Record,
unsigned &Idx);
2241 Stmt *ReadStmt(ModuleFile &F);
2244 Expr *ReadExpr(ModuleFile &F);
2248 assert(ReadingKind == Read_Stmt &&
2249 "Should be called only during statement reading!");
2252 assert(!StmtStack.empty() &&
"Read too many sub-statements!");
2253 return StmtStack.pop_back_val();
2257 Expr *ReadSubExpr();
2263 MacroInfo *ReadMacroRecord(ModuleFile &F, uint64_t Offset);
2268 getGlobalPreprocessedEntityID(ModuleFile &M,
unsigned LocalID)
const;
2277 uint64_t MacroDirectivesOffset);
2280 void ReadDefinedMacros()
override;
2289 void completeVisibleDeclsMap(
const DeclContext *DC)
override;
2293 assert(ContextObj &&
"requested AST context when not loading AST");
2317 void RecordSwitchCaseID(
SwitchCase *SC,
unsigned ID);
2320 SwitchCase *getSwitchCaseWithID(
unsigned ID);
2322 void ClearSwitchCaseIDs();
2329 void ReadComments()
override;
2333 bool IncludeSystem,
bool Complain,
2364 unsigned readRecord(llvm::BitstreamCursor &Cursor,
unsigned AbbrevID);
2376 size_t size()
const {
return Record.size(); }
2382 const uint64_t &
back()
const {
return Record.back(); }
2386 const uint64_t &
readInt() {
return Record[Idx++]; }
2407 return Reader->ReadLexicalDeclContextStorage(*F, F->
DeclsCursor, Offset,
2414 return Reader->ReadVisibleDeclContextStorage(*F, F->
DeclsCursor, Offset,
2420 return Reader->readExceptionSpec(*F, ExceptionStorage, ESI, Record, Idx);
2425 return Reader->getGlobalBitOffset(*F, LocalOffset);
2443 template<
typename T>
2445 return cast_or_null<T>(Reader->
GetLocalDecl(*F, LocalID));
2483 return Reader->
readType(*F, Record, Idx);
2496 return Reader->
ReadDecl(*F, Record, Idx);
2504 template<
typename T>
2506 return Reader->
ReadDeclAs<T>(*F, Record, Idx);
2558 bool Canonicalize =
false) {
2614 return Reader->
ReadPath(*F, Record, Idx);
2629 return Reader->
ReadToken(*F, Record, Idx);
2646 : Cursor(Cursor), Offset(Cursor.GetCurrentBitNo()) {}
2649 Cursor.JumpToBit(Offset);
2653 llvm::BitstreamCursor &
Cursor;
2657 inline void PCHValidator::Error(
const char *Msg) {
2663 #endif // LLVM_CLANG_SERIALIZATION_ASTREADER_H llvm::APInt ReadAPInt(const RecordData &Record, unsigned &Idx)
Read an integral value.
const uint64_t & readInt()
Returns the current value in this record, and advances to the next value.
SmallVector< std::pair< llvm::BitstreamCursor, serialization::ModuleFile * >, 8 > CommentsCursors
Cursors for comments blocks.
Decl * GetLocalDecl(ModuleFile &F, uint32_t LocalID)
Reads a declaration with the given local ID in the given module.
ASTReadResult
The result of reading the control block of an AST file, which can fail for various reasons...
SourceLocation readSourceLocation()
Read a source location, advancing Idx.
Represents a function declaration or definition.
SourceLocation ReadUntranslatedSourceLocation(uint32_t Raw) const
Read a source location from raw form and return it in its originating module file's source location s...
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
SourceLocation getLocWithOffset(int Offset) const
Return a source location with the specified offset from this SourceLocation.
Smart pointer class that efficiently represents Objective-C method names.
A (possibly-)qualified type.
virtual bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, bool Complain, std::string &SuggestedPredefines)
Receives the preprocessor 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...
Implements support for file system lookup, file system caching, and directory search management...
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs...
virtual void visitModuleFile(StringRef Filename, serialization::ModuleKind Kind)
This is called for each AST file loaded.
SourceManager & getSourceManager() const
RAII class for safely pairing a StartedDeserializing call with FinishedDeserializing.
OpenCL supported extensions and optional core features.
ASTRecordReader(ASTReader &Reader, ModuleFile &F)
Construct an ASTRecordReader that uses the default encoding scheme.
Stmt - This represents one statement.
ModuleManager::ModuleReverseIterator ModuleReverseIterator
C Language Family Type Representation.
GlobalModuleIndex * getGlobalIndex()
Return global module index.
Module * getSubmodule(serialization::SubmoduleID GlobalID)
Retrieve the submodule that corresponds to a global submodule ID.
SourceLocation ReadSourceLocation(ModuleFile &ModuleFile, uint32_t Raw) const
Read a source location from raw form.
Defines the clang::Module class, which describes a module in the source code.
Decl - This represents one declaration (or definition), e.g.
virtual void ReadCounter(const serialization::ModuleFile &M, unsigned Value)
Receives COUNTER value.
llvm::APFloat readAPFloat(const llvm::fltSemantics &Sem)
Read a floating-point value, advancing Idx.
The base class of the type hierarchy.
StringRef getOriginalSourceFile()
Retrieve the name of the original source file name for the primary module file.
Decl * GetDecl(serialization::DeclID ID)
Resolve a declaration ID into a declaration, potentially building a new declaration.
ModuleManager::ModuleConstIterator ModuleConstIterator
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
A container of type source information.
Base class that describes a preprocessed entity, which may be a preprocessor directive or macro expan...
void readQualifierInfo(QualifierInfo &Info)
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
void readTypeLoc(TypeLoc TL)
Reads the location information for a type.
CXXBaseSpecifier ReadCXXBaseSpecifier(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a C++ base specifier.
unsigned NumPreprocessedEntities
ModuleDeclIterator(ASTReader *Reader, ModuleFile *Mod, const serialization::LocalDeclID *Pos)
Manages the set of modules loaded by an AST reader.
Options for controlling the target.
Manage memory buffers across multiple users.
unsigned getTotalNumPreprocessedEntities() const
Returns the number of preprocessed entities known to the AST reader.
void recordSwitchCaseID(SwitchCase *SC, unsigned ID)
QualType readType()
Read a type from the current position in the record.
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
Stores a list of template parameters for a TemplateDecl and its derived classes.
T * ReadDeclAs(ModuleFile &F, const RecordData &R, unsigned &I)
Reads a declaration from the given position in a record in the given module.
Selector ReadSelector(ModuleFile &M, const RecordData &Record, unsigned &Idx)
Module * getSubmodule(serialization::SubmoduleID GlobalID)
Retrieve the submodule that corresponds to a global submodule ID.
An UnresolvedSet-like class that might not have been loaded from the external AST source yet...
Base wrapper for a particular "section" of type source info.
serialization::TypeID getGlobalTypeID(unsigned LocalID) const
Map a local type ID within a given AST file to a global type ID.
StringRef ModuleOffsetMap
The module offset map data for this file.
NestedNameSpecifierLoc readNestedNameSpecifierLoc()
One of these records is kept for each identifier that is lexed.
T * readDeclAs()
Reads a declaration from the given position in the record, advancing Idx.
T * GetLocalDeclAs(ModuleFile &F, uint32_t LocalID)
Reads a declaration with the given local ID in the given module.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
Utility class for loading a ASTContext from an AST file.
unsigned getTotalNumDecls() const
Returns the number of declarations found in the chain.
static SourceLocation getFromRawEncoding(unsigned Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
Represents a member of a struct/union/class.
Expr * readExpr()
Reads an expression.
value_type operator->() const
Helper class that saves the current stream position and then restores it when destroyed.
TemplateName ReadTemplateName(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a template name.
virtual bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain, bool AllowCompatibleDifferences)
Receives the language options.
Token - This structure provides full information about a lexed token.
TemplateArgument readTemplateArgument(bool Canonicalize=false)
Read a template argument, advancing Idx.
Sema * getSema()
Retrieve the semantic analysis object used to analyze the translation unit in which the precompiled h...
Stmt * ReadSubStmt()
Reads a sub-statement operand during statement reading.
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.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
static void SkipString(const RecordData &Record, unsigned &Idx)
TypeSourceInfo * getTypeSourceInfo()
Reads a declarator info from the given record, advancing Idx.
Decl * getKeyDeclaration(Decl *D)
Returns the first key declaration for the given declaration.
Describes a module or submodule.
size_t size() const
The length of this record.
static VersionTuple ReadVersionTuple(const RecordData &Record, unsigned &Idx)
Read a version tuple.
ImportedSubmodule(serialization::SubmoduleID ID, SourceLocation ImportLoc)
FileManager & getFileManager() const
TypeSourceInfo * GetTypeSourceInfo(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Reads a declarator info from the given record.
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
ModuleManager & getModuleManager()
Retrieve the module manager.
void ReadQualifierInfo(ModuleFile &F, QualifierInfo &Info, const RecordData &Record, unsigned &Idx)
serialization::DeclID getGlobalDeclID(ModuleFile &F, serialization::LocalDeclID LocalID) const
Map from a local declaration ID within a given module to a global declaration ID. ...
CXXCtorInitializer ** ReadCXXCtorInitializers(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a CXXCtorInitializer array.
llvm::APSInt ReadAPSInt(const RecordData &Record, unsigned &Idx)
Read a signed integral value.
SourceLocation ReadSourceLocation(ModuleFile &ModuleFile, const RecordDataImpl &Record, unsigned &Idx)
Read a source location.
std::string ReadPath(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Concrete class used by the front-end to report problems and issues.
serialization::SubmoduleID getGlobalSubmoduleID(ModuleFile &M, unsigned LocalID)
Retrieve the global submodule ID given a module and its local ID number.
CXXTemporary * ReadCXXTemporary(ModuleFile &F, const RecordData &Record, unsigned &Idx)
TemplateArgument ReadTemplateArgument(ModuleFile &F, const RecordData &Record, unsigned &Idx, bool Canonicalize=false)
Read a template argument.
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
Defines the Diagnostic-related interfaces.
SourceRange readSourceRange()
Read a source range, advancing Idx.
const Decl * getKeyDeclaration(const Decl *D)
std::string OriginalSourceFileName
The original source file name that was used to build the primary AST file, which may have been modifi...
void resetForReload()
Reset reader for a reload try.
TemplateArgumentLocInfo getTemplateArgumentLocInfo(TemplateArgument::ArgKind Kind)
Reads a TemplateArgumentLocInfo appropriate for the given TemplateArgument kind, advancing Idx...
ContinuousRangeMap< uint32_t, int, 2 > SLocRemap
Remapping table for source locations in this module.
const ASTTemplateArgumentListInfo * readASTTemplateArgumentListInfo()
Represents an ObjC class declaration.
This abstract interface provides operations for unwrapping containers for serialized ASTs (precompile...
CXXBaseSpecifier readCXXBaseSpecifier()
Read a C++ base specifier, advancing Idx.
The AST file itself appears corrupted.
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
const uint64_t & peekInt()
Returns the current value in this record, without advancing.
virtual bool needsInputFileVisitation()
Returns true if this ASTReaderListener wants to receive the input files of the AST file via visitInpu...
static std::string ReadString(const RecordData &Record, unsigned &Idx)
virtual bool ReadFileSystemOptions(const FileSystemOptions &FSOpts, bool Complain)
Receives the file system options.
IdentifierInfo * GetIdentifierInfo(ModuleFile &M, const RecordData &Record, unsigned &Idx)
void ForgetSema() override
Inform the semantic consumer that Sema is no longer available.
Sema - This implements semantic analysis and AST building for C.
A little helper class used to produce diagnostics.
TemplateParameterList * readTemplateParameterList()
Read a template parameter list, advancing Idx.
virtual bool needsImportVisitation() const
Returns true if this ASTReaderListener wants to receive the imports of the AST file via visitImport...
bool operator==(const ModuleDeclIterator &RHS) const
ModuleKind
Specifies the kind of module that has been loaded.
Provides lookups to, and iteration over, IdentiferInfo objects.
void readTemplateArgumentList(SmallVectorImpl< TemplateArgument > &TemplArgs, bool Canonicalize=false)
Read a template argument array, advancing Idx.
Decl * ReadDecl(ModuleFile &F, const RecordData &R, unsigned &I)
Reads a declaration from the given position in a record in the given module.
std::string readPath()
Read a path, advancing Idx.
llvm::pointee_iterator< SmallVectorImpl< std::unique_ptr< ModuleFile > >::reverse_iterator > ModuleReverseIterator
ASTReaderListener implementation to validate the information of the PCH file against an initialized P...
serialization::TypeID getGlobalTypeID(ModuleFile &F, unsigned LocalID) const
Map a local type ID within a given AST file into a global type ID.
Abstract interface for external sources of preprocessor information.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Expr - This represents one expression.
SwitchCase * getSwitchCaseWithID(unsigned ID)
Retrieve the switch-case statement with the given ID.
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...
RAII object to temporarily add an AST callback listener.
Stmt * ReadStmt(ModuleFile &F)
Reads a statement.
Implements an efficient mapping from strings to IdentifierInfo nodes.
Stmt * readStmt()
Reads a statement.
virtual void readModuleFileExtension(const ModuleFileExtensionMetadata &Metadata)
Indicates that a particular module file extension has been read.
Defines version macros and version-related utility functions for Clang.
unsigned getTotalNumSubmodules() const
Returns the number of submodules known.
ArgKind
The kind of template argument we're storing.
SimpleASTReaderListener(Preprocessor &PP)
ASTReaderListenter implementation to set SuggestedPredefines of ASTReader which is required to use a ...
SourceRange ReadSourceRange(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a source range.
IdentifierResolver - Keeps track of shadowed decls on enclosing scopes.
Decl * readDecl()
Reads a declaration from the given position in a record in the given module, advancing Idx...
Represents a C++ template name within the type system.
Information about a module that has been loaded by the ASTReader.
virtual ~ASTReaderListener()
const uint64_t & back() const
The last element in this record.
uint32_t IdentifierID
An ID number that refers to an identifier in an AST file.
An iterator that walks over all of the known identifiers in the lookup table.
llvm::pointee_iterator< SmallVectorImpl< std::unique_ptr< ModuleFile > >::const_iterator > ModuleConstIterator
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
IdentifierInfo * getIdentifierInfo()
SavedStreamPosition(llvm::BitstreamCursor &Cursor)
The result type of a method or function.
std::string readString()
Read a string, advancing Idx.
DiagnosticsEngine & getDiags() const
SmallVector< uint64_t, 16 > PreloadedDeclIDs
void ReadDeclarationNameInfo(ModuleFile &F, DeclarationNameInfo &NameInfo, const RecordData &Record, unsigned &Idx)
void skipInts(unsigned N)
Skips the specified number of values.
const uint64_t & operator[](size_t N)
An arbitrary index in this record.
bool isModule() const
Is this a module file for a module (rather than a PCH or similar).
The AST file was missing.
An abstract interface that should be implemented by external AST sources that also provide informatio...
NestedNameSpecifier * ReadNestedNameSpecifier(ModuleFile &F, const RecordData &Record, unsigned &Idx)
void addInMemoryBuffer(StringRef FileName, std::unique_ptr< llvm::MemoryBuffer > Buffer)
Add an in-memory buffer the list of known buffers.
uint32_t SubmoduleID
An ID number that refers to a submodule in a module file.
static void SkipPath(const RecordData &Record, unsigned &Idx)
Defines the clang::OpenCLOptions class.
A struct with extended info about a syntactic name qualifier, to be used for the case of out-of-line ...
The control block was read successfully.
void addListener(std::unique_ptr< ASTReaderListener > L)
Add an AST callback listener.
CXXTemporary * readCXXTemporary()
Encodes a location in the source.
unsigned getTotalNumMacros() const
Returns the number of macros found in the chain.
Stmt * readSubStmt()
Reads a sub-statement operand during statement reading.
Represents a C++ temporary.
CXXCtorInitializer ** readCXXCtorInitializers()
Read a CXXCtorInitializer array, advancing Idx.
An identifier-lookup iterator that enumerates all of the identifiers stored within a set of AST files...
std::unique_ptr< ASTReaderListener > takeListener()
Take the AST callbacks listener.
bool readLexicalDeclContextStorage(uint64_t Offset, DeclContext *DC)
Read the record that describes the lexical contents of a DC.
Cached information about one file (either on disk or in the virtual file system). ...
bool isModule() const
Is this a module file for a module (rather than a PCH or similar).
bool isProcessingUpdateRecords()
void readDeclarationNameInfo(DeclarationNameInfo &NameInfo)
ASTDeserializationListener * getDeserializationListener()
Get the AST deserialization listener.
TemplateParameterList * ReadTemplateParameterList(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a template parameter list.
An abstract class that should be subclassed by any external source of preprocessing record entries...
Expr * readSubExpr()
Reads a sub-expression operand during statement reading.
T * GetLocalDeclAs(uint32_t LocalID)
Reads a declaration with the given local ID in the given module.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
std::string getClangFullRepositoryVersion()
Retrieves the full repository version that is an amalgamation of the information in getClangRepositor...
virtual bool ReadFullVersionInformation(StringRef FullVersion)
Receives the full Clang version information.
void readDeclarationNameLoc(DeclarationNameLoc &DNLoc, DeclarationName Name)
void addInMemoryBuffer(StringRef &FileName, std::unique_ptr< llvm::MemoryBuffer > Buffer)
Add in-memory (virtual file) buffer.
PCHValidator(Preprocessor &PP, ASTReader &Reader)
unsigned getIdx() const
The current position in this record.
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
uint32_t TypeID
An ID number that refers to a type in an AST file.
void setListener(std::unique_ptr< ASTReaderListener > Listener)
Set the AST callbacks listener.
void readExceptionSpec(SmallVectorImpl< QualType > &ExceptionStorage, FunctionProtoType::ExceptionSpecInfo &ESI)
serialization::SubmoduleID getGlobalSubmoduleID(unsigned LocalID)
Retrieve the global submodule ID its local ID number.
External source of source location entries.
virtual void visitImport(StringRef Filename)
If needsImportVisitation returns true, this is called for each AST file imported by this AST file...
serialization::SubmoduleID ID
A global index for a set of module files, providing information about the identifiers within those mo...
uint32_t PreprocessedEntityID
An ID number that refers to an entity in the detailed preprocessing record.
DeclarationName ReadDeclarationName(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a declaration name.
unsigned getTotalNumSelectors() const
Returns the number of selectors found in the chain.
The AST file was writtten with a different language/target configuration.
llvm::APFloat ReadAPFloat(const RecordData &Record, const llvm::fltSemantics &Sem, unsigned &Idx)
Read a floating-point value.
serialization::DeclID readDeclID()
Reads a declaration ID from the given position in this record.
void readAttributes(AttrVec &Attrs)
Reads attributes from the current stream position, advancing Idx.
DeclarationNameLoc - Additional source/type location info for a declaration name. ...
ChainedASTReaderListener(std::unique_ptr< ASTReaderListener > First, std::unique_ptr< ASTReaderListener > Second)
Takes ownership of First and Second.
unsigned getTotalNumTypes() const
Returns the number of types found in the chain.
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Represents a template argument.
const ASTTemplateArgumentListInfo * ReadASTTemplateArgumentListInfo(ModuleFile &F, const RecordData &Record, unsigned &Index)
uint32_t SelectorID
An ID number that refers to an ObjC selector in an AST file.
Dataflow Directional Tag Classes.
llvm::BitstreamCursor DeclsCursor
DeclsCursor - This is a cursor to the start of the DECLS_BLOCK block.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
SourceLocation TranslateSourceLocation(ModuleFile &ModuleFile, SourceLocation Loc) const
Translate a source location from another module file's source location space into ours...
Reads an AST files chain containing the contents of a translation unit.
Selector readSelector()
Read a selector from the Record, advancing Idx.
Expr * ReadExpr(ModuleFile &F)
Reads an expression.
ListenerScope(ASTReader &Reader, std::unique_ptr< ASTReaderListener > L)
ModuleFile & getPrimaryModule()
Returns the primary module associated with the manager, that is, the first module loaded...
ModuleManager::ModuleIterator ModuleIterator
bool hasGlobalIndex() const
Determine whether this AST reader has a global index.
LoadFailureCapabilities
Flags that indicate what kind of AST loading failures the client of the AST reader can directly handl...
DeclarationName - The name of a declaration.
virtual void ReadModuleMapFile(StringRef ModuleMapPath)
TemplateArgumentLoc readTemplateArgumentLoc()
Reads a TemplateArgumentLoc, advancing Idx.
A map from continuous integer ranges to some value, with a very specialized interface.
Class that performs lookup for an identifier stored in an AST file.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
void ReadDeclarationNameLoc(ModuleFile &F, DeclarationNameLoc &DNLoc, DeclarationName Name, const RecordData &Record, unsigned &Idx)
uint32_t DeclID
An ID number that refers to a declaration in an AST file.
VersionTuple readVersionTuple()
Read a version tuple, advancing Idx.
Encapsulates the data about a macro definition (e.g.
SmallVector< uint64_t, 64 > RecordData
void ReadUnresolvedSet(ModuleFile &F, LazyASTUnresolvedSet &Set, const RecordData &Record, unsigned &Idx)
Read a UnresolvedSet structure.
Abstract interface for callback invocations by the ASTReader.
Location wrapper for a TemplateArgument.
NestedNameSpecifierLoc ReadNestedNameSpecifierLoc(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Represents a C++ base or member initializer.
uint64_t getGlobalBitOffset(uint32_t LocalOffset)
Get the global offset corresponding to a local offset.
void ReadTemplateArgumentList(SmallVectorImpl< TemplateArgument > &TemplArgs, ModuleFile &F, const RecordData &Record, unsigned &Idx, bool Canonicalize=false)
Read a template argument array.
llvm::APSInt readAPSInt()
Read a signed integral value, advancing Idx.
void forEachImportedKeyDecl(const Decl *D, Fn Visit)
Run a callback on each imported key declaration of D.
void ReadTypeLoc(ModuleFile &F, const RecordData &Record, unsigned &Idx, TypeLoc TL)
Raad the type locations for the given TInfo.
Preprocessor & getPreprocessor() const
Retrieve the preprocessor.
Represents a base class of a C++ class.
Keeps track of options that affect how file operations are performed.
virtual bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef SpecificModuleCachePath, bool Complain)
Receives the header search options.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
TemplateName readTemplateName()
Read a template name, advancing Idx.
SmallVectorImpl< uint64_t > RecordDataImpl
Defines the clang::SourceLocation class and associated facilities.
TemplateArgumentLoc ReadTemplateArgumentLoc(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Reads a TemplateArgumentLoc.
TemplateArgumentLocInfo GetTemplateArgumentLocInfo(ModuleFile &F, TemplateArgument::ArgKind Kind, const RecordData &Record, unsigned &Idx)
Reads a TemplateArgumentLocInfo appropriate for the given TemplateArgument kind.
serialization::DeclID ReadDeclID(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Reads a declaration ID from the given position in a record in the given module.
virtual bool needsSystemInputFileVisitation()
Returns true if this ASTReaderListener wants to receive the system input files of the AST file via vi...
Expr * ReadSubExpr()
Reads a sub-expression operand during statement reading.
Token ReadToken(ModuleFile &M, const RecordDataImpl &Record, unsigned &Idx)
Reads a token out of a record.
IdentifierInfo * GetIdentifier(serialization::IdentifierID ID) override
unsigned getTotalNumSLocs() const
Returns the number of source locations found in the chain.
Location information for a TemplateArgument.
DeclarationName readDeclarationName()
Read a declaration name, advancing Idx.
virtual bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain, bool AllowCompatibleDifferences)
Receives the target options.
Writes an AST file containing the contents of a translation unit.
virtual void ReadModuleName(StringRef ModuleName)
unsigned getTotalNumIdentifiers() const
Returns the number of identifiers found in the chain.
value_type operator*() const
llvm::APInt readAPInt()
Read an integral value, advancing Idx.
The AST file is out-of-date relative to its input files, and needs to be regenerated.
NameVisibilityKind
Describes the visibility of the various names within a particular module.
Simple wrapper class for chaining listeners.
An object for streaming information from a record.
bool readVisibleDeclContextStorage(uint64_t Offset, serialization::DeclID ID)
Read the record that describes the visible contents of a DC.
Kind
Lists the kind of concrete classes of Decl.
The AST file was written by a different version of Clang.
void ReadAttributes(ASTRecordReader &Record, AttrVec &Attrs)
Reads attributes from the current stream position.
NestedNameSpecifier * readNestedNameSpecifier()
Token readToken()
Reads a token out of a record, advancing Idx.
std::unique_ptr< ASTReaderListener > takeSecond()
const std::string & getSuggestedPredefines()
Returns the suggested contents of the predefines buffer, which contains a (typically-empty) subset of...
A trivial tuple used to represent a source range.
This represents a decl that may have a name.
SwitchCase * getSwitchCaseWithID(unsigned ID)
Retrieve the switch-case statement with the given ID.
llvm::pointee_iterator< SmallVectorImpl< std::unique_ptr< ModuleFile > >::iterator > ModuleIterator
std::unique_ptr< ASTReaderListener > takeFirst()
bool isSystem(CharacteristicKind CK)
Determine whether a file / directory characteristic is for system code.
This class handles loading and caching of source files into memory.
virtual bool ReadDiagnosticOptions(IntrusiveRefCntPtr< DiagnosticOptions > DiagOpts, bool Complain)
Receives the diagnostic options.
void RecordSwitchCaseID(SwitchCase *SC, unsigned ID)
Record that the given ID maps to the given switch-case statement.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
void readUnresolvedSet(LazyASTUnresolvedSet &Set)
Read a UnresolvedSet structure, advancing Idx.