forked from OSchip/llvm-project
[PCH] Remove the ASTReaderListener::ReadHeaderFileInfo callback.
This made sense in pre-module era, before merging of HeaderFileInfos was introduced. Final part of rdar://13840148. llvm-svn: 181490
This commit is contained in:
parent
6f722b4eb9
commit
1054bbf08d
|
@ -519,9 +519,6 @@ public:
|
|||
|
||||
unsigned header_file_size() const { return FileInfo.size(); }
|
||||
|
||||
// Used by ASTReader.
|
||||
void setHeaderFileInfoForUID(HeaderFileInfo HFI, unsigned UID);
|
||||
|
||||
/// \brief Return the HeaderFileInfo structure for the specified FileEntry.
|
||||
const HeaderFileInfo &getFileInfo(const FileEntry *FE) const {
|
||||
return const_cast<HeaderSearch*>(this)->getFileInfo(FE);
|
||||
|
|
|
@ -166,9 +166,6 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
/// \brief Receives a HeaderFileInfo entry.
|
||||
virtual void ReadHeaderFileInfo(const HeaderFileInfo &HFI, unsigned ID) {}
|
||||
|
||||
/// \brief Receives __COUNTER__ value.
|
||||
virtual void ReadCounter(const serialization::ModuleFile &M,
|
||||
unsigned Value) {}
|
||||
|
@ -190,11 +187,9 @@ class PCHValidator : public ASTReaderListener {
|
|||
Preprocessor &PP;
|
||||
ASTReader &Reader;
|
||||
|
||||
unsigned NumHeaderInfos;
|
||||
|
||||
public:
|
||||
PCHValidator(Preprocessor &PP, ASTReader &Reader)
|
||||
: PP(PP), Reader(Reader), NumHeaderInfos(0) {}
|
||||
: PP(PP), Reader(Reader) {}
|
||||
|
||||
virtual bool ReadLanguageOptions(const LangOptions &LangOpts,
|
||||
bool Complain);
|
||||
|
@ -203,7 +198,6 @@ public:
|
|||
virtual bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts,
|
||||
bool Complain,
|
||||
std::string &SuggestedPredefines);
|
||||
virtual void ReadHeaderFileInfo(const HeaderFileInfo &HFI, unsigned ID);
|
||||
virtual void ReadCounter(const serialization::ModuleFile &M, unsigned Value);
|
||||
|
||||
private:
|
||||
|
|
|
@ -509,23 +509,19 @@ class ASTInfoCollector : public ASTReaderListener {
|
|||
Preprocessor &PP;
|
||||
ASTContext &Context;
|
||||
LangOptions &LangOpt;
|
||||
HeaderSearch &HSI;
|
||||
IntrusiveRefCntPtr<TargetOptions> &TargetOpts;
|
||||
IntrusiveRefCntPtr<TargetInfo> &Target;
|
||||
unsigned &Counter;
|
||||
|
||||
unsigned NumHeaderInfos;
|
||||
|
||||
bool InitializedLanguage;
|
||||
public:
|
||||
ASTInfoCollector(Preprocessor &PP, ASTContext &Context, LangOptions &LangOpt,
|
||||
HeaderSearch &HSI,
|
||||
IntrusiveRefCntPtr<TargetOptions> &TargetOpts,
|
||||
IntrusiveRefCntPtr<TargetInfo> &Target,
|
||||
unsigned &Counter)
|
||||
: PP(PP), Context(Context), LangOpt(LangOpt), HSI(HSI),
|
||||
: PP(PP), Context(Context), LangOpt(LangOpt),
|
||||
TargetOpts(TargetOpts), Target(Target),
|
||||
Counter(Counter), NumHeaderInfos(0),
|
||||
Counter(Counter),
|
||||
InitializedLanguage(false) {}
|
||||
|
||||
virtual bool ReadLanguageOptions(const LangOptions &LangOpts,
|
||||
|
@ -554,10 +550,6 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
virtual void ReadHeaderFileInfo(const HeaderFileInfo &HFI, unsigned ID) {
|
||||
HSI.setHeaderFileInfoForUID(HFI, NumHeaderInfos++);
|
||||
}
|
||||
|
||||
virtual void ReadCounter(const serialization::ModuleFile &M, unsigned Value) {
|
||||
Counter = Value;
|
||||
}
|
||||
|
@ -798,7 +790,7 @@ ASTUnit *ASTUnit::LoadFromASTFile(const std::string &Filename,
|
|||
ReaderCleanup(Reader.get());
|
||||
|
||||
Reader->setListener(new ASTInfoCollector(*AST->PP, Context,
|
||||
AST->ASTFileLangOpts, HeaderInfo,
|
||||
AST->ASTFileLangOpts,
|
||||
AST->TargetOpts, AST->Target,
|
||||
Counter));
|
||||
|
||||
|
|
|
@ -876,13 +876,6 @@ void HeaderSearch::MarkFileModuleHeader(const FileEntry *FE,
|
|||
HFI.isCompilingModuleHeader = isCompilingModuleHeader;
|
||||
}
|
||||
|
||||
void HeaderSearch::setHeaderFileInfoForUID(HeaderFileInfo HFI, unsigned UID) {
|
||||
if (UID >= FileInfo.size())
|
||||
FileInfo.resize(UID+1);
|
||||
HFI.Resolved = true;
|
||||
FileInfo[UID] = HFI;
|
||||
}
|
||||
|
||||
bool HeaderSearch::ShouldEnterIncludeFile(const FileEntry *File, bool isImport){
|
||||
++NumIncluded; // Count # of attempted #includes.
|
||||
|
||||
|
|
|
@ -377,12 +377,6 @@ bool PCHValidator::ReadPreprocessorOptions(const PreprocessorOptions &PPOpts,
|
|||
PP.getLangOpts());
|
||||
}
|
||||
|
||||
void PCHValidator::ReadHeaderFileInfo(const HeaderFileInfo &HFI,
|
||||
unsigned ID) {
|
||||
PP.getHeaderSearchInfo().setHeaderFileInfoForUID(HFI, ID);
|
||||
++NumHeaderInfos;
|
||||
}
|
||||
|
||||
void PCHValidator::ReadCounter(const ModuleFile &M, unsigned Value) {
|
||||
PP.setCounterValue(Value);
|
||||
}
|
||||
|
@ -4394,11 +4388,8 @@ namespace {
|
|||
HeaderFileInfo ASTReader::GetHeaderFileInfo(const FileEntry *FE) {
|
||||
HeaderFileInfoVisitor Visitor(FE);
|
||||
ModuleMgr.visit(&HeaderFileInfoVisitor::visit, &Visitor);
|
||||
if (Optional<HeaderFileInfo> HFI = Visitor.getHeaderFileInfo()) {
|
||||
if (Listener)
|
||||
Listener->ReadHeaderFileInfo(*HFI, FE->getUID());
|
||||
if (Optional<HeaderFileInfo> HFI = Visitor.getHeaderFileInfo())
|
||||
return *HFI;
|
||||
}
|
||||
|
||||
return HeaderFileInfo();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue