I predict that HeaderSearch will need the ability to generate

diagnostics in the future. Make it so.

llvm-svn: 144347
This commit is contained in:
Douglas Gregor 2011-11-11 00:35:06 +00:00
parent f311655e3f
commit 197ac203af
4 changed files with 11 additions and 6 deletions

View File

@ -21,7 +21,8 @@
#include <vector> #include <vector>
namespace clang { namespace clang {
class DiagnosticsEngine;
class ExternalIdentifierLookup; class ExternalIdentifierLookup;
class FileEntry; class FileEntry;
class FileManager; class FileManager;
@ -118,6 +119,7 @@ public:
/// file referenced by a #include or #include_next, (sub-)framework lookup, etc. /// file referenced by a #include or #include_next, (sub-)framework lookup, etc.
class HeaderSearch { class HeaderSearch {
FileManager &FileMgr; FileManager &FileMgr;
DiagnosticsEngine &Diags;
/// #include search path information. Requests for #include "x" search the /// #include search path information. Requests for #include "x" search the
/// directory of the #including file first, then each directory in SearchDirs /// directory of the #including file first, then each directory in SearchDirs
/// consecutively. Requests for <x> search the current dir first, then each /// consecutively. Requests for <x> search the current dir first, then each
@ -180,7 +182,7 @@ class HeaderSearch {
explicit HeaderSearch(const HeaderSearch&); explicit HeaderSearch(const HeaderSearch&);
void operator=(const HeaderSearch&); void operator=(const HeaderSearch&);
public: public:
HeaderSearch(FileManager &FM); HeaderSearch(FileManager &FM, DiagnosticsEngine &Diags);
~HeaderSearch(); ~HeaderSearch();
FileManager &getFileMgr() const { return FileMgr; } FileManager &getFileMgr() const { return FileMgr; }

View File

@ -664,7 +664,8 @@ ASTUnit *ASTUnit::LoadFromASTFile(const std::string &Filename,
AST->FileMgr = new FileManager(FileSystemOpts); AST->FileMgr = new FileManager(FileSystemOpts);
AST->SourceMgr = new SourceManager(AST->getDiagnostics(), AST->SourceMgr = new SourceManager(AST->getDiagnostics(),
AST->getFileManager()); 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) { for (unsigned I = 0; I != NumRemappedFiles; ++I) {
FilenameOrMemBuf fileOrBuf = RemappedFiles[I].second; FilenameOrMemBuf fileOrBuf = RemappedFiles[I].second;

View File

@ -250,7 +250,8 @@ void CompilerInstance::createPreprocessor() {
PTHMgr = PTHManager::Create(PPOpts.TokenCache, getDiagnostics()); PTHMgr = PTHManager::Create(PPOpts.TokenCache, getDiagnostics());
// Create the Preprocessor. // Create the Preprocessor.
HeaderSearch *HeaderInfo = new HeaderSearch(getFileManager()); HeaderSearch *HeaderInfo = new HeaderSearch(getFileManager(),
getDiagnostics());
PP = new Preprocessor(getDiagnostics(), getLangOpts(), &getTarget(), PP = new Preprocessor(getDiagnostics(), getLangOpts(), &getTarget(),
getSourceManager(), *HeaderInfo, *this, PTHMgr, getSourceManager(), *HeaderInfo, *this, PTHMgr,
/*OwnsHeaderSearch=*/true); /*OwnsHeaderSearch=*/true);

View File

@ -36,8 +36,9 @@ HeaderFileInfo::getControllingMacro(ExternalIdentifierLookup *External) {
ExternalHeaderFileInfoSource::~ExternalHeaderFileInfoSource() {} ExternalHeaderFileInfoSource::~ExternalHeaderFileInfoSource() {}
HeaderSearch::HeaderSearch(FileManager &FM) HeaderSearch::HeaderSearch(FileManager &FM, DiagnosticsEngine &Diags)
: FileMgr(FM), FrameworkMap(64) { : FileMgr(FM), Diags(Diags), FrameworkMap(64)
{
AngledDirIdx = 0; AngledDirIdx = 0;
SystemDirIdx = 0; SystemDirIdx = 0;
NoCurDirSearch = false; NoCurDirSearch = false;