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" 79 class ASTDeserializationListener;
81 class ASTRecordReader;
82 class CXXBaseSpecifier;
83 class CXXConstructorDecl;
84 class CXXCtorInitializer;
94 class FileSystemOptions;
96 class GlobalModuleIndex;
97 struct HeaderFileInfo;
98 class HeaderSearchOptions;
100 class LazyASTUnresolvedSet;
102 class MemoryBufferCache;
105 class NestedNameSpecifier;
106 class ObjCCategoryDecl;
107 class ObjCInterfaceDecl;
108 class PCHContainerReader;
110 class PreprocessorOptions;
111 struct QualifierInfo;
117 class TemplateParameterList;
118 class TypedefNameDecl;
119 class TypeSourceInfo;
149 bool AllowCompatibleDifferences) {
158 bool AllowCompatibleDifferences) {
186 StringRef SpecificModuleCachePath,
201 std::string &SuggestedPredefines) {
228 bool isOverridden,
bool isExplicitModule) {
247 std::unique_ptr<ASTReaderListener> First;
248 std::unique_ptr<ASTReaderListener> Second;
253 std::unique_ptr<ASTReaderListener> Second)
254 : First(
std::move(First)), Second(
std::move(Second)) {}
256 std::unique_ptr<ASTReaderListener>
takeFirst() {
return std::move(First); }
257 std::unique_ptr<ASTReaderListener>
takeSecond() {
return std::move(Second); }
263 bool AllowCompatibleDifferences)
override;
265 bool AllowCompatibleDifferences)
override;
267 bool Complain)
override;
269 bool Complain)
override;
272 StringRef SpecificModuleCachePath,
273 bool Complain)
override;
276 std::string &SuggestedPredefines)
override;
284 bool isOverridden,
bool isExplicitModule)
override;
297 : PP(PP), Reader(Reader) {}
300 bool AllowCompatibleDifferences)
override;
302 bool AllowCompatibleDifferences)
override;
304 bool Complain)
override;
306 std::string &SuggestedPredefines)
override;
308 StringRef SpecificModuleCachePath,
309 bool Complain)
override;
313 void Error(
const char *Msg);
328 std::string &SuggestedPredefines)
override;
331 namespace serialization {
333 class ReadMethodPoolVisitor;
419 std::unique_ptr<ASTReaderListener> Listener;
424 bool OwnsDeserializationListener =
false;
433 Sema *SemaObj =
nullptr;
456 llvm::StringMap<std::shared_ptr<ModuleFileExtension>> ModuleFileExtensions;
459 std::unique_ptr<llvm::Timer> ReadTimer;
466 std::unique_ptr<GlobalModuleIndex> GlobalIndex;
486 std::vector<QualType> TypesLoaded;
500 std::vector<Decl *> DeclsLoaded;
509 using FileOffset = std::pair<ModuleFile *, uint64_t>;
511 using DeclUpdateOffsetsMap =
512 llvm::DenseMap<serialization::DeclID, FileOffsetsTy>;
516 DeclUpdateOffsetsMap DeclUpdateOffsets;
518 struct PendingUpdateRecord {
527 : D(D),
ID(ID), JustLoaded(JustLoaded) {}
534 enum class PendingFakeDefinitionKind { NotFake, Fake, FakeLoaded };
538 llvm::DenseMap<void *, PendingFakeDefinitionKind> PendingFakeDefinitionData;
544 llvm::SmallMapVector<Decl *, FunctionDecl *, 4> PendingExceptionSpecUpdates;
548 llvm::DenseMap<std::pair<DeclContext *, IdentifierInfo *>,
NamedDecl *>
549 ImportedTypedefNamesForLinkage;
553 llvm::DenseMap<DeclContext*, llvm::SmallVector<NamedDecl*, 2>>
554 AnonymousDeclarationsForMerging;
556 struct FileDeclsInfo {
560 FileDeclsInfo() =
default;
562 : Mod(Mod), Decls(Decls) {}
566 llvm::DenseMap<FileID, FileDeclsInfo> FileDeclIDs;
573 llvm::DenseMap<const DeclContext*, std::pair<ModuleFile*, LexicalContents>>
577 std::vector<std::pair<ModuleFile*, LexicalContents>> TULexicalDecls;
587 struct PendingVisibleUpdate {
589 const unsigned char *Data;
595 llvm::DenseMap<serialization::DeclID, DeclContextVisibleUpdates>
596 PendingVisibleUpdates;
600 llvm::SmallPtrSet<Decl *, 4> PendingDefinitions;
602 using PendingBodiesMap =
603 llvm::MapVector<
Decl *, uint64_t,
604 llvm::SmallDenseMap<Decl *, unsigned, 4>,
608 PendingBodiesMap PendingBodies;
612 llvm::SetVector<NamedDecl *> PendingMergedDefinitionsToDeduplicate;
615 bool ReadLexicalDeclContextStorage(
ModuleFile &M,
616 llvm::BitstreamCursor &
Cursor,
617 uint64_t
Offset, DeclContext *DC);
620 bool ReadVisibleDeclContextStorage(
ModuleFile &M,
621 llvm::BitstreamCursor &Cursor,
630 std::vector<IdentifierInfo *> IdentifiersLoaded;
646 std::vector<MacroInfo *> MacrosLoaded;
648 using LoadedMacroInfo =
649 std::pair<IdentifierInfo *, serialization::SubmoduleID>;
680 using HiddenNamesMapType = llvm::DenseMap<Module *, HiddenNames>;
684 HiddenNamesMapType HiddenNamesMap;
687 struct UnresolvedModuleRef {
695 enum { Import, Export, Conflict }
Kind;
701 unsigned IsWildcard : 1;
727 llvm::DenseMap<Selector, unsigned> SelectorGeneration;
731 llvm::DenseMap<Selector, bool> SelectorOutOfDate;
733 struct PendingMacroInfo {
735 uint64_t MacroDirectivesOffset;
737 PendingMacroInfo(
ModuleFile *M, uint64_t MacroDirectivesOffset)
738 : M(M), MacroDirectivesOffset(MacroDirectivesOffset) {}
741 using PendingMacroIDsMap =
742 llvm::MapVector<IdentifierInfo *, SmallVector<PendingMacroInfo, 2>>;
746 PendingMacroIDsMap PendingMacroIDs;
830 unsigned ForceCUDAHostDeviceDepth = 0;
855 int PragmaMSStructState = -1;
858 int PragmaMSPointersToMembersState = -1;
864 struct PragmaPackStackEntry {
877 llvm::DenseMap<const Type *, std::set<std::string>> OpenCLTypeExtMap;
880 llvm::DenseMap<const Decl *, std::set<std::string>> OpenCLDeclExtMap;
901 : ID(ID), ImportLoc(ImportLoc) {}
912 std::string isysroot;
916 bool DisableValidation;
919 bool AllowASTWithCompilerErrors;
923 bool AllowConfigurationMismatch;
926 bool ValidateSystemInputs;
932 bool TriedLoadingGlobalIndex =
false;
935 bool ProcessingUpdateRecords =
false;
937 using SwitchCaseMapTy = llvm::DenseMap<unsigned, SwitchCase *>;
943 SwitchCaseMapTy SwitchCaseStmts;
945 SwitchCaseMapTy *CurrSwitchCaseStmts;
949 unsigned NumSLocEntriesRead = 0;
952 unsigned TotalNumSLocEntries = 0;
956 unsigned NumStatementsRead = 0;
960 unsigned TotalNumStatements = 0;
963 unsigned NumMacrosRead = 0;
966 unsigned TotalNumMacros = 0;
969 unsigned NumIdentifierLookups = 0;
972 unsigned NumIdentifierLookupHits = 0;
975 unsigned NumSelectorsRead = 0;
978 unsigned NumMethodPoolEntriesRead = 0;
982 unsigned NumMethodPoolLookups = 0;
986 unsigned NumMethodPoolHits = 0;
990 unsigned NumMethodPoolTableLookups = 0;
994 unsigned NumMethodPoolTableHits = 0;
997 unsigned TotalNumMethodPoolEntries = 0;
1000 unsigned NumLexicalDeclContextsRead = 0, TotalLexicalDeclContexts = 0;
1003 unsigned NumVisibleDeclContextsRead = 0, TotalVisibleDeclContexts = 0;
1006 uint64_t TotalModulesSizeInBits = 0;
1009 unsigned NumCurrentElementsDeserializing = 0;
1015 bool PassingDeclsToConsumer =
false;
1022 llvm::MapVector<IdentifierInfo *, SmallVector<uint32_t, 4>>
1023 PendingIdentifierInfos;
1027 llvm::SmallMapVector<IdentifierInfo *, SmallVector<NamedDecl*, 2>, 16>
1028 PendingFakeLookupResults;
1032 llvm::DenseMap<IdentifierInfo *, unsigned> IdentifierGeneration;
1034 class InterestingDecl {
1036 bool DeclHasPendingBody;
1039 InterestingDecl(Decl *D,
bool HasBody)
1040 : D(D), DeclHasPendingBody(HasBody) {}
1042 Decl *getDecl() {
return D; }
1045 bool hasPendingBody() {
return DeclHasPendingBody; }
1054 std::deque<InterestingDecl> PotentiallyInterestingDecls;
1059 SmallVector<std::pair<Decl *, uint64_t>, 16> PendingDeclChains;
1067 struct PendingDeclContextInfo {
1078 std::deque<PendingDeclContextInfo> PendingDeclContextInfos;
1088 using DataPointers =
1089 std::pair<CXXRecordDecl *, struct CXXRecordDecl::DefinitionData *>;
1092 llvm::SmallDenseMap<CXXRecordDecl *, llvm::SmallVector<DataPointers, 2>, 2>
1093 PendingOdrMergeFailures;
1096 llvm::SmallDenseMap<FunctionDecl *, llvm::SmallVector<FunctionDecl *, 2>, 2>
1097 PendingFunctionOdrMergeFailures;
1100 llvm::SmallPtrSet<DeclContext*, 2> DiagnosedOdrMergeFailures;
1104 llvm::SmallPtrSet<ObjCCategoryDecl *, 16> CategoriesDeserialized;
1112 llvm::DenseMap<Decl *, SmallVector<serialization::DeclID, 2>>;
1119 KeyDeclsMap KeyDecls;
1124 llvm::DenseMap<DeclContext *, DeclContext *> MergedDeclContexts;
1128 llvm::DenseMap<EnumDecl *, EnumDecl *> EnumDefinitions;
1135 Read_None, Read_Decl, Read_Type, Read_Stmt
1139 ReadingKind ReadingKind = Read_None;
1142 class ReadingKindTracker {
1144 enum ReadingKind PrevKind;
1147 ReadingKindTracker(
enum ReadingKind newKind,
ASTReader &reader)
1148 : Reader(reader), PrevKind(Reader.ReadingKind) {
1149 Reader.ReadingKind = newKind;
1152 ReadingKindTracker(
const ReadingKindTracker &) =
delete;
1153 ReadingKindTracker &operator=(
const ReadingKindTracker &) =
delete;
1154 ~ReadingKindTracker() { Reader.ReadingKind = PrevKind; }
1158 class ProcessingUpdatesRAIIObj {
1163 ProcessingUpdatesRAIIObj(
ASTReader &reader)
1164 : Reader(reader), PrevState(Reader.ProcessingUpdateRecords) {
1165 Reader.ProcessingUpdateRecords =
true;
1168 ProcessingUpdatesRAIIObj(
const ProcessingUpdatesRAIIObj &) =
delete;
1169 ProcessingUpdatesRAIIObj &
1170 operator=(
const ProcessingUpdatesRAIIObj &) =
delete;
1171 ~ProcessingUpdatesRAIIObj() { Reader.ProcessingUpdateRecords = PrevState; }
1182 std::string SuggestedPredefines;
1184 llvm::DenseMap<const Decl *, bool> DefinitionSource;
1189 struct InputFileInfo {
1195 bool TopLevelModuleMap;
1199 InputFileInfo readInputFileInfo(
ModuleFile &F,
unsigned ID);
1204 bool Complain =
true);
1208 static void ResolveImportedPath(std::string &Filename, StringRef Prefix);
1218 auto I = KeyDecls.find(D);
1219 if (I == KeyDecls.end() || I->second.empty())
1221 return GetExistingDecl(I->second[0]);
1224 return getKeyDeclaration(const_cast<Decl*>(D));
1228 template <
typename Fn>
1234 auto It = KeyDecls.find(const_cast<Decl*>(D));
1235 if (It != KeyDecls.end())
1236 for (
auto ID : It->second)
1237 Visit(GetExistingDecl(ID));
1242 getLoadedLookupTables(DeclContext *Primary)
const;
1245 struct ImportedModule {
1253 : Mod(Mod), ImportedBy(ImportedBy), ImportLoc(ImportLoc) {}
1259 off_t ExpectedSize, time_t ExpectedModTime,
1261 unsigned ClientLoadCapabilities);
1265 unsigned ClientLoadCapabilities);
1267 llvm::BitstreamCursor &Stream,
unsigned ClientLoadCapabilities,
1269 std::string &SuggestedPredefines);
1276 unsigned ClientLoadCapabilities);
1279 readUnhashedControlBlockImpl(
ModuleFile *F, llvm::StringRef StreamData,
1280 unsigned ClientLoadCapabilities,
1281 bool AllowCompatibleConfigurationMismatch,
1283 bool ValidateDiagnosticOptions);
1287 void ReadModuleOffsetMap(
ModuleFile &F)
const;
1290 llvm::BitstreamCursor &SLocCursorForID(
int ID);
1294 unsigned ClientLoadCapabilities);
1296 unsigned ClientLoadCapabilities);
1297 static bool ParseLanguageOptions(
const RecordData &Record,
bool Complain,
1299 bool AllowCompatibleDifferences);
1300 static bool ParseTargetOptions(
const RecordData &Record,
bool Complain,
1302 bool AllowCompatibleDifferences);
1303 static bool ParseDiagnosticOptions(
const RecordData &Record,
bool Complain,
1305 static bool ParseFileSystemOptions(
const RecordData &Record,
bool Complain,
1307 static bool ParseHeaderSearchOptions(
const RecordData &Record,
bool Complain,
1309 static bool ParsePreprocessorOptions(
const RecordData &Record,
bool Complain,
1311 std::string &SuggestedPredefines);
1313 struct RecordLocation {
1321 QualType readTypeRecord(
unsigned Index);
1326 RecordLocation TypeCursorForIndex(
unsigned Index);
1327 void LoadedDecl(
unsigned Index, Decl *D);
1329 void markIncompleteDeclChain(Decl *Canon);
1334 Decl *getMostRecentExistingDecl(Decl *D);
1338 void loadDeclUpdateRecords(PendingUpdateRecord &Record);
1339 void loadPendingDeclChain(Decl *D, uint64_t LocalOffset);
1341 unsigned PreviousGeneration = 0);
1343 RecordLocation getLocalBitOffset(uint64_t GlobalOffset);
1344 uint64_t getGlobalBitOffset(ModuleFile &M, uint32_t LocalOffset);
1349 findPreprocessedEntity(
SourceLocation Loc,
bool EndsAfter)
const;
1358 findNextPreprocessedEntity(
1359 GlobalSLocOffsetMapType::const_iterator SLocMapI)
const;
1363 std::pair<ModuleFile *, unsigned>
1364 getModulePreprocessedEntity(
unsigned GlobalIndex);
1368 llvm::iterator_range<PreprocessingRecord::iterator>
1369 getModulePreprocessedEntities(ModuleFile &Mod)
const;
1373 :
public llvm::iterator_adaptor_base<
1374 ModuleDeclIterator, const serialization::LocalDeclID *,
1375 std::random_access_iterator_tag, const Decl *, ptrdiff_t,
1376 const Decl *, const Decl *> {
1378 ModuleFile *Mod =
nullptr;
1385 : iterator_adaptor_base(Pos), Reader(Reader), Mod(Mod) {}
1394 assert(Reader == RHS.Reader && Mod == RHS.Mod);
1399 llvm::iterator_range<ModuleDeclIterator>
1400 getModuleFileLevelDecls(ModuleFile &Mod);
1403 void PassInterestingDeclsToConsumer();
1404 void PassInterestingDeclToConsumer(Decl *D);
1406 void finishPendingActions();
1407 void diagnoseOdrViolations();
1411 void addPendingDeclContextInfo(Decl *D,
1415 PendingDeclContextInfo Info = { D, SemaDC, LexicalDC };
1416 PendingDeclContextInfos.push_back(Info);
1423 void Error(StringRef Msg)
const;
1424 void Error(
unsigned DiagID, StringRef Arg1 = StringRef(),
1425 StringRef Arg2 = StringRef())
const;
1469 ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
1470 StringRef isysroot =
"",
bool DisableValidation =
false,
1471 bool AllowASTWithCompilerErrors =
false,
1472 bool AllowConfigurationMismatch =
false,
1473 bool ValidateSystemInputs =
false,
bool UseGlobalIndex =
true,
1474 std::unique_ptr<llvm::Timer> ReadTimer = {});
1498 ARR_OutOfDate = 0x2,
1502 ARR_VersionMismatch = 0x4,
1507 ARR_ConfigurationMismatch = 0x8
1528 unsigned ClientLoadCapabilities,
1540 void makeModuleVisible(
Module *Mod,
1553 return std::move(Listener);
1558 this->Listener = std::move(Listener);
1566 L = llvm::make_unique<ChainedASTReaderListener>(std::move(L),
1567 std::move(Listener));
1568 Listener = std::move(L);
1574 bool Chained =
false;
1582 L = llvm::make_unique<ChainedASTReaderListener>(std::move(L),
1591 Reader.
setListener(static_cast<ChainedASTReaderListener *>(New.get())
1598 bool TakeOwnership =
false);
1612 bool loadGlobalIndex();
1616 bool isGlobalIndexUnavailable()
const;
1619 void InitializeContext();
1626 std::unique_ptr<llvm::MemoryBuffer> Buffer) {
1635 void finalizeForWriting();
1652 getOriginalSourceFile(
const std::string &ASTFileName,
FileManager &FileMgr,
1660 readASTFileControlBlock(StringRef Filename,
FileManager &FileMgr,
1662 bool FindModuleFileExtensions,
1664 bool ValidateDiagnosticOptions);
1668 static bool isAcceptableASTFile(StringRef Filename,
FileManager &FileMgr,
1673 StringRef ExistingModuleCachePath);
1688 std::pair<unsigned, unsigned>
1689 findPreprocessedEntitiesInRange(
SourceRange Range)
override;
1703 return TotalNumSLocEntries;
1708 return static_cast<unsigned>(IdentifiersLoaded.size());
1713 return static_cast<unsigned>(MacrosLoaded.size());
1718 return static_cast<unsigned>(TypesLoaded.size());
1723 return static_cast<unsigned>(DeclsLoaded.size());
1728 return static_cast<unsigned>(SubmodulesLoaded.size());
1733 return static_cast<unsigned>(SelectorsLoaded.size());
1740 for (
const auto &M : ModuleMgr)
1753 ReadTemplateArgumentLoc(ModuleFile &F,
1757 ReadASTTemplateArgumentListInfo(ModuleFile &F,
1769 QualType getLocalType(ModuleFile &F,
unsigned LocalID);
1777 if (Idx >= Record.size())
1780 return getLocalType(F, Record[Idx++]);
1793 ModuleFile *getOwningModuleFile(
const Decl *D);
1797 std::string getOwningModuleNameForDiagnostic(
const Decl *D);
1805 Decl *GetExternalDecl(uint32_t ID)
override;
1813 return GetDecl(getGlobalDeclID(F, LocalID));
1819 template<
typename T>
1821 return cast_or_null<T>(GetLocalDecl(F, LocalID));
1830 mapGlobalIDToModuleFileGlobalID(ModuleFile &M,
1843 return GetDecl(ReadDeclID(F, R, I));
1851 template<
typename T>
1853 return cast_or_null<T>(GetDecl(ReadDeclID(F, R, I)));
1859 void CompleteRedeclChain(
const Decl *D)
override;
1868 Stmt *GetExternalDeclStmt(uint64_t Offset)
override;
1873 static bool ReadBlockAbbrevs(llvm::BitstreamCursor &Cursor,
unsigned BlockID);
1878 bool FindExternalVisibleDeclsByName(
const DeclContext *DC,
1895 FindExternalLexicalDecls(
const DeclContext *DC,
1896 llvm::function_ref<
bool(
Decl::Kind)> IsKindWeWant,
1902 void FindFileRegionDecls(
FileID File,
unsigned Offset,
unsigned Length,
1908 void StartedDeserializing()
override;
1912 void FinishedDeserializing()
override;
1919 void StartTranslationUnit(
ASTConsumer *Consumer)
override;
1922 void PrintStats()
override;
1934 void InitializeSema(
Sema &S)
override;
1953 void ReadMethodPool(
Selector Sel)
override;
1957 void updateOutOfDateSelector(
Selector Sel)
override;
1961 void ReadKnownNamespaces(
1964 void ReadUndefinedButUsed(
1965 llvm::MapVector<NamedDecl *, SourceLocation> &Undefined)
override;
1967 void ReadMismatchingDeleteExpressions(llvm::MapVector<
1971 void ReadTentativeDefinitions(
1974 void ReadUnusedFileScopedDecls(
1977 void ReadDelegatingConstructors(
1982 void ReadUnusedLocalTypedefNameCandidates(
1985 void ReadReferencedSelectors(
1988 void ReadWeakUndeclaredIdentifiers(
1993 void ReadPendingInstantiations(
1997 void ReadLateParsedTemplates(
1998 llvm::MapVector<
const FunctionDecl *, std::unique_ptr<LateParsedTemplate>>
2019 return DecodeIdentifierInfo(getGlobalIdentifierID(M, Record[Idx++]));
2026 return DecodeIdentifierInfo(ID);
2029 IdentifierInfo *getLocalIdentifier(ModuleFile &M,
unsigned LocalID);
2034 void resolvePendingMacro(
IdentifierInfo *II,
const PendingMacroInfo &PMInfo);
2044 bool ReadSLocEntry(
int ID)
override;
2048 std::pair<SourceLocation, StringRef> getModuleImportLoc(
int ID)
override;
2053 getGlobalSubmoduleID(ModuleFile &M,
unsigned LocalID);
2062 Module *getModule(
unsigned ID)
override;
2066 ModuleFile *getLocalModuleFile(ModuleFile &M,
unsigned ID);
2069 unsigned getModuleFileID(ModuleFile *M);
2074 ExtKind hasExternalDefinitions(
const Decl *D)
override;
2078 Selector getLocalSelector(ModuleFile &M,
unsigned LocalID);
2083 uint32_t GetNumExternalSelectors()
override;
2086 return getLocalSelector(M, Record[Idx++]);
2092 unsigned LocalID)
const;
2097 void ReadDeclarationNameLoc(ModuleFile &F,
2121 bool Canonicalize =
false);
2131 unsigned &Idx,
bool Canonicalize =
false);
2143 ReadCXXCtorInitializers(ModuleFile &F,
const RecordData &Record,
2158 return TranslateSourceLocation(ModuleFile, Loc);
2166 ReadModuleOffsetMap(ModuleFile);
2169 "Cannot find offset to remap.");
2170 int Remap = ModuleFile.
SLocRemap.
find(Loc.getOffset())->second;
2178 return ReadSourceLocation(ModuleFile, Record[Idx++]);
2186 llvm::APInt ReadAPInt(
const RecordData &Record,
unsigned &Idx);
2189 llvm::APSInt ReadAPSInt(
const RecordData &Record,
unsigned &Idx);
2192 llvm::APFloat ReadAPFloat(
const RecordData &Record,
2193 const llvm::fltSemantics &Sem,
unsigned &Idx);
2196 static std::string ReadString(
const RecordData &Record,
unsigned &Idx);
2200 Idx += Record[Idx] + 1;
2204 std::string ReadPath(ModuleFile &F,
const RecordData &Record,
unsigned &Idx);
2208 SkipString(Record, Idx);
2221 Stmt *ReadStmt(ModuleFile &F);
2224 Expr *ReadExpr(ModuleFile &F);
2228 assert(ReadingKind == Read_Stmt &&
2229 "Should be called only during statement reading!");
2232 assert(!StmtStack.empty() &&
"Read too many sub-statements!");
2233 return StmtStack.pop_back_val();
2237 Expr *ReadSubExpr();
2243 MacroInfo *ReadMacroRecord(ModuleFile &F, uint64_t Offset);
2248 getGlobalPreprocessedEntityID(ModuleFile &M,
unsigned LocalID)
const;
2257 uint64_t MacroDirectivesOffset);
2260 void ReadDefinedMacros()
override;
2269 void completeVisibleDeclsMap(
const DeclContext *DC)
override;
2273 assert(ContextObj &&
"requested AST context when not loading AST");
2297 void RecordSwitchCaseID(
SwitchCase *SC,
unsigned ID);
2300 SwitchCase *getSwitchCaseWithID(
unsigned ID);
2302 void ClearSwitchCaseIDs();
2309 void ReadComments()
override;
2313 bool IncludeSystem,
bool Complain,
2344 unsigned readRecord(llvm::BitstreamCursor &Cursor,
unsigned AbbrevID);
2356 size_t size()
const {
return Record.size(); }
2362 const uint64_t &
back()
const {
return Record.back(); }
2366 const uint64_t &
readInt() {
return Record[Idx++]; }
2387 return Reader->ReadLexicalDeclContextStorage(*F, F->
DeclsCursor, Offset,
2394 return Reader->ReadVisibleDeclContextStorage(*F, F->
DeclsCursor, Offset,
2400 return Reader->readExceptionSpec(*F, ExceptionStorage, ESI, Record, Idx);
2405 return Reader->getGlobalBitOffset(*F, LocalOffset);
2423 template<
typename T>
2425 return cast_or_null<T>(Reader->
GetLocalDecl(*F, LocalID));
2458 return Reader->
readType(*F, Record, Idx);
2471 return Reader->
ReadDecl(*F, Record, Idx);
2479 template<
typename T>
2533 bool Canonicalize =
false) {
2589 return Reader->
ReadPath(*F, Record, Idx);
2604 return Reader->
ReadToken(*F, Record, Idx);
2621 : Cursor(Cursor), Offset(Cursor.GetCurrentBitNo()) {}
2624 Cursor.JumpToBit(Offset);
2628 llvm::BitstreamCursor &
Cursor;
2632 inline void PCHValidator::Error(
const char *Msg) {
2638 #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.
An instance of this class is created to represent 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.
Represents a version number in the form major[.minor[.subminor[.build]]].
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...
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...
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.
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
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.
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Expr - This represents one expression.
SwitchCase * getSwitchCaseWithID(unsigned ID)
Retrieve the switch-case statement with the given ID.
const FunctionProtoType * T
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.
QualifierInfo - A struct with extended info about a syntactic name qualifier, to be used for the case...
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)
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)
Defines the clang::FileSystemOptions interface.
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.
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.
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.
Defines the clang::VersionTuple class, which represents a version in the form major[.minor[.subminor]].
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.
NamedDecl - This represents a decl with 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.