14 #ifndef LLVM_CLANG_SERIALIZATION_ASTREADER_H
15 #define LLVM_CLANG_SERIALIZATION_ASTREADER_H
34 #include "llvm/ADT/APFloat.h"
35 #include "llvm/ADT/APInt.h"
36 #include "llvm/ADT/APSInt.h"
37 #include "llvm/ADT/MapVector.h"
38 #include "llvm/ADT/SmallPtrSet.h"
39 #include "llvm/ADT/SmallSet.h"
40 #include "llvm/ADT/SmallVector.h"
41 #include "llvm/ADT/StringRef.h"
42 #include "llvm/ADT/TinyPtrVector.h"
43 #include "llvm/Bitcode/BitstreamReader.h"
44 #include "llvm/Support/DataTypes.h"
45 #include "llvm/Support/Timer.h"
62 class ASTIdentifierIterator;
67 class DefMacroDirective;
68 class DiagnosticOptions;
69 class NestedNameSpecifier;
70 class CXXBaseSpecifier;
71 class CXXConstructorDecl;
72 class CXXCtorInitializer;
73 class GlobalModuleIndex;
75 class MacroDefinition;
79 class OpaqueValueExpr;
81 class PreprocessorOptions;
84 class ASTDeserializationListener;
90 struct HeaderFileInfo;
93 class LazyASTUnresolvedSet;
121 bool AllowCompatibleDifferences) {
130 bool AllowCompatibleDifferences) {
158 StringRef SpecificModuleCachePath,
173 std::string &SuggestedPredefines) {
211 std::unique_ptr<ASTReaderListener> First;
212 std::unique_ptr<ASTReaderListener> Second;
217 std::unique_ptr<ASTReaderListener> Second)
218 : First(std::move(First)), Second(std::move(Second)) {}
220 std::unique_ptr<ASTReaderListener>
takeFirst() {
return std::move(First); }
221 std::unique_ptr<ASTReaderListener>
takeSecond() {
return std::move(Second); }
227 bool AllowCompatibleDifferences)
override;
229 bool AllowCompatibleDifferences)
override;
231 bool Complain)
override;
233 bool Complain)
override;
236 StringRef SpecificModuleCachePath,
237 bool Complain)
override;
240 std::string &SuggestedPredefines)
override;
247 bool isOverridden)
override;
258 : PP(PP), Reader(Reader) {}
261 bool AllowCompatibleDifferences)
override;
263 bool AllowCompatibleDifferences)
override;
265 bool Complain)
override;
267 std::string &SuggestedPredefines)
override;
269 StringRef SpecificModuleCachePath,
270 bool Complain)
override;
274 void Error(
const char *Msg);
277 namespace serialization {
279 class ReadMethodPoolVisitor;
357 std::unique_ptr<ASTReaderListener> Listener;
361 bool OwnsDeserializationListener;
385 std::unique_ptr<llvm::Timer> ReadTimer;
392 std::unique_ptr<GlobalModuleIndex> GlobalIndex;
411 std::vector<QualType> TypesLoaded;
425 std::vector<Decl *> DeclsLoaded;
434 typedef std::pair<ModuleFile *, uint64_t> FileOffset;
436 typedef llvm::DenseMap<serialization::DeclID, FileOffsetsTy>
437 DeclUpdateOffsetsMap;
441 DeclUpdateOffsetsMap DeclUpdateOffsets;
446 PendingUpdateRecords;
452 llvm::DenseMap<void *, PendingFakeDefinitionKind> PendingFakeDefinitionData;
458 llvm::SmallMapVector<Decl *, FunctionDecl *, 4> PendingExceptionSpecUpdates;
460 struct ReplacedDeclInfo {
465 ReplacedDeclInfo() : Mod(nullptr),
Offset(0), RawLoc(0) {}
467 : Mod(Mod), Offset(Offset), RawLoc(RawLoc) {}
470 typedef llvm::DenseMap<serialization::DeclID, ReplacedDeclInfo>
473 DeclReplacementMap ReplacedDecls;
477 llvm::DenseMap<std::pair<DeclContext*, IdentifierInfo*>, NamedDecl*>
478 ImportedTypedefNamesForLinkage;
482 llvm::DenseMap<DeclContext*, llvm::SmallVector<NamedDecl*, 2>>
483 AnonymousDeclarationsForMerging;
485 struct FileDeclsInfo {
487 ArrayRef<serialization::LocalDeclID> Decls;
489 FileDeclsInfo() : Mod(nullptr) {}
490 FileDeclsInfo(
ModuleFile *Mod, ArrayRef<serialization::LocalDeclID> Decls)
491 : Mod(Mod), Decls(Decls) {}
495 llvm::DenseMap<FileID, FileDeclsInfo> FileDeclIDs;
504 typedef llvm::DenseMap<serialization::DeclID, DeclContextVisibleUpdates>
505 DeclContextVisibleUpdatesPending;
509 DeclContextVisibleUpdatesPending PendingVisibleUpdates;
513 llvm::SmallPtrSet<Decl *, 4> PendingDefinitions;
515 typedef llvm::MapVector<Decl *, uint64_t,
516 llvm::SmallDenseMap<Decl *, unsigned, 4>,
517 SmallVector<std::pair<Decl *, uint64_t>, 4> >
521 PendingBodiesMap PendingBodies;
525 llvm::SetVector<NamedDecl*> PendingMergedDefinitionsToDeduplicate;
529 llvm::BitstreamCursor &
Cursor,
530 const std::pair<uint64_t, uint64_t> &Offsets,
531 serialization::DeclContextInfo &Info);
539 std::vector<IdentifierInfo *> IdentifiersLoaded;
541 typedef ContinuousRangeMap<serialization::IdentID, ModuleFile *, 4>
542 GlobalIdentifierMapType;
547 GlobalIdentifierMapType GlobalIdentifierMap;
555 std::vector<MacroInfo *> MacrosLoaded;
557 typedef std::pair<IdentifierInfo *, serialization::SubmoduleID>
565 typedef ContinuousRangeMap<serialization::MacroID, ModuleFile *, 4>
571 GlobalMacroMapType GlobalMacroMap;
577 SmallVector<Module *, 2> SubmodulesLoaded;
579 typedef ContinuousRangeMap<serialization::SubmoduleID, ModuleFile *, 4>
580 GlobalSubmoduleMapType;
585 GlobalSubmoduleMapType GlobalSubmoduleMap;
588 typedef SmallVector<Decl*, 2> HiddenNames;
589 typedef llvm::DenseMap<Module *, HiddenNames> HiddenNamesMapType;
593 HiddenNamesMapType HiddenNamesMap;
597 struct UnresolvedModuleRef {
605 enum { Import, Export, Conflict }
Kind;
611 unsigned IsWildcard : 1;
619 SmallVector<UnresolvedModuleRef, 2> UnresolvedModuleRefs;
626 SmallVector<Selector, 16> SelectorsLoaded;
628 typedef ContinuousRangeMap<serialization::SelectorID, ModuleFile *, 4>
629 GlobalSelectorMapType;
634 GlobalSelectorMapType GlobalSelectorMap;
638 llvm::DenseMap<Selector, unsigned> SelectorGeneration;
640 struct PendingMacroInfo {
642 uint64_t MacroDirectivesOffset;
644 PendingMacroInfo(
ModuleFile *M, uint64_t MacroDirectivesOffset)
645 : M(M), MacroDirectivesOffset(MacroDirectivesOffset) {}
648 typedef llvm::MapVector<IdentifierInfo *, SmallVector<PendingMacroInfo, 2> >
653 PendingMacroIDsMap PendingMacroIDs;
655 typedef ContinuousRangeMap<unsigned, ModuleFile *, 4>
656 GlobalPreprocessedEntityMapType;
661 GlobalPreprocessedEntityMapType GlobalPreprocessedEntityMap;
673 SmallVector<uint64_t, 16> EagerlyDeserializedDecls;
680 SmallVector<uint64_t, 16> TentativeDefinitions;
687 SmallVector<uint64_t, 64> VTableUses;
695 SmallVector<uint64_t, 64> PendingInstantiations;
705 SmallVector<uint64_t, 16> UnusedFileScopedDecls;
709 SmallVector<uint64_t, 4> DelegatingCtorDecls;
713 SmallVector<uint64_t, 64> ReferencedSelectorsData;
717 SmallVector<uint64_t, 64> WeakUndeclaredIdentifiers;
722 SmallVector<uint64_t, 4> ExtVectorDecls;
733 SmallVector<uint64_t, 16> UnusedLocalTypedefNameCandidates;
738 SmallVector<uint64_t, 4> SemaDeclRefs;
743 SmallVector<uint64_t, 16> SpecialTypes;
749 SmallVector<uint64_t, 2> CUDASpecialDeclRefs;
752 SmallVector<uint64_t, 1> FPPragmaOptions;
755 SourceLocation OptimizeOffPragmaLocation;
758 SmallVector<uint64_t, 1> OpenCLExtensions;
761 SmallVector<uint64_t, 4> KnownNamespaces;
765 SmallVector<uint64_t, 8> UndefinedButUsed;
768 SmallVector<uint64_t, 8> DelayedDeleteExprs;
771 SmallVector<uint64_t, 1> LateParsedTemplates;
773 struct ImportedSubmodule {
775 SourceLocation ImportLoc;
778 : ID(ID), ImportLoc(ImportLoc) {}
783 SmallVector<ImportedSubmodule, 2> ImportedModules;
787 std::string CurrentDir;
791 std::string isysroot;
795 bool DisableValidation;
798 bool AllowASTWithCompilerErrors;
802 bool AllowConfigurationMismatch;
805 bool ValidateSystemInputs;
811 bool TriedLoadingGlobalIndex;
813 typedef llvm::DenseMap<unsigned, SwitchCase *> SwitchCaseMapTy;
818 SwitchCaseMapTy SwitchCaseStmts;
820 SwitchCaseMapTy *CurrSwitchCaseStmts;
824 unsigned NumSLocEntriesRead;
827 unsigned TotalNumSLocEntries;
831 unsigned NumStatementsRead;
835 unsigned TotalNumStatements;
838 unsigned NumMacrosRead;
841 unsigned TotalNumMacros;
844 unsigned NumIdentifierLookups;
847 unsigned NumIdentifierLookupHits;
850 unsigned NumSelectorsRead;
853 unsigned NumMethodPoolEntriesRead;
857 unsigned NumMethodPoolLookups;
861 unsigned NumMethodPoolHits;
865 unsigned NumMethodPoolTableLookups;
869 unsigned NumMethodPoolTableHits;
872 unsigned TotalNumMethodPoolEntries;
875 unsigned NumLexicalDeclContextsRead, TotalLexicalDeclContexts;
878 unsigned NumVisibleDeclContextsRead, TotalVisibleDeclContexts;
881 uint64_t TotalModulesSizeInBits;
884 unsigned NumCurrentElementsDeserializing;
890 bool PassingDeclsToConsumer;
897 llvm::MapVector<IdentifierInfo *, SmallVector<uint32_t, 4> >
898 PendingIdentifierInfos;
902 llvm::SmallMapVector<IdentifierInfo *, SmallVector<NamedDecl*, 2>, 16>
903 PendingFakeLookupResults;
907 llvm::DenseMap<IdentifierInfo *, unsigned> IdentifierGeneration;
915 std::deque<Decl *> InterestingDecls;
919 llvm::SmallPtrSet<Decl *, 16> RedeclsDeserialized;
927 SmallVector<Decl *, 16> PendingDeclChains;
930 llvm::SmallSet<Decl *, 16> PendingDeclChainsKnown;
934 SmallVector<Decl *, 16> PendingIncompleteDeclChains;
938 struct PendingDeclContextInfo {
949 std::deque<PendingDeclContextInfo> PendingDeclContextInfos;
960 llvm::SmallDenseMap<CXXRecordDecl *, llvm::TinyPtrVector<CXXRecordDecl *>, 2>
961 PendingOdrMergeFailures;
964 llvm::SmallPtrSet<DeclContext*, 2> DiagnosedOdrMergeFailures;
968 llvm::SmallPtrSet<ObjCCategoryDecl *, 16> CategoriesDeserialized;
973 SmallVector<ObjCInterfaceDecl *, 16> ObjCClassesLoaded;
979 llvm::DenseMap<const DeclContext*, SmallVector<const DeclContext*, 2>>
982 typedef llvm::DenseMap<Decl *, SmallVector<serialization::DeclID, 2> >
990 KeyDeclsMap KeyDecls;
995 llvm::DenseMap<DeclContext *, DeclContext *> MergedDeclContexts;
999 llvm::DenseMap<EnumDecl *, EnumDecl *> EnumDefinitions;
1002 SmallVector<Stmt *, 16> StmtStack;
1006 Read_None, Read_Decl, Read_Type, Read_Stmt
1010 ReadingKind ReadingKind;
1013 class ReadingKindTracker {
1015 enum ReadingKind PrevKind;
1017 ReadingKindTracker(
const ReadingKindTracker &) =
delete;
1018 void operator=(
const ReadingKindTracker &) =
delete;
1021 ReadingKindTracker(
enum ReadingKind newKind, ASTReader &reader)
1022 : Reader(reader), PrevKind(Reader.ReadingKind) {
1023 Reader.ReadingKind = newKind;
1026 ~ReadingKindTracker() { Reader.ReadingKind = PrevKind; }
1037 std::string SuggestedPredefines;
1042 struct InputFileInfo {
1043 std::string Filename;
1050 InputFileInfo readInputFileInfo(
ModuleFile &F,
unsigned ID);
1052 std::string getInputFileName(
ModuleFile &F,
unsigned ID);
1056 serialization::InputFile getInputFile(
ModuleFile &F,
unsigned ID,
1057 bool Complain =
true);
1071 auto I = KeyDecls.find(D);
1072 if (I == KeyDecls.end() || I->second.empty())
1081 template <
typename Fn>
1087 auto It = KeyDecls.find(const_cast<Decl*>(D));
1088 if (It != KeyDecls.end())
1089 for (
auto ID : It->second)
1094 struct ImportedModule {
1102 : Mod(Mod), ImportedBy(ImportedBy), ImportLoc(ImportLoc) { }
1106 SourceLocation ImportLoc,
ModuleFile *ImportedBy,
1107 SmallVectorImpl<ImportedModule> &Loaded,
1108 off_t ExpectedSize, time_t ExpectedModTime,
1110 unsigned ClientLoadCapabilities);
1112 SmallVectorImpl<ImportedModule> &Loaded,
1114 unsigned ClientLoadCapabilities);
1118 llvm::BitstreamCursor &SLocCursorForID(
int ID);
1119 SourceLocation getImportLocation(
ModuleFile *F);
1122 unsigned ClientLoadCapabilities);
1124 unsigned ClientLoadCapabilities);
1125 static bool ParseLanguageOptions(
const RecordData &Record,
bool Complain,
1126 ASTReaderListener &Listener,
1127 bool AllowCompatibleDifferences);
1128 static bool ParseTargetOptions(
const RecordData &Record,
bool Complain,
1129 ASTReaderListener &Listener,
1130 bool AllowCompatibleDifferences);
1131 static bool ParseDiagnosticOptions(
const RecordData &Record,
bool Complain,
1132 ASTReaderListener &Listener);
1133 static bool ParseFileSystemOptions(
const RecordData &Record,
bool Complain,
1134 ASTReaderListener &Listener);
1135 static bool ParseHeaderSearchOptions(
const RecordData &Record,
bool Complain,
1136 ASTReaderListener &Listener);
1137 static bool ParsePreprocessorOptions(
const RecordData &Record,
bool Complain,
1138 ASTReaderListener &Listener,
1139 std::string &SuggestedPredefines);
1141 struct RecordLocation {
1148 QualType readTypeRecord(
unsigned Index);
1150 SmallVectorImpl<QualType> &ExceptionStorage,
1151 FunctionProtoType::ExceptionSpecInfo &ESI,
1153 RecordLocation TypeCursorForIndex(
unsigned Index);
1154 void LoadedDecl(
unsigned Index, Decl *D);
1156 void markIncompleteDeclChain(Decl *Canon);
1161 Decl *getMostRecentExistingDecl(Decl *D);
1164 unsigned &RawLocation);
1166 void loadPendingDeclChain(Decl *D);
1168 unsigned PreviousGeneration = 0);
1170 RecordLocation getLocalBitOffset(uint64_t GlobalOffset);
1171 uint64_t getGlobalBitOffset(
ModuleFile &M, uint32_t LocalOffset);
1176 findPreprocessedEntity(SourceLocation Loc,
bool EndsAfter)
const;
1185 findNextPreprocessedEntity(
1190 std::pair<ModuleFile *, unsigned>
1191 getModulePreprocessedEntity(
unsigned GlobalIndex);
1195 llvm::iterator_range<PreprocessingRecord::iterator>
1196 getModulePreprocessedEntities(
ModuleFile &Mod)
const;
1198 class ModuleDeclIterator
1199 :
public llvm::iterator_adaptor_base<
1200 ModuleDeclIterator, const serialization::LocalDeclID *,
1201 std::random_access_iterator_tag, const Decl *, ptrdiff_t,
1202 const Decl *, const Decl *> {
1207 ModuleDeclIterator()
1208 : iterator_adaptor_base(nullptr), Reader(nullptr), Mod(nullptr) {}
1210 ModuleDeclIterator(ASTReader *Reader,
ModuleFile *Mod,
1212 : iterator_adaptor_base(Pos), Reader(Reader), Mod(Mod) {}
1215 return Reader->GetDecl(Reader->getGlobalDeclID(*Mod, *I));
1217 value_type operator->()
const {
return **
this; }
1219 bool operator==(
const ModuleDeclIterator &RHS)
const {
1220 assert(Reader == RHS.Reader && Mod == RHS.Mod);
1225 llvm::iterator_range<ModuleDeclIterator>
1228 void PassInterestingDeclsToConsumer();
1229 void PassInterestingDeclToConsumer(Decl *D);
1231 void finishPendingActions();
1232 void diagnoseOdrViolations();
1234 void pushExternalDeclIntoScope(NamedDecl *D, DeclarationName Name);
1236 void addPendingDeclContextInfo(Decl *D,
1240 PendingDeclContextInfo Info = { D, SemaDC, LexicalDC };
1241 PendingDeclContextInfos.push_back(Info);
1248 void Error(StringRef Msg);
1249 void Error(
unsigned DiagID, StringRef Arg1 = StringRef(),
1250 StringRef Arg2 = StringRef());
1252 ASTReader(
const ASTReader &) =
delete;
1253 void operator=(
const ASTReader &) =
delete;
1291 ASTReader(Preprocessor &PP, ASTContext &Context,
1292 const PCHContainerReader &PCHContainerRdr,
1293 StringRef isysroot =
"",
bool DisableValidation =
false,
1294 bool AllowASTWithCompilerErrors =
false,
1295 bool AllowConfigurationMismatch =
false,
1296 bool ValidateSystemInputs =
false,
bool UseGlobalIndex =
true,
1297 std::unique_ptr<llvm::Timer> ReadTimer = {});
1342 unsigned ClientLoadCapabilities);
1362 return std::move(Listener);
1367 this->Listener = std::move(Listener);
1375 L = llvm::make_unique<ChainedASTReaderListener>(std::move(L),
1376 std::move(Listener));
1377 Listener = std::move(L);
1387 : Reader(Reader), Chained(
false) {
1391 L = llvm::make_unique<ChainedASTReaderListener>(std::move(L),
1399 Reader.
setListener(static_cast<ChainedASTReaderListener *>(New.get())
1406 bool TakeOwnership =
false);
1434 std::unique_ptr<llvm::MemoryBuffer> Buffer) {
1479 std::string ExistingModuleCachePath);
1494 std::pair<unsigned, unsigned>
1509 return TotalNumSLocEntries;
1514 return static_cast<unsigned>(IdentifiersLoaded.size());
1519 return static_cast<unsigned>(MacrosLoaded.size());
1524 return static_cast<unsigned>(TypesLoaded.size());
1529 return static_cast<unsigned>(DeclsLoaded.size());
1534 return static_cast<unsigned>(SubmodulesLoaded.size());
1539 return static_cast<unsigned>(SelectorsLoaded.size());
1547 E = ModuleMgr.
end(); I != E; ++I) {
1548 Result += (*I)->NumPreprocessedEntities;
1586 if (Idx >= Record.size())
1628 template<
typename T>
1660 template<
typename T>
1758 virtual IdentifierInfo *
get(
const char *NameStart,
const char *NameEnd);
1760 return get(Name.begin(), Name.end());
1777 llvm::DenseMap<NamedDecl *, SourceLocation> &Undefined)
override;
1798 SmallVectorImpl<std::pair<Selector, SourceLocation> > &Sels)
override;
1801 SmallVectorImpl<std::pair<IdentifierInfo *, WeakInfo> > &WI)
override;
1810 llvm::MapVector<const FunctionDecl *, LateParsedTemplate *> &LPTMap)
1897 unsigned LocalID)
const;
1963 "Cannot find offset to remap.");
1964 int Remap = ModuleFile.
SLocRemap.
find(Loc.getOffset())->second;
1987 const llvm::fltSemantics &Sem,
unsigned &Idx);
2013 assert(ReadingKind == Read_Stmt &&
2014 "Should be called only during statement reading!");
2017 assert(!StmtStack.empty() &&
"Read too many sub-statements!");
2018 return StmtStack.pop_back_val();
2042 uint64_t MacroDirectivesOffset);
2097 : Cursor(Cursor),
Offset(Cursor.GetCurrentBitNo()) { }
2104 llvm::BitstreamCursor &
Cursor;
2108 inline void PCHValidator::Error(
const char *Msg) {
llvm::APInt ReadAPInt(const RecordData &Record, unsigned &Idx)
Read an integral value.
Decl * GetExistingDecl(serialization::DeclID ID)
Resolve a declaration ID into a declaration. Return 0 if it's not been loaded yet.
SmallVector< std::pair< llvm::BitstreamCursor, serialization::ModuleFile * >, 8 > CommentsCursors
Cursors for comments blocks.
bool FindExternalVisibleDeclsByName(const DeclContext *DC, DeclarationName Name) override
Finds all the visible declarations with a given name. The current implementation of this method just ...
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...
The client can handle an AST file that cannot load because it was built with a different version of C...
IdentifierIterator * getIdentifiers() override
Retrieve an iterator into the set of all identifiers in all loaded AST files.
unsigned getTotalNumTypes() const
Returns the number of types found in the chain.
bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef SpecificModuleCachePath, bool Complain) override
Receives the header search options.
Smart pointer class that efficiently represents Objective-C method names.
bool visitInputFile(StringRef Filename, bool isSystem, bool isOverridden) override
if needsInputFileVisitation returns true, this is called for each non-system input file of the AST Fi...
ASTReadResult ReadAST(const std::string &FileName, ModuleKind Type, SourceLocation ImportLoc, unsigned ClientLoadCapabilities)
Load the AST file designated by the given file name.
virtual bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, bool Complain, std::string &SuggestedPredefines)
Receives the preprocessor options.
Represents a version number in the form major[.minor[.subminor[.build]]].
void SetIdentifierInfo(unsigned ID, IdentifierInfo *II)
Implements support for file system lookup, file system caching, and directory search management...
RAII class for safely pairing a StartedDeserializing call with FinishedDeserializing.
bool operator==(CanQual< T > x, CanQual< U > y)
Defines the clang::FileManager interface and associated types.
CXXBaseSpecifier * GetExternalCXXBaseSpecifiers(uint64_t Offset) override
Resolve the offset of a set of C++ base specifiers in the decl stream into an array of specifiers...
Optional< bool > isPreprocessedEntityInFileID(unsigned Index, FileID FID) override
Optionally returns true or false if the preallocated preprocessed entity with index Index came from f...
SourceLocation ReadSourceLocation(ModuleFile &ModuleFile, unsigned Raw) const
Read a source location from raw form.
void ReadComments() override
Loads comment ranges.
Defines the SourceManager interface.
bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain, bool AllowCompatibleDifferences) override
Receives the target options.
GlobalModuleIndex * getGlobalIndex()
Return global module index.
Module * getSubmodule(serialization::SubmoduleID GlobalID)
Retrieve the submodule that corresponds to a global submodule ID.
ModuleManager::ModuleConstIterator ModuleConstIterator
SmallVector< uint64_t, 64 > RecordData
virtual void ReadCounter(const serialization::ModuleFile &M, unsigned Value)
Receives COUNTER value.
Preprocessor & getPreprocessor() const
Retrieve the preprocessor.
uint32_t DeclID
An ID number that refers to a declaration in an AST file.
IdentifierInfo * getLocalIdentifier(ModuleFile &M, unsigned LocalID)
StringRef getOriginalSourceFile()
Retrieve the name of the original source file name for the primary module file.
static bool readASTFileControlBlock(StringRef Filename, FileManager &FileMgr, const PCHContainerReader &PCHContainerRdr, ASTReaderListener &Listener)
Read the control block for the named AST file.
Decl * GetDecl(serialization::DeclID ID)
Resolve a declaration ID into a declaration, potentially building a new declaration.
A container of type source information.
Base class that describes a preprocessed entity, which may be a preprocessor directive or macro expan...
void makeModuleVisible(Module *Mod, Module::NameVisibilityKind NameVisibility, SourceLocation ImportLoc)
Make the entities in the given module and any of its (non-explicit) submodules visible to name lookup...
void addPendingMacro(IdentifierInfo *II, ModuleFile *M, uint64_t MacroDirectivesOffset)
Add a macro to deserialize its macro directive history.
CXXBaseSpecifier ReadCXXBaseSpecifier(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a C++ base specifier.
The client can handle an AST file that cannot load because it is out-of-date relative to its input fi...
uint32_t IdentifierID
An ID number that refers to an identifier in an AST file.
Manages the set of modules loaded by an AST reader.
void ReadReferencedSelectors(SmallVectorImpl< std::pair< Selector, SourceLocation > > &Sels) override
Read the set of referenced selectors known to the external Sema source.
CXXCtorInitializer ** GetExternalCXXCtorInitializers(uint64_t Offset) override
Read the contents of a CXXCtorInitializer array.
Options for controlling the target.
serialization::TypeID getGlobalTypeID(ModuleFile &F, unsigned LocalID) const
Map a local type ID within a given AST file into a global type ID.
void CompleteRedeclChain(const Decl *D) override
If any redeclarations of D have been imported since it was last checked, this digs out those redeclar...
void dump()
Dump information about the AST reader to standard error.
ModuleManager::ModuleReverseIterator ModuleReverseIterator
void InitializeSema(Sema &S) override
Initialize the semantic source with the Sema instance being used to perform semantic analysis on the ...
TemplateArgument ReadTemplateArgument(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a template argument.
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>". This is safe to be used inside an AST node, in contrast with TemplateArgumentListInfo.
Stores a list of template parameters for a TemplateDecl and its derived classes.
void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override
Receives COUNTER value.
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)
MemoryBufferSizes getMemoryBufferSizes() const
void ReadTentativeDefinitions(SmallVectorImpl< VarDecl * > &TentativeDefs) override
Read the set of tentative definitions known to the external Sema source.
An UnresolvedSet-like class that might not have been loaded from the external AST source yet...
The client can handle an AST file that cannot load because it is missing.
bool ReadDiagnosticOptions(IntrusiveRefCntPtr< DiagnosticOptions > DiagOpts, bool Complain) override
Receives the diagnostic options.
SmallVectorImpl< ModuleFile * >::const_iterator ModuleConstIterator
bool hasGlobalIndex() const
Determine whether this AST reader has a global index.
ModuleIterator begin()
Forward iterator to traverse all loaded modules. This is reverse source-order.
void finalizeForWriting()
Finalizes the AST reader's state before writing an AST file to disk.
T * GetLocalDeclAs(ModuleFile &F, uint32_t LocalID)
Reads a declaration with the given local ID in the given module.
unsigned getTotalNumSubmodules() const
Returns the number of submodules known.
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.
serialization::SelectorID getGlobalSelectorID(ModuleFile &F, unsigned LocalID) const
Retrieve the global selector ID that corresponds to this the local selector ID in a given module...
static SourceLocation getFromRawEncoding(unsigned Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
serialization::ModuleManager ModuleManager
void ReadLateParsedTemplates(llvm::MapVector< const FunctionDecl *, LateParsedTemplate * > &LPTMap) override
Read the set of late parsed template functions for this source.
unsigned ASTFileSignature
Helper class that saves the current stream position and then restores it when destroyed.
void ReadUndefinedButUsed(llvm::DenseMap< NamedDecl *, SourceLocation > &Undefined) override
Load the set of used but not defined functions or variables with internal linkage, or used but not defined internal functions.
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.
clang::CharUnits operator*(clang::CharUnits::QuantityType Scale, const clang::CharUnits &CU)
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.
void ReadExtVectorDecls(SmallVectorImpl< TypedefNameDecl * > &Decls) override
Read the set of ext_vector type declarations known to the external Sema source.
The client can handle an AST file that cannot load because it's compiled configuration doesn't match ...
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Decl * getKeyDeclaration(Decl *D)
Returns the first key declaration for the given declaration. This is one that is formerly-canonical (...
void ReadWeakUndeclaredIdentifiers(SmallVectorImpl< std::pair< IdentifierInfo *, WeakInfo > > &WI) override
Read the set of weak, undeclared identifiers known to the external Sema source.
Describes a module or submodule.
void completeVisibleDeclsMap(const DeclContext *DC) override
Load all external visible decls in the given DeclContext.
static VersionTuple ReadVersionTuple(const RecordData &Record, unsigned &Idx)
Read a version tuple.
llvm::Optional< ASTSourceDescriptor > getSourceDescriptor(unsigned ID) override
Return a descriptor for the corresponding module.
uint32_t SubmoduleID
An ID number that refers to a submodule in a module file.
SourceLocation getLocWithOffset(int Offset) const
Return a source location with the specified offset from this SourceLocation.
PreprocessedEntity * ReadPreprocessedEntity(unsigned Index) override
Read a preallocated preprocessed entity from the external source.
serialization::ModuleKind ModuleKind
TypeSourceInfo * GetTypeSourceInfo(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Reads a declarator info from the given record.
ModuleManager & getModuleManager()
Retrieve the module manager.
void ReadQualifierInfo(ModuleFile &F, QualifierInfo &Info, const RecordData &Record, unsigned &Idx)
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.
uint64_t readCXXBaseSpecifiers(ModuleFile &M, const RecordData &Record, unsigned &Idx)
Read a CXXBaseSpecifiers ID form the given record and return its global bit offset.
std::string ReadPath(ModuleFile &F, const RecordData &Record, unsigned &Idx)
ModuleIterator end()
Forward iterator end-point to traverse all loaded modules.
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, bool Complain, std::string &SuggestedPredefines) override
Receives the preprocessor options.
std::string getOwningModuleNameForDiagnostic(const Decl *D)
Get the best name we know for the module that owns the given declaration, or an empty string if the d...
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)
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
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.
ModuleManager::ModuleIterator ModuleIterator
void ReadPendingInstantiations(SmallVectorImpl< std::pair< ValueDecl *, SourceLocation > > &Pending) override
Read the set of pending instantiations known to the external Sema source.
ContinuousRangeMap< uint32_t, int, 2 > SLocRemap
Remapping table for source locations in this module.
void ReadPragmaDiagnosticMappings(DiagnosticsEngine &Diag)
The AST file itself appears corrupted.
unsigned getTotalNumDecls() const
Returns the number of declarations found in the chain.
void ReadMismatchingDeleteExpressions(llvm::MapVector< FieldDecl *, llvm::SmallVector< std::pair< SourceLocation, bool >, 4 >> &Exprs) override
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
virtual bool needsInputFileVisitation()
Returns true if this ASTReaderListener wants to receive the input files of the AST file via visitInpu...
void ReadDelegatingConstructors(SmallVectorImpl< CXXConstructorDecl * > &Decls) override
Read the set of delegating constructors known to the external Sema source.
static std::string ReadString(const RecordData &Record, unsigned &Idx)
virtual bool ReadFileSystemOptions(const FileSystemOptions &FSOpts, bool Complain)
Receives the file system options.
llvm::OnDiskIterableChainedHashTable< ASTDeclContextNameLookupTrait > ASTDeclContextNameLookupTable
The on-disk hash table used for the DeclContext's Name lookup table.
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.
Stmt * GetExternalDeclStmt(uint64_t Offset) override
Resolve the offset of a statement into a statement.
virtual void visitModuleFile(StringRef Filename)
This is called for each AST file loaded.
ModuleKind
Specifies the kind of module that has been loaded.
Provides lookups to, and iteration over, IdentiferInfo objects.
void SetGloballyVisibleDecls(IdentifierInfo *II, const SmallVectorImpl< uint32_t > &DeclIDs, SmallVectorImpl< Decl * > *Decls=nullptr)
Set the globally-visible declarations associated with the given identifier.
void ReadModuleMapFile(StringRef ModuleMapPath) override
Decl * ReadDecl(ModuleFile &F, const RecordData &R, unsigned &I)
Reads a declaration from the given position in a record in the given module.
static bool isAcceptableASTFile(StringRef Filename, FileManager &FileMgr, const PCHContainerReader &PCHContainerRdr, const LangOptions &LangOpts, const TargetOptions &TargetOpts, const PreprocessorOptions &PPOpts, std::string ExistingModuleCachePath)
Determine whether the given AST file is acceptable to load into a translation unit with the given lan...
ID
Defines the set of possible language-specific address spaces.
void resolvePendingMacro(IdentifierInfo *II, const PendingMacroInfo &PMInfo)
SmallVectorImpl< ModuleFile * >::reverse_iterator ModuleReverseIterator
serialization::PreprocessedEntityID getGlobalPreprocessedEntityID(ModuleFile &M, unsigned LocalID) const
Determine the global preprocessed entity ID that corresponds to the given local ID within the given m...
ASTReaderListener implementation to validate the information of the PCH file against an initialized P...
Abstract interface for external sources of preprocessor information.
HeaderFileInfo GetHeaderFileInfo(const FileEntry *FE) override
Read the header file information for the given file entry.
SwitchCase * getSwitchCaseWithID(unsigned ID)
Retrieve the switch-case statement with the given ID.
serialization::MacroID getGlobalMacroID(ModuleFile &M, unsigned LocalID)
Retrieve the global macro ID corresponding to the given local ID within the given module file...
ExternalLoadResult
Enumeration describing the result of loading information from an external source. ...
DiagnosticBuilder Diag(unsigned DiagID)
Report a diagnostic.
virtual bool visitInputFile(StringRef Filename, bool isSystem, bool isOverridden)
if needsInputFileVisitation returns true, this is called for each non-system input file of the AST Fi...
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.
void ReadUsedVTables(SmallVectorImpl< ExternalVTableUse > &VTables) override
Read the set of used vtables known to the external Sema source.
Implements an efficient mapping from strings to IdentifierInfo nodes.
Defines version macros and version-related utility functions for Clang.
ArgKind
The kind of template argument we're storing.
serialization::DeclID getGlobalDeclID(ModuleFile &F, serialization::LocalDeclID LocalID) const
Map from a local declaration ID within a given module to a global declaration ID. ...
std::pair< SourceLocation, StringRef > getModuleImportLoc(int ID) override
Retrieve the module import location and module name for the given source manager entry ID...
SourceRange ReadSourceRange(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a source range.
Represents a C++ template name within the type system.
QualType getLocalType(ModuleFile &F, unsigned LocalID)
Resolve a local type ID within a given AST file into a type.
Information about a module that has been loaded by the ASTReader.
virtual ~ASTReaderListener()
void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override
Receives COUNTER value.
An iterator that walks over all of the known identifiers in the lookup table.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain, bool AllowCompatibleDifferences) override
Receives the target options.
SavedStreamPosition(llvm::BitstreamCursor &Cursor)
void StartedDeserializing() override
Notify ASTReader that we started deserialization of a decl or type so until FinishedDeserializing is ...
The result type of a method or function.
SmallVector< uint64_t, 16 > PreloadedDeclIDs
void ReadDeclarationNameInfo(ModuleFile &F, DeclarationNameInfo &NameInfo, const RecordData &Record, unsigned &Idx)
The client can't handle any AST loading failures.
The AST file was missing.
An abstract interface that should be implemented by external AST sources that also provide informatio...
NestedNameSpecifier * ReadNestedNameSpecifier(ModuleFile &F, const RecordData &Record, unsigned &Idx)
void addInMemoryBuffer(StringRef FileName, std::unique_ptr< llvm::MemoryBuffer > Buffer)
Add an in-memory buffer the list of known buffers.
Representation::const_iterator const_iterator
void makeNamesVisible(const HiddenNames &Names, Module *Owner)
Make the names within this set of hidden names visible.
The control block was read successfully. Aside from failures, the AST file is safe to read into the c...
bool ReadFullVersionInformation(StringRef FullVersion) override
Receives the full Clang version information.
ExternalLoadResult FindExternalLexicalDecls(const DeclContext *DC, bool(*isKindWeWant)(Decl::Kind), SmallVectorImpl< Decl * > &Decls) override
Read all of the declarations lexically stored in a declaration context.
void addListener(std::unique_ptr< ASTReaderListener > L)
Add an AST callback listener.
bool isGlobalIndexUnavailable() const
Determine whether we tried to load the global index, but failed, e.g., because it is out-of-date or d...
void LoadSelector(Selector Sel)
Load a selector from disk, registering its ID if it exists.
MacroInfo * ReadMacroRecord(ModuleFile &F, uint64_t Offset)
Reads the macro record located at the given offset.
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
Represents a C++ temporary.
void InitializeContext()
Initializes the ASTContext.
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.
void ReadKnownNamespaces(SmallVectorImpl< NamespaceDecl * > &Namespaces) override
Load the set of namespaces that are known to the external source, which will be used during typo corr...
Cached information about one file (either on disk or in the virtual file system). ...
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts, bool Complain, std::string &SuggestedPredefines) override
Receives the preprocessor options.
MacroInfo * getMacro(serialization::MacroID ID)
Retrieve the macro with the given ID.
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...
bool isDeclIDFromModule(serialization::GlobalDeclID ID, ModuleFile &M) const
Returns true if global DeclID ID originated from module M.
void ReadMethodPool(Selector Sel) override
Load the contents of the global method pool for a given selector.
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 addInMemoryBuffer(StringRef &FileName, std::unique_ptr< llvm::MemoryBuffer > Buffer)
Add in-memory (virtual file) buffer.
PCHValidator(Preprocessor &PP, ASTReader &Reader)
uint32_t MacroID
An ID number that refers to a macro in an AST file.
void setListener(std::unique_ptr< ASTReaderListener > Listener)
Set the AST callbacks listener.
External source of source location entries.
virtual void visitImport(StringRef Filename)
If needsImportVisitation returns true, this is called for each AST file imported by this AST file...
A global index for a set of module files, providing information about the identifiers within those mo...
DeclarationName ReadDeclarationName(ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a declaration name.
The AST file was writtten with a different language/target configuration.
void markIdentifierUpToDate(IdentifierInfo *II)
Note that this identifier is up-to-date.
llvm::APFloat ReadAPFloat(const RecordData &Record, const llvm::fltSemantics &Sem, unsigned &Idx)
Read a floating-point value.
unsigned getTotalNumSLocs() const
Returns the number of source locations found in the chain.
ChainedASTReaderListener(std::unique_ptr< ASTReaderListener > First, std::unique_ptr< ASTReaderListener > Second)
Takes ownership of First and Second.
SmallVectorImpl< uint64_t > RecordDataImpl
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Represents a template argument.
Selector getLocalSelector(ModuleFile &M, unsigned LocalID)
Retrieve a selector from the given module with its local ID number.
const ASTTemplateArgumentListInfo * ReadASTTemplateArgumentListInfo(ModuleFile &F, const RecordData &Record, unsigned &Index)
bool ReadSLocEntry(int ID) override
Read the source location entry with index ID.
bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef SpecificModuleCachePath, bool Complain) override
Receives the header search options.
void ResolveImportedPath(ModuleFile &M, std::string &Filename)
If we are loading a relocatable PCH or module file, and the filename is not an absolute path...
void setDeserializationListener(ASTDeserializationListener *Listener, bool TakeOwnership=false)
Set the AST deserialization listener.
unsigned getTotalNumIdentifiers() const
Returns the number of identifiers found in the chain.
void updateOutOfDateIdentifier(IdentifierInfo &II) override
Update an out-of-date identifier.
void ReadDefinedMacros() override
Read the set of macros defined by this external macro source.
bool ReadFileSystemOptions(const FileSystemOptions &FSOpts, bool Complain) override
Receives the file system options.
Reads an AST files chain containing the contents of a translation unit.
Expr * ReadExpr(ModuleFile &F)
Reads an expression.
ListenerScope(ASTReader &Reader, std::unique_ptr< ASTReaderListener > L)
bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain, bool AllowCompatibleDifferences) override
Receives the language options.
ModuleFile & getPrimaryModule()
Returns the primary module associated with the manager, that is, the first module loaded...
void getInputFiles(ModuleFile &F, SmallVectorImpl< serialization::InputFile > &Files)
Return all input files for the given module file.
uint64_t ReadCXXCtorInitializersRef(ModuleFile &M, const RecordData &Record, unsigned &Idx)
Read a CXXCtorInitializers ID from the given record and return its global bit offset.
LoadFailureCapabilities
Flags that indicate what kind of AST loading failures the client of the AST reader can directly handl...
void visitModuleFile(StringRef Filename) override
This is called for each AST file loaded.
virtual void ReadModuleMapFile(StringRef ModuleMapPath)
bool needsInputFileVisitation() override
Returns true if this ASTReaderListener wants to receive the input files of the AST file via visitInpu...
SourceManager & getSourceManager() const
IdentifierTable & getIdentifierTable()
Retrieve the identifier table associated with the preprocessor.
unsigned getTotalNumMacros() const
Returns the number of macros found in the chain.
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.
void ReadDeclarationNameLoc(ModuleFile &F, DeclarationNameLoc &DNLoc, DeclarationName Name, const RecordData &Record, unsigned &Idx)
void ClearSwitchCaseIDs()
unsigned getTotalNumSelectors() const
Returns the number of selectors found in the chain.
Defines the Diagnostic-related interfaces.
Encapsulates the data about a macro definition (e.g. its tokens).
Decl * GetExternalDecl(uint32_t ID) override
Resolve a declaration ID into a declaration, potentially building a new declaration.
void ReadUnresolvedSet(ModuleFile &F, LazyASTUnresolvedSet &Set, const RecordData &Record, unsigned &Idx)
Read a UnresolvedSet structure.
Abstract interface for callback invocations by the ASTReader.
NestedNameSpecifierLoc ReadNestedNameSpecifierLoc(ModuleFile &F, const RecordData &Record, unsigned &Idx)
std::pair< unsigned, unsigned > findPreprocessedEntitiesInRange(SourceRange Range) override
Returns a pair of [Begin, End) indices of preallocated preprocessed entities that Range encompasses...
Defines the clang::FileSystemOptions interface.
Represents a C++ base or member initializer.
virtual bool needsImportVisitation() const
Returns true if this ASTReaderListener wants to receive the imports of the AST file via visitImport...
bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain, bool AllowCompatibleDifferences) override
Receives the language options.
void forEachImportedKeyDecl(const Decl *D, Fn Visit)
Run a callback on each imported key declaration of D.
Selector DecodeSelector(serialization::SelectorID Idx)
Represents a base class of a C++ class.
uint32_t GetNumExternalSelectors() override
Returns the number of selectors known to the external AST source.
void PrintStats() override
Print some statistics about AST usage.
Keeps track of options that affect how file operations are performed.
bool ReadBlockAbbrevs(llvm::BitstreamCursor &Cursor, unsigned BlockID)
QualType GetType(serialization::TypeID ID)
Resolve a type ID into a type, potentially building a new type.
IdentifierInfo * DecodeIdentifierInfo(serialization::IdentifierID ID)
virtual bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts, StringRef SpecificModuleCachePath, bool Complain)
Receives the header search options.
serialization::ModuleFile ModuleFile
unsigned getTotalNumPreprocessedEntities() const
Returns the number of preprocessed entities known to the AST reader.
uint32_t PreprocessedEntityID
An ID number that refers to an entity in the detailed preprocessing record.
void FindFileRegionDecls(FileID File, unsigned Offset, unsigned Length, SmallVectorImpl< Decl * > &Decls) override
Get the decls that are contained in a file in the Offset/Length range. Length can be 0 to indicate a ...
FileManager & getFileManager() const
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.
Selector GetExternalSelector(serialization::SelectorID ID) override
Resolve a selector ID into a selector.
uint32_t SelectorID
An ID number that refers to an ObjC selector in an AST file.
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...
bool needsSystemInputFileVisitation() override
Returns true if this ASTReaderListener wants to receive the system input files of the AST file via vi...
void ReadTemplateArgumentList(SmallVectorImpl< TemplateArgument > &TemplArgs, ModuleFile &F, const RecordData &Record, unsigned &Idx)
Read a template argument array.
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
Location information for a TemplateArgument.
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)
bool ReadDiagnosticOptions(IntrusiveRefCntPtr< DiagnosticOptions > DiagOpts, bool Complain) override
Receives the diagnostic options.
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.
Kind
Lists the kind of concrete classes of Decl.
void ReadAttributes(ModuleFile &F, AttrVec &Attrs, const RecordData &Record, unsigned &Idx)
Reads attributes from the current stream position.
SourceLocation getSourceLocationForDeclID(serialization::GlobalDeclID ID)
Returns the source location for the decl ID.
The AST file was written by a different version of Clang.
std::unique_ptr< ASTReaderListener > takeSecond()
ModuleFile * getOwningModuleFile(const Decl *D)
Retrieve the module file that owns the given declaration, or NULL if the declaration is not from a mo...
void StartTranslationUnit(ASTConsumer *Consumer) override
Function that will be invoked when we begin parsing a new translation unit involving this external AS...
const std::string & getSuggestedPredefines()
Returns the suggested contents of the predefines buffer, which contains a (typically-empty) subset of...
SmallVectorImpl< ModuleFile * >::iterator ModuleIterator
uint32_t TypeID
An ID number that refers to a type in an AST file.
A trivial tuple used to represent a source range.
void UpdateSema()
Update the state of Sema after loading some additional modules.
serialization::DeclID mapGlobalIDToModuleFileGlobalID(ModuleFile &M, serialization::DeclID GlobalID)
Map a global declaration ID into the declaration ID used to refer to this declaration within the give...
void ReadUnusedFileScopedDecls(SmallVectorImpl< const DeclaratorDecl * > &Decls) override
Read the set of unused file-scope declarations known to the external Sema source. ...
void FinishedDeserializing() override
Notify ASTReader that we finished the deserialization of a decl or type. Must be paired with StartedD...
std::unique_ptr< ASTReaderListener > takeFirst()
void ReadModuleName(StringRef ModuleName) override
This class handles loading and caching of source files into memory.
bool loadGlobalIndex()
Attempts to load the global index.
Module * getModule(unsigned ID) override
Retrieve the module that corresponds to the given module ID.
void ReadUnusedLocalTypedefNameCandidates(llvm::SmallSetVector< const TypedefNameDecl *, 4 > &Decls) override
Read the set of potentially unused typedefs known to the source.
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.
serialization::IdentifierID getGlobalIdentifierID(ModuleFile &M, unsigned LocalID)