* Remove isInSystemHeader() from DiagClient, move it to SourceManager
* Move FormatError() from TextDiagnostic up to DiagClient, remove now  
  empty class TextDiagnostic
* Make DiagClient optional for Diagnostic

This fixes the following problems:

* -html-diags (and probably others) does now output the same set of  
  warnings as console clang does
* nothing crashes if one forgets to call setHeaderSearch() on  
  TextDiagnostic
* some code duplication is removed




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54620 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/DiagChecker.cpp b/Driver/DiagChecker.cpp
index e11d2f0..660d17a 100644
--- a/Driver/DiagChecker.cpp
+++ b/Driver/DiagChecker.cpp
@@ -183,8 +183,11 @@
 static bool CheckResults(Preprocessor &PP,
                          const DiagList &ExpectedErrors,
                          const DiagList &ExpectedWarnings) {
+  const DiagnosticClient *DiagClient = PP.getDiagnostics().getClient();
+  assert(DiagClient != 0 &&
+      "DiagChecker requires a valid TextDiagnosticBuffer");
   const TextDiagnosticBuffer &Diags =
-    static_cast<const TextDiagnosticBuffer&>(PP.getDiagnostics().getClient());
+    static_cast<const TextDiagnosticBuffer&>(*DiagClient);
   SourceManager &SourceMgr = PP.getSourceManager();
 
   // We want to capture the delta between what was expected and what was