[cfe-commits] r144347 - in /cfe/trunk: include/clang/Lex/HeaderSearch.h lib/Frontend/ASTUnit.cpp lib/Frontend/CompilerInstance.cpp lib/Lex/HeaderSearch.cpp

Douglas Gregor dgregor at apple.com
Thu Nov 10 16:35:06 PST 2011


Author: dgregor
Date: Thu Nov 10 18:35:06 2011
New Revision: 144347

URL: http://llvm.org/viewvc/llvm-project?rev=144347&view=rev
Log:
I predict that HeaderSearch will need the ability to generate
diagnostics in the future. Make it so.

Modified:
    cfe/trunk/include/clang/Lex/HeaderSearch.h
    cfe/trunk/lib/Frontend/ASTUnit.cpp
    cfe/trunk/lib/Frontend/CompilerInstance.cpp
    cfe/trunk/lib/Lex/HeaderSearch.cpp

Modified: cfe/trunk/include/clang/Lex/HeaderSearch.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearch.h?rev=144347&r1=144346&r2=144347&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/HeaderSearch.h (original)
+++ cfe/trunk/include/clang/Lex/HeaderSearch.h Thu Nov 10 18:35:06 2011
@@ -21,7 +21,8 @@
 #include <vector>
 
 namespace clang {
-
+  
+class DiagnosticsEngine;  
 class ExternalIdentifierLookup;
 class FileEntry;
 class FileManager;
@@ -118,6 +119,7 @@
 /// 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 @@
   explicit HeaderSearch(const HeaderSearch&);
   void operator=(const HeaderSearch&);
 public:
-  HeaderSearch(FileManager &FM);
+  HeaderSearch(FileManager &FM, DiagnosticsEngine &Diags);
   ~HeaderSearch();
 
   FileManager &getFileMgr() const { return FileMgr; }

Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=144347&r1=144346&r2=144347&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Thu Nov 10 18:35:06 2011
@@ -664,7 +664,8 @@
   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;

Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=144347&r1=144346&r2=144347&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Thu Nov 10 18:35:06 2011
@@ -250,7 +250,8 @@
     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);

Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=144347&r1=144346&r2=144347&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderSearch.cpp Thu Nov 10 18:35:06 2011
@@ -36,8 +36,9 @@
 
 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;





More information about the cfe-commits mailing list