diff --git a/clang/include/clang/Lex/HeaderSearch.h b/clang/include/clang/Lex/HeaderSearch.h index 84d59f793bbb..0b2137385802 100644 --- a/clang/include/clang/Lex/HeaderSearch.h +++ b/clang/include/clang/Lex/HeaderSearch.h @@ -21,7 +21,8 @@ #include namespace clang { - + +class DiagnosticsEngine; class ExternalIdentifierLookup; class FileEntry; class FileManager; @@ -118,6 +119,7 @@ public: /// file referenced by a #include or #include_next, (sub-)framework lookup, etc. class HeaderSearch { FileManager &FileMgr; + DiagnosticsEngine &Diags; /// #include search path information. Requests for #include "x" search the /// directory of the #including file first, then each directory in SearchDirs /// consecutively. Requests for search the current dir first, then each @@ -180,7 +182,7 @@ class HeaderSearch { explicit HeaderSearch(const HeaderSearch&); void operator=(const HeaderSearch&); public: - HeaderSearch(FileManager &FM); + HeaderSearch(FileManager &FM, DiagnosticsEngine &Diags); ~HeaderSearch(); FileManager &getFileMgr() const { return FileMgr; } diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index 2496f72bea9b..0b9c37a22372 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -664,7 +664,8 @@ ASTUnit *ASTUnit::LoadFromASTFile(const std::string &Filename, AST->FileMgr = new FileManager(FileSystemOpts); AST->SourceMgr = new SourceManager(AST->getDiagnostics(), AST->getFileManager()); - AST->HeaderInfo.reset(new HeaderSearch(AST->getFileManager())); + AST->HeaderInfo.reset(new HeaderSearch(AST->getFileManager(), + AST->getDiagnostics())); for (unsigned I = 0; I != NumRemappedFiles; ++I) { FilenameOrMemBuf fileOrBuf = RemappedFiles[I].second; diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index f4d0a15f2393..0e3b25168f06 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -250,7 +250,8 @@ void CompilerInstance::createPreprocessor() { PTHMgr = PTHManager::Create(PPOpts.TokenCache, getDiagnostics()); // Create the Preprocessor. - HeaderSearch *HeaderInfo = new HeaderSearch(getFileManager()); + HeaderSearch *HeaderInfo = new HeaderSearch(getFileManager(), + getDiagnostics()); PP = new Preprocessor(getDiagnostics(), getLangOpts(), &getTarget(), getSourceManager(), *HeaderInfo, *this, PTHMgr, /*OwnsHeaderSearch=*/true); diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp index 931145a8d655..837b913d4751 100644 --- a/clang/lib/Lex/HeaderSearch.cpp +++ b/clang/lib/Lex/HeaderSearch.cpp @@ -36,8 +36,9 @@ HeaderFileInfo::getControllingMacro(ExternalIdentifierLookup *External) { ExternalHeaderFileInfoSource::~ExternalHeaderFileInfoSource() {} -HeaderSearch::HeaderSearch(FileManager &FM) - : FileMgr(FM), FrameworkMap(64) { +HeaderSearch::HeaderSearch(FileManager &FM, DiagnosticsEngine &Diags) + : FileMgr(FM), Diags(Diags), FrameworkMap(64) +{ AngledDirIdx = 0; SystemDirIdx = 0; NoCurDirSearch = false;