14 #ifndef LLVM_CLANG_SERIALIZATION_ASTREADER_H 15 #define LLVM_CLANG_SERIALIZATION_ASTREADER_H 43 #include "llvm/ADT/APFloat.h" 44 #include "llvm/ADT/APInt.h" 45 #include "llvm/ADT/APSInt.h" 46 #include "llvm/ADT/ArrayRef.h" 47 #include "llvm/ADT/DenseMap.h" 48 #include "llvm/ADT/DenseSet.h" 49 #include "llvm/ADT/IntrusiveRefCntPtr.h" 50 #include "llvm/ADT/MapVector.h" 51 #include "llvm/ADT/Optional.h" 52 #include "llvm/ADT/STLExtras.h" 53 #include "llvm/ADT/SetVector.h" 54 #include "llvm/ADT/SmallPtrSet.h" 55 #include "llvm/ADT/SmallVector.h" 56 #include "llvm/ADT/StringMap.h" 57 #include "llvm/ADT/StringRef.h" 58 #include "llvm/ADT/iterator.h" 59 #include "llvm/ADT/iterator_range.h" 60 #include "llvm/Bitcode/BitstreamReader.h" 61 #include "llvm/Support/Casting.h" 62 #include "llvm/Support/Endian.h" 63 #include "llvm/Support/MemoryBuffer.h" 64 #include "llvm/Support/Timer.h" 65 #include "llvm/Support/VersionTuple.h" 81 class ASTDeserializationListener;
83 class ASTRecordReader;
93 class FileSystemOptions;
95 class GlobalModuleIndex;
96 struct HeaderFileInfo;
97 class HeaderSearchOptions;
99 class LazyASTUnresolvedSet;
101 class MemoryBufferCache;
104 class ObjCCategoryDecl;
105 class ObjCInterfaceDecl;
106 class PCHContainerReader;
108 class PreprocessorOptions;
109 struct QualifierInfo;
115 class TemplateParameterList;
116 class TypedefNameDecl;
117 class TypeSourceInfo;
147 bool AllowCompatibleDifferences) {
156 bool AllowCompatibleDifferences) {
184 StringRef SpecificModuleCachePath,
199 std::string &SuggestedPredefines) {
226 bool isOverridden,
bool isExplicitModule) {
245 std::unique_ptr<ASTReaderListener>
First;
246 std::unique_ptr<ASTReaderListener> Second;
251 std::unique_ptr<ASTReaderListener> Second)
252 : First(
std::move(First)), Second(
std::move(Second)) {}
254 std::unique_ptr<ASTReaderListener>
takeFirst() {
return std::move(First); }
255 std::unique_ptr<ASTReaderListener>
takeSecond() {
return std::move(Second); }
261 bool AllowCompatibleDifferences)
override;
263 bool AllowCompatibleDifferences)
override;
265 bool Complain)
override;
267 bool Complain)
override;
270 StringRef SpecificModuleCachePath,
271 bool Complain)
override;
274 std::string &SuggestedPredefines)
override;
282 bool isOverridden,
bool isExplicitModule)
override;
295 : PP(PP), Reader(Reader) {}
298 bool AllowCompatibleDifferences)
override;
300 bool AllowCompatibleDifferences)
override;
302 bool Complain)
override;
304 std::string &SuggestedPredefines)
override;
306 StringRef SpecificModuleCachePath,
307 bool Complain)
override;
311 void Error(
const char *Msg);
325 std::string &SuggestedPredefines)
override;
328 namespace serialization {
330 class ReadMethodPoolVisitor;
416 std::unique_ptr<ASTReaderListener> Listener;
421 bool OwnsDeserializationListener =
false;
430 Sema *SemaObj =
nullptr;
453 llvm::StringMap<std::shared_ptr<ModuleFileExtension>> ModuleFileExtensions;
456 std::unique_ptr<llvm::Timer> ReadTimer;
463 std::unique_ptr<GlobalModuleIndex> GlobalIndex;
483 std::vector<QualType> TypesLoaded;
497 std::vector<Decl *> DeclsLoaded;
506 using FileOffset = std::pair<ModuleFile *, uint64_t>;
508 using DeclUpdateOffsetsMap =
509 llvm::DenseMap<serialization::DeclID, FileOffsetsTy>;
513 DeclUpdateOffsetsMap DeclUpdateOffsets;
515 struct PendingUpdateRecord {
524 : D(D),
ID(ID), JustLoaded(JustLoaded) {}
531 enum class PendingFakeDefinitionKind { NotFake, Fake, FakeLoaded };
535 llvm::DenseMap<void *, PendingFakeDefinitionKind> PendingFakeDefinitionData;
541 llvm::SmallMapVector<Decl *, FunctionDecl *, 4> PendingExceptionSpecUpdates;
546 llvm::SmallMapVector<FunctionDecl *, QualType, 4> PendingDeducedTypeUpdates;
550 llvm::DenseMap<std::pair<DeclContext *, IdentifierInfo *>,
NamedDecl *>
551 ImportedTypedefNamesForLinkage;
555 llvm::DenseMap<Decl*, llvm::SmallVector<NamedDecl*, 2>>
556 AnonymousDeclarationsForMerging;
558 struct FileDeclsInfo {
562 FileDeclsInfo() =
default;
564 : Mod(Mod), Decls(Decls) {}
568 llvm::DenseMap<FileID, FileDeclsInfo> FileDeclIDs;
575 llvm::DenseMap<const DeclContext*, std::pair<ModuleFile*, LexicalContents>>
579 std::vector<std::pair<ModuleFile*, LexicalContents>> TULexicalDecls;
589 struct PendingVisibleUpdate {
591 const unsigned char *Data;
597 llvm::DenseMap<serialization::DeclID, DeclContextVisibleUpdates>
598 PendingVisibleUpdates;
602 llvm::SmallPtrSet<Decl *, 4> PendingDefinitions;
604 using PendingBodiesMap =
605 llvm::MapVector<
Decl *, uint64_t,
606 llvm::SmallDenseMap<Decl *, unsigned, 4>,
610 PendingBodiesMap PendingBodies;
614 llvm::SetVector<NamedDecl *> PendingMergedDefinitionsToDeduplicate;
617 bool ReadLexicalDeclContextStorage(
ModuleFile &M,
618 llvm::BitstreamCursor &
Cursor,
619 uint64_t
Offset, DeclContext *DC);
622 bool ReadVisibleDeclContextStorage(
ModuleFile &M,
623 llvm::BitstreamCursor &Cursor,
632 std::vector<IdentifierInfo *> IdentifiersLoaded;
648 std::vector<MacroInfo *> MacrosLoaded;
650 using LoadedMacroInfo =
651 std::pair<IdentifierInfo *, serialization::SubmoduleID>;
682 using HiddenNamesMapType = llvm::DenseMap<Module *, HiddenNames>;
686 HiddenNamesMapType HiddenNamesMap;
689 struct UnresolvedModuleRef {
697 enum { Import, Export, Conflict }
Kind;
703 unsigned IsWildcard : 1;
729 llvm::DenseMap<Selector, unsigned> SelectorGeneration;
733 llvm::DenseMap<Selector, bool> SelectorOutOfDate;
735 struct PendingMacroInfo {
737 uint64_t MacroDirectivesOffset;
739 PendingMacroInfo(
ModuleFile *M, uint64_t MacroDirectivesOffset)
740 : M(M), MacroDirectivesOffset(MacroDirectivesOffset) {}
743 using PendingMacroIDsMap =
744 llvm::MapVector<IdentifierInfo *, SmallVector<PendingMacroInfo, 2>>;
748 PendingMacroIDsMap PendingMacroIDs;
839 unsigned ForceCUDAHostDeviceDepth = 0;
864 int PragmaMSStructState = -1;
867 int PragmaMSPointersToMembersState = -1;
873 struct PragmaPackStackEntry {
886 llvm::DenseMap<const Type *, std::set<std::string>> OpenCLTypeExtMap;
889 llvm::DenseMap<const Decl *, std::set<std::string>> OpenCLDeclExtMap;
910 : ID(ID), ImportLoc(ImportLoc) {}
921 std::string isysroot;
925 bool DisableValidation;
928 bool AllowASTWithCompilerErrors;
932 bool AllowConfigurationMismatch;
935 bool ValidateSystemInputs;
941 bool TriedLoadingGlobalIndex =
false;
944 bool ProcessingUpdateRecords =
false;
946 using SwitchCaseMapTy = llvm::DenseMap<unsigned, SwitchCase *>;
952 SwitchCaseMapTy SwitchCaseStmts;
954 SwitchCaseMapTy *CurrSwitchCaseStmts;
958 unsigned NumSLocEntriesRead = 0;
961 unsigned TotalNumSLocEntries = 0;
965 unsigned NumStatementsRead = 0;
969 unsigned TotalNumStatements = 0;
972 unsigned NumMacrosRead = 0;
975 unsigned TotalNumMacros = 0;
978 unsigned NumIdentifierLookups = 0;
981 unsigned NumIdentifierLookupHits = 0;
984 unsigned NumSelectorsRead = 0;
987 unsigned NumMethodPoolEntriesRead = 0;
991 unsigned NumMethodPoolLookups = 0;
995 unsigned NumMethodPoolHits = 0;
999 unsigned NumMethodPoolTableLookups = 0;
1003 unsigned NumMethodPoolTableHits = 0;
1006 unsigned TotalNumMethodPoolEntries = 0;
1009 unsigned NumLexicalDeclContextsRead = 0, TotalLexicalDeclContexts = 0;
1012 unsigned NumVisibleDeclContextsRead = 0, TotalVisibleDeclContexts = 0;
1015 uint64_t TotalModulesSizeInBits = 0;
1018 unsigned NumCurrentElementsDeserializing = 0;
1024 bool PassingDeclsToConsumer =
false;
1031 llvm::MapVector<IdentifierInfo *, SmallVector<uint32_t, 4>>
1032 PendingIdentifierInfos;
1036 llvm::SmallMapVector<IdentifierInfo *, SmallVector<NamedDecl*, 2>, 16>
1037 PendingFakeLookupResults;
1041 llvm::DenseMap<IdentifierInfo *, unsigned> IdentifierGeneration;
1043 class InterestingDecl {
1045 bool DeclHasPendingBody;
1048 InterestingDecl(Decl *D,
bool HasBody)
1049 : D(D), DeclHasPendingBody(HasBody) {}
1051 Decl *getDecl() {
return D; }
1054 bool hasPendingBody() {
return DeclHasPendingBody; }
1063 std::deque<InterestingDecl> PotentiallyInterestingDecls;
1069 PendingFunctionTypes;
1074 SmallVector<std::pair<Decl *, uint64_t>, 16> PendingDeclChains;
1082 struct PendingDeclContextInfo {
1093 std::deque<PendingDeclContextInfo> PendingDeclContextInfos;
1103 using DataPointers =
1104 std::pair<CXXRecordDecl *, struct CXXRecordDecl::DefinitionData *>;
1107 llvm::SmallDenseMap<CXXRecordDecl *, llvm::SmallVector<DataPointers, 2>, 2>
1108 PendingOdrMergeFailures;
1111 llvm::SmallDenseMap<FunctionDecl *, llvm::SmallVector<FunctionDecl *, 2>, 2>
1112 PendingFunctionOdrMergeFailures;
1115 llvm::SmallDenseMap<EnumDecl *, llvm::SmallVector<EnumDecl *, 2>, 2>
1116 PendingEnumOdrMergeFailures;
1119 llvm::SmallPtrSet<DeclContext*, 2> DiagnosedOdrMergeFailures;
1123 llvm::SmallPtrSet<ObjCCategoryDecl *, 16> CategoriesDeserialized;
1131 llvm::DenseMap<Decl *, SmallVector<serialization::DeclID, 2>>;
1138 KeyDeclsMap KeyDecls;
1143 llvm::DenseMap<DeclContext *, DeclContext *> MergedDeclContexts;
1147 llvm::DenseMap<EnumDecl *, EnumDecl *> EnumDefinitions;
1154 Read_None, Read_Decl, Read_Type, Read_Stmt
1158 ReadingKind ReadingKind = Read_None;
1161 class ReadingKindTracker {
1163 enum ReadingKind PrevKind;
1166 ReadingKindTracker(
enum ReadingKind newKind,
ASTReader &reader)
1167 : Reader(reader), PrevKind(Reader.ReadingKind) {
1168 Reader.ReadingKind = newKind;
1171 ReadingKindTracker(
const ReadingKindTracker &) =
delete;
1172 ReadingKindTracker &operator=(
const ReadingKindTracker &) =
delete;
1173 ~ReadingKindTracker() { Reader.ReadingKind = PrevKind; }
1177 class ProcessingUpdatesRAIIObj {
1182 ProcessingUpdatesRAIIObj(
ASTReader &reader)
1183 : Reader(reader), PrevState(Reader.ProcessingUpdateRecords) {
1184 Reader.ProcessingUpdateRecords =
true;
1187 ProcessingUpdatesRAIIObj(
const ProcessingUpdatesRAIIObj &) =
delete;
1188 ProcessingUpdatesRAIIObj &
1189 operator=(
const ProcessingUpdatesRAIIObj &) =
delete;
1190 ~ProcessingUpdatesRAIIObj() { Reader.ProcessingUpdateRecords = PrevState; }
1201 std::string SuggestedPredefines;
1203 llvm::DenseMap<const Decl *, bool> DefinitionSource;
1208 struct InputFileInfo {
1214 bool TopLevelModuleMap;
1218 InputFileInfo readInputFileInfo(
ModuleFile &F,
unsigned ID);
1223 bool Complain =
true);
1227 static void ResolveImportedPath(std::string &Filename, StringRef Prefix);
1237 auto I = KeyDecls.find(D);
1238 if (I == KeyDecls.end() || I->second.empty())
1240 return GetExistingDecl(I->second[0]);
1243 return getKeyDeclaration(const_cast<Decl*>(D));
1247 template <
typename Fn>
1253 auto It = KeyDecls.find(const_cast<Decl*>(D));
1254 if (It != KeyDecls.end())
1255 for (
auto ID : It->second)
1256 Visit(GetExistingDecl(ID));
1261 getLoadedLookupTables(DeclContext *Primary)
const;
1264 struct ImportedModule {
1272 : Mod(Mod), ImportedBy(ImportedBy), ImportLoc(ImportLoc) {}
1278 off_t ExpectedSize, time_t ExpectedModTime,
1280 unsigned ClientLoadCapabilities);
1284 unsigned ClientLoadCapabilities);
1286 llvm::BitstreamCursor &Stream,
unsigned ClientLoadCapabilities,
1288 std::string &SuggestedPredefines);
1295 unsigned ClientLoadCapabilities);
1298 readUnhashedControlBlockImpl(
ModuleFile *F, llvm::StringRef StreamData,
1299 unsigned ClientLoadCapabilities,
1300 bool AllowCompatibleConfigurationMismatch,
1302 bool ValidateDiagnosticOptions);
1306 void ReadModuleOffsetMap(
ModuleFile &F)
const;
1309 llvm::BitstreamCursor &SLocCursorForID(
int ID);
1313 unsigned ClientLoadCapabilities);
1315 unsigned ClientLoadCapabilities);
1316 static bool ParseLanguageOptions(
const RecordData &Record,
bool Complain,
1318 bool AllowCompatibleDifferences);
1319 static bool ParseTargetOptions(
const RecordData &Record,
bool Complain,
1321 bool AllowCompatibleDifferences);
1322 static bool ParseDiagnosticOptions(
const RecordData &Record,
bool Complain,
1324 static bool ParseFileSystemOptions(
const RecordData &Record,
bool Complain,
1326 static bool ParseHeaderSearchOptions(
const RecordData &Record,
bool Complain,
1328 static bool ParsePreprocessorOptions(
const RecordData &Record,
bool Complain,
1330 std::string &SuggestedPredefines);
1332 struct RecordLocation {
1339 QualType readTypeRecord(
unsigned Index);
1344 RecordLocation TypeCursorForIndex(
unsigned Index);
1345 void LoadedDecl(
unsigned Index, Decl *D);
1347 void markIncompleteDeclChain(Decl *Canon);
1352 Decl *getMostRecentExistingDecl(Decl *D);
1356 void loadDeclUpdateRecords(PendingUpdateRecord &Record);
1357 void loadPendingDeclChain(Decl *D, uint64_t LocalOffset);
1359 unsigned PreviousGeneration = 0);
1361 RecordLocation getLocalBitOffset(uint64_t GlobalOffset);
1362 uint64_t getGlobalBitOffset(ModuleFile &M, uint32_t LocalOffset);
1367 findPreprocessedEntity(
SourceLocation Loc,
bool EndsAfter)
const;
1376 findNextPreprocessedEntity(
1377 GlobalSLocOffsetMapType::const_iterator SLocMapI)
const;
1381 std::pair<ModuleFile *, unsigned>
1382 getModulePreprocessedEntity(
unsigned GlobalIndex);
1386 llvm::iterator_range<PreprocessingRecord::iterator>
1387 getModulePreprocessedEntities(ModuleFile &Mod)
const;
1391 :
public llvm::iterator_adaptor_base<
1392 ModuleDeclIterator, const serialization::LocalDeclID *,
1393 std::random_access_iterator_tag, const Decl *, ptrdiff_t,
1394 const Decl *, const Decl *> {
1396 ModuleFile *Mod =
nullptr;
1403 : iterator_adaptor_base(Pos), Reader(Reader), Mod(Mod) {}
1412 assert(Reader == RHS.Reader && Mod == RHS.Mod);
1417 llvm::iterator_range<ModuleDeclIterator>
1418 getModuleFileLevelDecls(ModuleFile &Mod);
1421 void PassInterestingDeclsToConsumer();
1422 void PassInterestingDeclToConsumer(Decl *D);
1424 void finishPendingActions();
1425 void diagnoseOdrViolations();
1429 void addPendingDeclContextInfo(Decl *D,
1433 PendingDeclContextInfo Info = { D, SemaDC, LexicalDC };
1434 PendingDeclContextInfos.push_back(Info);
1441 void Error(StringRef Msg)
const;
1442 void Error(
unsigned DiagID, StringRef Arg1 = StringRef(),
1443 StringRef Arg2 = StringRef())
const;
1487 ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
1488 StringRef isysroot =
"",
bool DisableValidation =
false,
1489 bool AllowASTWithCompilerErrors =
false,
1490 bool AllowConfigurationMismatch =
false,
1491 bool ValidateSystemInputs =
false,
bool UseGlobalIndex =
true,
1492 std::unique_ptr<llvm::Timer> ReadTimer = {});
1516 ARR_OutOfDate = 0x2,
1520 ARR_VersionMismatch = 0x4,
1525 ARR_ConfigurationMismatch = 0x8
1546 unsigned ClientLoadCapabilities,
1558 void makeModuleVisible(
Module *Mod,
1571 return std::move(Listener);
1576 this->Listener = std::move(Listener);
1584 L = llvm::make_unique<ChainedASTReaderListener>(std::move(L),
1585 std::move(Listener));
1586 Listener = std::move(L);
1592 bool Chained =
false;
1600 L = llvm::make_unique<ChainedASTReaderListener>(std::move(L),
1609 Reader.
setListener(static_cast<ChainedASTReaderListener *>(New.get())
1616 bool TakeOwnership =
false);
1620 return DeserializationListener;
1635 bool loadGlobalIndex();
1639 bool isGlobalIndexUnavailable()
const;
1642 void InitializeContext();
1649 std::unique_ptr<llvm::MemoryBuffer> Buffer) {
1658 void finalizeForWriting();
1675 getOriginalSourceFile(
const std::string &ASTFileName,
FileManager &FileMgr,
1683 readASTFileControlBlock(StringRef Filename,
FileManager &FileMgr,
1685 bool FindModuleFileExtensions,
1687 bool ValidateDiagnosticOptions);
1691 static bool isAcceptableASTFile(StringRef Filename,
FileManager &FileMgr,
1696 StringRef ExistingModuleCachePath);
1711 std::pair<unsigned, unsigned>
1712 findPreprocessedEntitiesInRange(
SourceRange Range)
override;
1720 SourceRange ReadSkippedRange(
unsigned Index)
override;
1729 return TotalNumSLocEntries;
1734 return static_cast<unsigned>(IdentifiersLoaded.size());
1739 return static_cast<unsigned>(MacrosLoaded.size());
1744 return static_cast<unsigned>(TypesLoaded.size());
1749 return static_cast<unsigned>(DeclsLoaded.size());
1754 return static_cast<unsigned>(SubmodulesLoaded.size());
1759 return static_cast<unsigned>(SelectorsLoaded.size());
1766 for (
const auto &M : ModuleMgr)
1779 ReadTemplateArgumentLoc(ModuleFile &F,
1783 ReadASTTemplateArgumentListInfo(ModuleFile &F,
1791 void ReadTypeLoc(ModuleFile &F,
const RecordData &Record,
unsigned &Idx,
1799 QualType getLocalType(ModuleFile &F,
unsigned LocalID);
1807 if (Idx >= Record.size())
1810 return getLocalType(F, Record[Idx++]);
1823 ModuleFile *getOwningModuleFile(
const Decl *D);
1827 std::string getOwningModuleNameForDiagnostic(
const Decl *D);
1835 Decl *GetExternalDecl(uint32_t ID)
override;
1843 return GetDecl(getGlobalDeclID(F, LocalID));
1849 template<
typename T>
1851 return cast_or_null<T>(GetLocalDecl(F, LocalID));
1860 mapGlobalIDToModuleFileGlobalID(ModuleFile &M,
1873 return GetDecl(ReadDeclID(F, R, I));
1881 template<
typename T>
1883 return cast_or_null<T>(GetDecl(ReadDeclID(F, R, I)));
1889 void CompleteRedeclChain(
const Decl *D)
override;
1898 Stmt *GetExternalDeclStmt(uint64_t Offset)
override;
1903 static bool ReadBlockAbbrevs(llvm::BitstreamCursor &Cursor,
unsigned BlockID);
1908 bool FindExternalVisibleDeclsByName(
const DeclContext *DC,
1925 FindExternalLexicalDecls(
const DeclContext *DC,
1926 llvm::function_ref<
bool(
Decl::Kind)> IsKindWeWant,
1932 void FindFileRegionDecls(
FileID File,
unsigned Offset,
unsigned Length,
1938 void StartedDeserializing()
override;
1942 void FinishedDeserializing()
override;
1949 void StartTranslationUnit(
ASTConsumer *Consumer)
override;
1952 void PrintStats()
override;
1964 void InitializeSema(
Sema &S)
override;
1983 void ReadMethodPool(
Selector Sel)
override;
1987 void updateOutOfDateSelector(
Selector Sel)
override;
1991 void ReadKnownNamespaces(
1994 void ReadUndefinedButUsed(
1995 llvm::MapVector<NamedDecl *, SourceLocation> &Undefined)
override;
1997 void ReadMismatchingDeleteExpressions(llvm::MapVector<
2001 void ReadTentativeDefinitions(
2004 void ReadUnusedFileScopedDecls(
2007 void ReadDelegatingConstructors(
2012 void ReadUnusedLocalTypedefNameCandidates(
2015 void ReadReferencedSelectors(
2018 void ReadWeakUndeclaredIdentifiers(
2023 void ReadPendingInstantiations(
2027 void ReadLateParsedTemplates(
2028 llvm::MapVector<
const FunctionDecl *, std::unique_ptr<LateParsedTemplate>>
2049 return DecodeIdentifierInfo(getGlobalIdentifierID(M, Record[Idx++]));
2056 return DecodeIdentifierInfo(ID);
2059 IdentifierInfo *getLocalIdentifier(ModuleFile &M,
unsigned LocalID);
2064 void resolvePendingMacro(
IdentifierInfo *II,
const PendingMacroInfo &PMInfo);
2074 bool ReadSLocEntry(
int ID)
override;
2078 std::pair<SourceLocation, StringRef> getModuleImportLoc(
int ID)
override;
2083 getGlobalSubmoduleID(ModuleFile &M,
unsigned LocalID);
2092 Module *getModule(
unsigned ID)
override;
2094 bool DeclIsFromPCHWithObjectFile(
const Decl *D)
override;
2098 ModuleFile *getLocalModuleFile(ModuleFile &M,
unsigned ID);
2101 unsigned getModuleFileID(ModuleFile *M);
2106 ExtKind hasExternalDefinitions(
const Decl *D)
override;
2110 Selector getLocalSelector(ModuleFile &M,
unsigned LocalID);
2115 uint32_t GetNumExternalSelectors()
override;
2118 return getLocalSelector(M, Record[Idx++]);
2124 unsigned LocalID)
const;
2129 void ReadDeclarationNameLoc(ModuleFile &F,
2153 bool Canonicalize =
false);
2163 unsigned &Idx,
bool Canonicalize =
false);
2175 ReadCXXCtorInitializers(ModuleFile &F,
const RecordData &Record,
2190 return TranslateSourceLocation(ModuleFile, Loc);
2198 ReadModuleOffsetMap(ModuleFile);
2201 "Cannot find offset to remap.");
2202 int Remap = ModuleFile.
SLocRemap.
find(Loc.getOffset())->second;
2210 return ReadSourceLocation(ModuleFile, Record[Idx++]);
2218 llvm::APInt ReadAPInt(
const RecordData &Record,
unsigned &Idx);
2221 llvm::APSInt ReadAPSInt(
const RecordData &Record,
unsigned &Idx);
2224 llvm::APFloat ReadAPFloat(
const RecordData &Record,
2225 const llvm::fltSemantics &Sem,
unsigned &Idx);
2228 static std::string ReadString(
const RecordData &Record,
unsigned &Idx);
2232 Idx += Record[Idx] + 1;
2236 std::string ReadPath(ModuleFile &F,
const RecordData &Record,
unsigned &Idx);
2240 SkipString(Record, Idx);
2244 static VersionTuple ReadVersionTuple(
const RecordData &Record,
unsigned &Idx);
2250 Attr *ReadAttr(ModuleFile &M,
const RecordData &Record,
unsigned &Idx);
2256 Stmt *ReadStmt(ModuleFile &F);
2259 Expr *ReadExpr(ModuleFile &F);
2263 assert(ReadingKind == Read_Stmt &&
2264 "Should be called only during statement reading!");
2267 assert(!StmtStack.empty() &&
"Read too many sub-statements!");
2268 return StmtStack.pop_back_val();
2272 Expr *ReadSubExpr();
2278 MacroInfo *ReadMacroRecord(ModuleFile &F, uint64_t Offset);
2283 getGlobalPreprocessedEntityID(ModuleFile &M,
unsigned LocalID)
const;
2292 uint64_t MacroDirectivesOffset);
2295 void ReadDefinedMacros()
override;
2304 void completeVisibleDeclsMap(
const DeclContext *DC)
override;
2308 assert(ContextObj &&
"requested AST context when not loading AST");
2332 void RecordSwitchCaseID(
SwitchCase *SC,
unsigned ID);
2335 SwitchCase *getSwitchCaseWithID(
unsigned ID);
2337 void ClearSwitchCaseIDs();
2344 void ReadComments()
override;
2348 bool IncludeSystem,
bool Complain,
2379 unsigned readRecord(llvm::BitstreamCursor &Cursor,
unsigned AbbrevID);
2391 size_t size()
const {
return Record.size(); }
2397 const uint64_t &
back()
const {
return Record.back(); }
2401 const uint64_t &
readInt() {
return Record[Idx++]; }
2422 return Reader->ReadLexicalDeclContextStorage(*F, F->
DeclsCursor, Offset,
2429 return Reader->ReadVisibleDeclContextStorage(*F, F->
DeclsCursor, Offset,
2435 return Reader->readExceptionSpec(*F, ExceptionStorage, ESI, Record, Idx);
2440 return Reader->getGlobalBitOffset(*F, LocalOffset);
2458 template<
typename T>
2460 return cast_or_null<T>(Reader->
GetLocalDecl(*F, LocalID));
2498 return Reader->
readType(*F, Record, Idx);
2511 return Reader->
ReadDecl(*F, Record, Idx);
2519 template<
typename T>
2521 return Reader->
ReadDeclAs<T>(*F, Record, Idx);
2573 bool Canonicalize =
false) {
2629 return Reader->
ReadPath(*F, Record, Idx);
2639 return Reader->
ReadAttr(*F, Record, Idx);
2649 return Reader->
ReadToken(*F, Record, Idx);
2666 : Cursor(Cursor), Offset(Cursor.GetCurrentBitNo()) {}
2669 Cursor.JumpToBit(Offset);
2673 llvm::BitstreamCursor &
Cursor;
2677 inline void PCHValidator::Error(
const char *Msg) {
2687 : Record(Record), Context(Record.getContext()) {}
2689 #define OPENMP_CLAUSE(Name, Class) void Visit##Class(Class *C); 2690 #include "clang/Basic/OpenMPKinds.def" 2693 void VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *
C);
2698 #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 ...
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()
OMPClauseReader(ASTRecordReader &Record)
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.
This file defines OpenMP AST classes for clauses.
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)
Attr * ReadAttr(ModuleFile &M, const RecordData &Record, unsigned &Idx)
Reads one attribute from the current stream position.
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.
serialization::SubmoduleID ID
virtual void visitImport(StringRef ModuleName, StringRef Filename)
If needsImportVisitation returns true, this is called for each AST file imported by this AST file...
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...
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.
Holds information about the various types of exception specification.
Preprocessor & getPreprocessor() const
Retrieve the preprocessor.
Represents a base class of a C++ class.
Attr * readAttr()
Reads one attribute from the current stream position, advancing Idx.
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.
Attr - This represents one attribute.
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.