Added variation of the "Report" method in the class Diagnostic that takes
an optional DiagnosticClient argument that differs from the client stored
internally in the Diagnostic object.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48986 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp
index f62b8f1..867b3db 100644
--- a/lib/Basic/Diagnostic.cpp
+++ b/lib/Basic/Diagnostic.cpp
@@ -198,7 +198,8 @@
 /// Report - Issue the message to the client. If the client wants us to stop
 /// compilation, return true, otherwise return false.  DiagID is a member of
 /// the diag::kind enum.  
-void Diagnostic::Report(FullSourceLoc Pos, unsigned DiagID,
+void Diagnostic::Report(DiagnosticClient* C,
+                        FullSourceLoc Pos, unsigned DiagID,
                         const std::string *Strs, unsigned NumStrs,
                         const SourceRange *Ranges, unsigned NumRanges) {
   
@@ -224,8 +225,11 @@
   }
 
   // Finally, report it.
-  Client.HandleDiagnostic(*this, DiagLevel, Pos, (diag::kind)DiagID,
-                          Strs, NumStrs, Ranges, NumRanges);
+  
+  if (!C) C = &Client;
+  
+  C->HandleDiagnostic(*this, DiagLevel, Pos, (diag::kind)DiagID,
+                      Strs, NumStrs, Ranges, NumRanges);
   ++NumDiagnostics;
 }