13 #ifndef LLVM_CLANG_SERIALIZATION_ASTREADER_H 14 #define LLVM_CLANG_SERIALIZATION_ASTREADER_H 42 #include "llvm/ADT/APFloat.h" 43 #include "llvm/ADT/APInt.h" 44 #include "llvm/ADT/APSInt.h" 45 #include "llvm/ADT/ArrayRef.h" 46 #include "llvm/ADT/DenseMap.h" 47 #include "llvm/ADT/DenseSet.h" 48 #include "llvm/ADT/IntrusiveRefCntPtr.h" 49 #include "llvm/ADT/MapVector.h" 50 #include "llvm/ADT/Optional.h" 51 #include "llvm/ADT/STLExtras.h" 52 #include "llvm/ADT/SetVector.h" 53 #include "llvm/ADT/SmallPtrSet.h" 54 #include "llvm/ADT/SmallVector.h" 55 #include "llvm/ADT/StringMap.h" 56 #include "llvm/ADT/StringRef.h" 57 #include "llvm/ADT/iterator.h" 58 #include "llvm/ADT/iterator_range.h" 59 #include "llvm/Bitcode/BitstreamReader.h" 60 #include "llvm/Support/Casting.h" 61 #include "llvm/Support/Endian.h" 62 #include "llvm/Support/MemoryBuffer.h" 63 #include "llvm/Support/Timer.h" 64 #include "llvm/Support/VersionTuple.h" 80 class ASTDeserializationListener;
82 class ASTRecordReader;
92 class FileSystemOptions;
94 class GlobalModuleIndex;
95 struct HeaderFileInfo;
96 class HeaderSearchOptions;
98 class LazyASTUnresolvedSet;
100 class MemoryBufferCache;
103 class ObjCCategoryDecl;
104 class ObjCInterfaceDecl;
105 class PCHContainerReader;
107 class PreprocessorOptions;
108 struct QualifierInfo;
114 class TemplateParameterList;
115 class TypedefNameDecl;
116 class TypeSourceInfo;
146 bool AllowCompatibleDifferences) {
155 bool AllowCompatibleDifferences) {
183 StringRef SpecificModuleCachePath,
198 std::string &SuggestedPredefines) {
225 bool isOverridden,
bool isExplicitModule) {
244 std::unique_ptr<ASTReaderListener>
First;
245 std::unique_ptr<ASTReaderListener> Second;
250 std::unique_ptr<ASTReaderListener> Second)
251 : First(
std::move(First)), Second(
std::move(Second)) {}
253 std::unique_ptr<ASTReaderListener>
takeFirst() {
return std::move(First); }
254 std::unique_ptr<ASTReaderListener>
takeSecond() {
return std::move(Second); }
260 bool AllowCompatibleDifferences)
override;
262 bool AllowCompatibleDifferences)
override;
264 bool Complain)
override;
266 bool Complain)
override;
269 StringRef SpecificModuleCachePath,
270 bool Complain)
override;
273 std::string &SuggestedPredefines)
override;
281 bool isOverridden,
bool isExplicitModule)
override;
294 : PP(PP), Reader(Reader) {}
297 bool AllowCompatibleDifferences)
override;
299 bool AllowCompatibleDifferences)
override;
301 bool Complain)
override;
303 std::string &SuggestedPredefines)
override;
305 StringRef SpecificModuleCachePath,
306 bool Complain)
override;
310 void Error(
const char *Msg);
324 std::string &SuggestedPredefines)
override;
327 namespace serialization {
329 class ReadMethodPoolVisitor;
415 std::unique_ptr<ASTReaderListener> Listener;
420 bool OwnsDeserializationListener =
false;
429 Sema *SemaObj =
nullptr;
452 llvm::StringMap<std::shared_ptr<ModuleFileExtension>> ModuleFileExtensions;
455 std::unique_ptr<llvm::Timer> ReadTimer;
462 std::unique_ptr<GlobalModuleIndex> GlobalIndex;
482 std::vector<QualType> TypesLoaded;
496 std::vector<Decl *> DeclsLoaded;
505 using FileOffset = std::pair<ModuleFile *, uint64_t>;
507 using DeclUpdateOffsetsMap =
508 llvm::DenseMap<serialization::DeclID, FileOffsetsTy>;
512 DeclUpdateOffsetsMap DeclUpdateOffsets;
514 struct PendingUpdateRecord {
523 : D(D),
ID(ID), JustLoaded(JustLoaded) {}
530 enum class PendingFakeDefinitionKind { NotFake, Fake, FakeLoaded };
534 llvm::DenseMap<void *, PendingFakeDefinitionKind> PendingFakeDefinitionData;
540 llvm::SmallMapVector<Decl *, FunctionDecl *, 4> PendingExceptionSpecUpdates;
545 llvm::SmallMapVector<FunctionDecl *, QualType, 4> PendingDeducedTypeUpdates;
549 llvm::DenseMap<std::pair<DeclContext *, IdentifierInfo *>,
NamedDecl *>
550 ImportedTypedefNamesForLinkage;
554 llvm::DenseMap<Decl*, llvm::SmallVector<NamedDecl*, 2>>
555 AnonymousDeclarationsForMerging;
557 struct FileDeclsInfo {
561 FileDeclsInfo() =
default;
563 : Mod(Mod), Decls(Decls) {}
567 llvm::DenseMap<FileID, FileDeclsInfo> FileDeclIDs;
574 llvm::DenseMap<const DeclContext*, std::pair<ModuleFile*, LexicalContents>>
578 std::vector<std::pair<ModuleFile*, LexicalContents>> TULexicalDecls;
588 struct PendingVisibleUpdate {
590 const unsigned char *Data;
596 llvm::DenseMap<serialization::DeclID, DeclContextVisibleUpdates>
597 PendingVisibleUpdates;
601 llvm::SmallPtrSet<Decl *, 4> PendingDefinitions;
603 using PendingBodiesMap =
604 llvm::MapVector<
Decl *, uint64_t,
605 llvm::SmallDenseMap<Decl *, unsigned, 4>,
609 PendingBodiesMap PendingBodies;
613 llvm::SetVector<NamedDecl *> PendingMergedDefinitionsToDeduplicate;
616 bool ReadLexicalDeclContextStorage(
ModuleFile &M,
617 llvm::BitstreamCursor &
Cursor,
618 uint64_t
Offset, DeclContext *DC);
621 bool ReadVisibleDeclContextStorage(
ModuleFile &M,
622 llvm::BitstreamCursor &Cursor,
631 std::vector<IdentifierInfo *> IdentifiersLoaded;
647 std::vector<MacroInfo *> MacrosLoaded;
649 using LoadedMacroInfo =
650 std::pair<IdentifierInfo *, serialization::SubmoduleID>;
681 using HiddenNamesMapType = llvm::DenseMap<Module *, HiddenNames>;
685 HiddenNamesMapType HiddenNamesMap;
688 struct UnresolvedModuleRef {
696 enum { Import, Export, Conflict }
Kind;
702 unsigned IsWildcard : 1;
728 llvm::DenseMap<Selector, unsigned> SelectorGeneration;
732 llvm::DenseMap<Selector, bool> SelectorOutOfDate;
734 struct PendingMacroInfo {
736 uint64_t MacroDirectivesOffset;
738 PendingMacroInfo(
ModuleFile *M, uint64_t MacroDirectivesOffset)
739 : M(M), MacroDirectivesOffset(MacroDirectivesOffset) {}
742 using PendingMacroIDsMap =
743 llvm::MapVector<IdentifierInfo *, SmallVector<PendingMacroInfo, 2>>;
747 PendingMacroIDsMap PendingMacroIDs;
838 unsigned ForceCUDAHostDeviceDepth = 0;
863 int PragmaMSStructState = -1;
866 int PragmaMSPointersToMembersState = -1;
872 struct PragmaPackStackEntry {
885 llvm::DenseMap<const Type *, std::set<std::string>> OpenCLTypeExtMap;
888 llvm::DenseMap<const Decl *, std::set<std::string>> OpenCLDeclExtMap;
909 : ID(ID), ImportLoc(ImportLoc) {}
920 std::string isysroot;
924 bool DisableValidation;
927 bool AllowASTWithCompilerErrors;
931 bool AllowConfigurationMismatch;
934 bool ValidateSystemInputs;
940 bool TriedLoadingGlobalIndex =
false;
943 bool ProcessingUpdateRecords =
false;
945 using SwitchCaseMapTy = llvm::DenseMap<unsigned, SwitchCase *>;
951 SwitchCaseMapTy SwitchCaseStmts;
953 SwitchCaseMapTy *CurrSwitchCaseStmts;
957 unsigned NumSLocEntriesRead = 0;
960 unsigned TotalNumSLocEntries = 0;
964 unsigned NumStatementsRead = 0;
968 unsigned TotalNumStatements = 0;
971 unsigned NumMacrosRead = 0;
974 unsigned TotalNumMacros = 0;
977 unsigned NumIdentifierLookups = 0;
980 unsigned NumIdentifierLookupHits = 0;
983 unsigned NumSelectorsRead = 0;
986 unsigned NumMethodPoolEntriesRead = 0;
990 unsigned NumMethodPoolLookups = 0;
994 unsigned NumMethodPoolHits = 0;
998 unsigned NumMethodPoolTableLookups = 0;
1002 unsigned NumMethodPoolTableHits = 0;
1005 unsigned TotalNumMethodPoolEntries = 0;
1008 unsigned NumLexicalDeclContextsRead = 0, TotalLexicalDeclContexts = 0;
1011 unsigned NumVisibleDeclContextsRead = 0, TotalVisibleDeclContexts = 0;
1014 uint64_t TotalModulesSizeInBits = 0;
1017 unsigned NumCurrentElementsDeserializing = 0;
1023 bool PassingDeclsToConsumer =
false;
1030 llvm::MapVector<IdentifierInfo *, SmallVector<uint32_t, 4>>
1031 PendingIdentifierInfos;
1035 llvm::SmallMapVector<IdentifierInfo *, SmallVector<NamedDecl*, 2>, 16>
1036 PendingFakeLookupResults;
1040 llvm::DenseMap<IdentifierInfo *, unsigned> IdentifierGeneration;
1042 class InterestingDecl {
1044 bool DeclHasPendingBody;
1047 InterestingDecl(Decl *D,
bool HasBody)
1048 : D(D), DeclHasPendingBody(HasBody) {}
1050 Decl *getDecl() {
return D; }
1053 bool hasPendingBody() {
return DeclHasPendingBody; }
1062 std::deque<InterestingDecl> PotentiallyInterestingDecls;
1068 PendingFunctionTypes;
1073 SmallVector<std::pair<Decl *, uint64_t>, 16> PendingDeclChains;
1081 struct PendingDeclContextInfo {
1092 std::deque<PendingDeclContextInfo> PendingDeclContextInfos;
1102 using DataPointers =
1103 std::pair<CXXRecordDecl *, struct CXXRecordDecl::DefinitionData *>;
1106 llvm::SmallDenseMap<CXXRecordDecl *, llvm::SmallVector<DataPointers, 2>, 2>
1107 PendingOdrMergeFailures;
1110 llvm::SmallDenseMap<FunctionDecl *, llvm::SmallVector<FunctionDecl *, 2>, 2>
1111 PendingFunctionOdrMergeFailures;
1114 llvm::SmallDenseMap<EnumDecl *, llvm::SmallVector<EnumDecl *, 2>, 2>
1115 PendingEnumOdrMergeFailures;
1118 llvm::SmallPtrSet<DeclContext*, 2> DiagnosedOdrMergeFailures;
1122 llvm::SmallPtrSet<ObjCCategoryDecl *, 16> CategoriesDeserialized;
1130 llvm::DenseMap<Decl *, SmallVector<serialization::DeclID, 2>>;
1137 KeyDeclsMap KeyDecls;
1142 llvm::DenseMap<DeclContext *, DeclContext *> MergedDeclContexts;
1146 llvm::DenseMap<EnumDecl *, EnumDecl *> EnumDefinitions;
1153 Read_None, Read_Decl, Read_Type, Read_Stmt
1157 ReadingKind ReadingKind = Read_None;
1160 class ReadingKindTracker {
1162 enum ReadingKind PrevKind;
1165 ReadingKindTracker(
enum ReadingKind newKind,
ASTReader &reader)
1166 : Reader(reader), PrevKind(Reader.ReadingKind) {
1167 Reader.ReadingKind = newKind;
1170 ReadingKindTracker(
const ReadingKindTracker &) =
delete;
1171 ReadingKindTracker &operator=(
const ReadingKindTracker &) =
delete;
1172 ~ReadingKindTracker() { Reader.ReadingKind = PrevKind; }
1176 class ProcessingUpdatesRAIIObj {
1181 ProcessingUpdatesRAIIObj(
ASTReader &reader)
1182 : Reader(reader), PrevState(Reader.ProcessingUpdateRecords) {
1183 Reader.ProcessingUpdateRecords =
true;
1186 ProcessingUpdatesRAIIObj(
const ProcessingUpdatesRAIIObj &) =
delete;
1187 ProcessingUpdatesRAIIObj &
1188 operator=(
const ProcessingUpdatesRAIIObj &) =
delete;
1189 ~ProcessingUpdatesRAIIObj() { Reader.ProcessingUpdateRecords = PrevState; }
1200 std::string SuggestedPredefines;
1202 llvm::DenseMap<const Decl *, bool> DefinitionSource;
1207 struct InputFileInfo {
1213 bool TopLevelModuleMap;
1217 InputFileInfo readInputFileInfo(
ModuleFile &F,
unsigned ID);
1222 bool Complain =
true);
1226 static void ResolveImportedPath(std::string &Filename, StringRef Prefix);
1236 auto I = KeyDecls.find(D);
1237 if (I == KeyDecls.end() || I->second.empty())
1239 return GetExistingDecl(I->second[0]);
1242 return getKeyDeclaration(const_cast<Decl*>(D));
1246 template <
typename Fn>
1252 auto It = KeyDecls.find(const_cast<Decl*>(D));
1253 if (It != KeyDecls.end())
1254 for (
auto ID : It->second)
1255 Visit(GetExistingDecl(ID));
1260 getLoadedLookupTables(DeclContext *Primary)
const;
1263 struct ImportedModule {
1271 : Mod(Mod), ImportedBy(ImportedBy), ImportLoc(ImportLoc) {}
1277 off_t ExpectedSize, time_t ExpectedModTime,
1279 unsigned ClientLoadCapabilities);
1283 unsigned ClientLoadCapabilities);
1285 llvm::BitstreamCursor &Stream,
unsigned ClientLoadCapabilities,
1287 std::string &SuggestedPredefines);
1294 unsigned ClientLoadCapabilities);
1297 readUnhashedControlBlockImpl(
ModuleFile *F, llvm::StringRef StreamData,
1298 unsigned ClientLoadCapabilities,
1299 bool AllowCompatibleConfigurationMismatch,
1301 bool ValidateDiagnosticOptions);
1305 void ReadModuleOffsetMap(
ModuleFile &F)
const;
1308 llvm::BitstreamCursor &SLocCursorForID(
int ID);
1312 unsigned ClientLoadCapabilities);
1314 unsigned ClientLoadCapabilities);
1315 static bool ParseLanguageOptions(
const RecordData &Record,
bool Complain,
1317 bool AllowCompatibleDifferences);
1318 static bool ParseTargetOptions(
const RecordData &Record,
bool Complain,
1320 bool AllowCompatibleDifferences);
1321 static bool ParseDiagnosticOptions(
const RecordData &Record,
bool Complain,
1323 static bool ParseFileSystemOptions(
const RecordData &Record,
bool Complain,
1325 static bool ParseHeaderSearchOptions(
const RecordData &Record,
bool Complain,
1327 static bool ParsePreprocessorOptions(
const RecordData &Record,
bool Complain,
1329 std::string &SuggestedPredefines);
1331 struct RecordLocation {
1338 QualType readTypeRecord(
unsigned Index);
1343 RecordLocation TypeCursorForIndex(
unsigned Index);
1344 void LoadedDecl(
unsigned Index, Decl *D);
1346 void markIncompleteDeclChain(Decl *Canon);
1351 Decl *getMostRecentExistingDecl(Decl *D);
1355 void loadDeclUpdateRecords(PendingUpdateRecord &Record);
1356 void loadPendingDeclChain(Decl *D, uint64_t LocalOffset);
1358 unsigned PreviousGeneration = 0);
1360 RecordLocation getLocalBitOffset(uint64_t GlobalOffset);
1361 uint64_t getGlobalBitOffset(ModuleFile &M, uint32_t LocalOffset);
1366 findPreprocessedEntity(
SourceLocation Loc,
bool EndsAfter)
const;
1375 findNextPreprocessedEntity(
1376 GlobalSLocOffsetMapType::const_iterator SLocMapI)
const;
1380 std::pair<ModuleFile *, unsigned>
1381 getModulePreprocessedEntity(
unsigned GlobalIndex);
1385 llvm::iterator_range<PreprocessingRecord::iterator>
1386 getModulePreprocessedEntities(ModuleFile &Mod)
const;
1390 :
public llvm::iterator_adaptor_base<
1391 ModuleDeclIterator, const serialization::LocalDeclID *,
1392 std::random_access_iterator_tag, const Decl *, ptrdiff_t,
1393 const Decl *, const Decl *> {
1395 ModuleFile *Mod =
nullptr;
1402 : iterator_adaptor_base(Pos), Reader(Reader), Mod(Mod) {}
1411 assert(Reader == RHS.Reader && Mod == RHS.Mod);
1416 llvm::iterator_range<ModuleDeclIterator>
1417 getModuleFileLevelDecls(ModuleFile &Mod);
1420 void PassInterestingDeclsToConsumer();
1421 void PassInterestingDeclToConsumer(Decl *D);
1423 void finishPendingActions();
1424 void diagnoseOdrViolations();
1428 void addPendingDeclContextInfo(Decl *D,
1432 PendingDeclContextInfo Info = { D, SemaDC, LexicalDC };
1433 PendingDeclContextInfos.push_back(Info);
1440 void Error(StringRef Msg)
const;
1441 void Error(
unsigned DiagID, StringRef Arg1 = StringRef(),
1442 StringRef Arg2 = StringRef())
const;
1486 ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
1487 StringRef isysroot =
"",
bool DisableValidation =
false,
1488 bool AllowASTWithCompilerErrors =
false,
1489 bool AllowConfigurationMismatch =
false,
1490 bool ValidateSystemInputs =
false,
bool UseGlobalIndex =
true,
1491 std::unique_ptr<llvm::Timer> ReadTimer = {});
1515 ARR_OutOfDate = 0x2,
1519 ARR_VersionMismatch = 0x4,
1524 ARR_ConfigurationMismatch = 0x8
1545 unsigned ClientLoadCapabilities,
1557 void makeModuleVisible(
Module *Mod,
1570 return std::move(Listener);
1575 this->Listener = std::move(Listener);
1583 L = llvm::make_unique<ChainedASTReaderListener>(std::move(L),
1584 std::move(Listener));
1585 Listener = std::move(L);
1591 bool Chained =
false;
1599 L = llvm::make_unique<ChainedASTReaderListener>(std::move(L),
1608 Reader.
setListener(static_cast<ChainedASTReaderListener *>(New.get())
1615 bool TakeOwnership =
false);
1619 return DeserializationListener;
1634 bool loadGlobalIndex();
1638 bool isGlobalIndexUnavailable()
const;
1641 void InitializeContext();
1648 std::unique_ptr<llvm::MemoryBuffer> Buffer) {
1657 void finalizeForWriting();
1674 getOriginalSourceFile(
const std::string &ASTFileName,
FileManager &FileMgr,
1682 readASTFileControlBlock(StringRef Filename,
FileManager &FileMgr,
1684 bool FindModuleFileExtensions,
1686 bool ValidateDiagnosticOptions);
1690 static bool isAcceptableASTFile(StringRef Filename,
FileManager &FileMgr,
1695 StringRef ExistingModuleCachePath);
1710 std::pair<unsigned, unsigned>
1711 findPreprocessedEntitiesInRange(
SourceRange Range)
override;
1719 SourceRange ReadSkippedRange(
unsigned Index)
override;
1728 return TotalNumSLocEntries;
1733 return static_cast<unsigned>(IdentifiersLoaded.size());
1738 return static_cast<unsigned>(MacrosLoaded.size());
1743 return static_cast<unsigned>(TypesLoaded.size());
1748 return static_cast<unsigned>(DeclsLoaded.size());
1753 return static_cast<unsigned>(SubmodulesLoaded.size());
1758 return static_cast<unsigned>(SelectorsLoaded.size());
1765 for (
const auto &M : ModuleMgr)
1778 ReadTemplateArgumentLoc(ModuleFile &F,
1782 ReadASTTemplateArgumentListInfo(ModuleFile &F,
1790 void ReadTypeLoc(ModuleFile &F,
const RecordData &Record,
unsigned &Idx,
1798 QualType getLocalType(ModuleFile &F,
unsigned LocalID);
1806 if (Idx >= Record.size())
1809 return getLocalType(F, Record[Idx++]);
1822 ModuleFile *getOwningModuleFile(
const Decl *D);
1826 std::string getOwningModuleNameForDiagnostic(
const Decl *D);
1834 Decl *GetExternalDecl(uint32_t ID)
override;
1842 return GetDecl(getGlobalDeclID(F, LocalID));
1848 template<
typename T>
1850 return cast_or_null<T>(GetLocalDecl(F, LocalID));
1859 mapGlobalIDToModuleFileGlobalID(ModuleFile &M,
1872 return GetDecl(ReadDeclID(F, R, I));
1880 template<
typename T>
1882 return cast_or_null<T>(GetDecl(ReadDeclID(F, R, I)));
1888 void CompleteRedeclChain(
const Decl *D)
override;
1897 Stmt *GetExternalDeclStmt(uint64_t Offset)
override;
1902 static bool ReadBlockAbbrevs(llvm::BitstreamCursor &Cursor,
unsigned BlockID);
1907 bool FindExternalVisibleDeclsByName(
const DeclContext *DC,
1924 FindExternalLexicalDecls(
const DeclContext *DC,
1925 llvm::function_ref<
bool(
Decl::Kind)> IsKindWeWant,
1931 void FindFileRegionDecls(
FileID File,
unsigned Offset,
unsigned Length,
1937 void StartedDeserializing()
override;
1941 void FinishedDeserializing()
override;
1948 void StartTranslationUnit(
ASTConsumer *Consumer)
override;
1951 void PrintStats()
override;
1963 void InitializeSema(
Sema &S)
override;
1982 void ReadMethodPool(
Selector Sel)
override;
1986 void updateOutOfDateSelector(
Selector Sel)
override;
1990 void ReadKnownNamespaces(
1993 void ReadUndefinedButUsed(
1994 llvm::MapVector<NamedDecl *, SourceLocation> &Undefined)
override;
1996 void ReadMismatchingDeleteExpressions(llvm::MapVector<
2000 void ReadTentativeDefinitions(
2003 void ReadUnusedFileScopedDecls(
2006 void ReadDelegatingConstructors(
2011 void ReadUnusedLocalTypedefNameCandidates(
2014 void ReadReferencedSelectors(
2017 void ReadWeakUndeclaredIdentifiers(
2022 void ReadPendingInstantiations(
2026 void ReadLateParsedTemplates(
2027 llvm::MapVector<
const FunctionDecl *, std::unique_ptr<LateParsedTemplate>>
2048 return DecodeIdentifierInfo(getGlobalIdentifierID(M, Record[Idx++]));
2055 return DecodeIdentifierInfo(ID);
2058 IdentifierInfo *getLocalIdentifier(ModuleFile &M,
unsigned LocalID);
2063 void resolvePendingMacro(
IdentifierInfo *II,
const PendingMacroInfo &PMInfo);
2073 bool ReadSLocEntry(
int ID)
override;
2077 std::pair<SourceLocation, StringRef> getModuleImportLoc(
int ID)
override;
2082 getGlobalSubmoduleID(ModuleFile &M,
unsigned LocalID);
2091 Module *getModule(
unsigned ID)
override;
2093 bool DeclIsFromPCHWithObjectFile(
const Decl *D)
override;
2097 ModuleFile *getLocalModuleFile(ModuleFile &M,
unsigned ID);
2100 unsigned getModuleFileID(ModuleFile *M);
2105 ExtKind hasExternalDefinitions(
const Decl *D)
override;
2109 Selector getLocalSelector(ModuleFile &M,
unsigned LocalID);
2114 uint32_t GetNumExternalSelectors()
override;
2117 return getLocalSelector(M, Record[Idx++]);
2123 unsigned LocalID)
const;
2128 void ReadDeclarationNameLoc(ModuleFile &F,
2152 bool Canonicalize =
false);
2162 unsigned &Idx,
bool Canonicalize =
false);
2174 ReadCXXCtorInitializers(ModuleFile &F,
const RecordData &Record,
2189 return TranslateSourceLocation(ModuleFile, Loc);
2197 ReadModuleOffsetMap(ModuleFile);
2200 "Cannot find offset to remap.");
2201 int Remap = ModuleFile.
SLocRemap.
find(Loc.getOffset())->second;
2209 return ReadSourceLocation(ModuleFile, Record[Idx++]);
2217 llvm::APInt ReadAPInt(
const RecordData &Record,
unsigned &Idx);
2220 llvm::APSInt ReadAPSInt(
const RecordData &Record,
unsigned &Idx);
2223 llvm::APFloat ReadAPFloat(
const RecordData &Record,
2224 const llvm::fltSemantics &Sem,
unsigned &Idx);
2227 static std::string ReadString(
const RecordData &Record,
unsigned &Idx);
2231 Idx += Record[Idx] + 1;
2235 std::string ReadPath(ModuleFile &F,
const RecordData &Record,
unsigned &Idx);
2239 SkipString(Record, Idx);
2243 static VersionTuple ReadVersionTuple(
const RecordData &Record,
unsigned &Idx);
2249 Attr *ReadAttr(ModuleFile &M,
const RecordData &Record,
unsigned &Idx);
2255 Stmt *ReadStmt(ModuleFile &F);
2258 Expr *ReadExpr(ModuleFile &F);
2262 assert(ReadingKind == Read_Stmt &&
2263 "Should be called only during statement reading!");
2266 assert(!StmtStack.empty() &&
"Read too many sub-statements!");
2267 return StmtStack.pop_back_val();
2271 Expr *ReadSubExpr();
2277 MacroInfo *ReadMacroRecord(ModuleFile &F, uint64_t Offset);
2282 getGlobalPreprocessedEntityID(ModuleFile &M,
unsigned LocalID)
const;
2291 uint64_t MacroDirectivesOffset);
2294 void ReadDefinedMacros()
override;
2303 void completeVisibleDeclsMap(
const DeclContext *DC)
override;
2307 assert(ContextObj &&
"requested AST context when not loading AST");
2331 void RecordSwitchCaseID(
SwitchCase *SC,
unsigned ID);
2334 SwitchCase *getSwitchCaseWithID(
unsigned ID);
2336 void ClearSwitchCaseIDs();
2343 void ReadComments()
override;
2347 bool IncludeSystem,
bool Complain,
2378 unsigned readRecord(llvm::BitstreamCursor &Cursor,
unsigned AbbrevID);
2390 size_t size()
const {
return Record.size(); }
2396 const uint64_t &
back()
const {
return Record.back(); }
2400 const uint64_t &
readInt() {
return Record[Idx++]; }
2421 return Reader->ReadLexicalDeclContextStorage(*F, F->
DeclsCursor, Offset,
2428 return Reader->ReadVisibleDeclContextStorage(*F, F->
DeclsCursor, Offset,
2434 return Reader->readExceptionSpec(*F, ExceptionStorage, ESI, Record, Idx);
2439 return Reader->getGlobalBitOffset(*F, LocalOffset);
2457 template<
typename T>
2459 return cast_or_null<T>(Reader->
GetLocalDecl(*F, LocalID));
2497 return Reader->
readType(*F, Record, Idx);
2510 return Reader->
ReadDecl(*F, Record, Idx);
2518 template<
typename T>
2520 return Reader->
ReadDeclAs<T>(*F, Record, Idx);
2572 bool Canonicalize =
false) {
2628 return Reader->
ReadPath(*F, Record, Idx);
2638 return Reader->
ReadAttr(*F, Record, Idx);
2648 return Reader->
ReadToken(*F, Record, Idx);
2665 : Cursor(Cursor), Offset(Cursor.GetCurrentBitNo()) {}
2668 Cursor.JumpToBit(Offset);
2672 llvm::BitstreamCursor &
Cursor;
2676 inline void PCHValidator::Error(
const char *Msg) {
2686 : Record(Record), Context(Record.getContext()) {}
2688 #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.
#define OPENMP_CLAUSE(Name, Class)
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.
This represents implicit clause 'flush' for the '#pragma omp flush' directive.
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.