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>
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 <x> 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; }

View File

@ -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;

View File

@ -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);

View File

@ -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;