Change ASTUnit to take the Diagnostic as an argument, the client should have control of this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82430 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp
index 55bcd93..de50b80 100644
--- a/tools/CIndex/CIndex.cpp
+++ b/tools/CIndex/CIndex.cpp
@@ -206,7 +206,8 @@
   std::string astName(ast_filename);
   std::string ErrMsg;
   
-  return ASTUnit::LoadFromPCHFile(astName, CXXIdx->getFileManager(), &ErrMsg);
+  return ASTUnit::LoadFromPCHFile(astName, CXXIdx->getDiagnostics(),
+                                  CXXIdx->getFileManager(), &ErrMsg);
 }
 
 void clang_disposeTranslationUnit(
diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp
index 89ca5db..6c2f1d6 100644
--- a/tools/clang-cc/clang-cc.cpp
+++ b/tools/clang-cc/clang-cc.cpp
@@ -2161,7 +2161,7 @@
   // FIXME: This is manufactoring its own diags and source manager, we should
   // reuse ours.
   std::string Error;
-  llvm::OwningPtr<ASTUnit> AST(ASTUnit::LoadFromPCHFile(InFile, FileMgr,
+  llvm::OwningPtr<ASTUnit> AST(ASTUnit::LoadFromPCHFile(InFile, Diags, FileMgr,
                                                         &Error));
   if (!AST) {
     Diags.Report(FullSourceLoc(), diag::err_fe_invalid_ast_file) << Error;
diff --git a/tools/index-test/index-test.cpp b/tools/index-test/index-test.cpp
index a0546bf..decc921 100644
--- a/tools/index-test/index-test.cpp
+++ b/tools/index-test/index-test.cpp
@@ -225,8 +225,8 @@
     std::string ErrMsg;
     llvm::OwningPtr<ASTUnit> AST;
 
-    AST.reset(ASTUnit::LoadFromPCHFile(InFile, Idxer.getFileManager(),
-                                       &ErrMsg));
+    AST.reset(ASTUnit::LoadFromPCHFile(InFile, Idxer.getDiagnostics(),
+                                       Idxer.getFileManager(), &ErrMsg));
     if (!AST) {
       llvm::errs() << "[" << InFile << "] Error: " << ErrMsg << '\n';
       return 1;
diff --git a/tools/wpa/clang-wpa.cpp b/tools/wpa/clang-wpa.cpp
index 2cdc1c6..fa2326d 100644
--- a/tools/wpa/clang-wpa.cpp
+++ b/tools/wpa/clang-wpa.cpp
@@ -15,6 +15,8 @@
 #include "clang/Analysis/CallGraph.h"
 
 #include "clang/Basic/FileManager.h"
+#include "clang/Basic/SourceManager.h"
+#include "clang/Frontend/TextDiagnosticBuffer.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/raw_ostream.h"
 using namespace clang;
@@ -31,13 +33,16 @@
   if (InputFilenames.empty())
     return 0;
 
+  TextDiagnosticBuffer DiagClient;
+  Diagnostic Diags(&DiagClient);
+
   for (unsigned i = 0, e = InputFilenames.size(); i != e; ++i) {
     const std::string &InFile = InputFilenames[i];
 
     std::string ErrMsg;
     llvm::OwningPtr<ASTUnit> AST;
 
-    AST.reset(ASTUnit::LoadFromPCHFile(InFile, FileMgr, &ErrMsg));
+    AST.reset(ASTUnit::LoadFromPCHFile(InFile, Diags, FileMgr, &ErrMsg));
 
     if (!AST) {
       llvm::errs() << "[" << InFile << "] error: " << ErrMsg << '\n';