Only increment the number of diagnostics when the DiagnosticClient used
is the one attached to the Diagnostic object.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49677 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp
index 867b3db..77984d6 100644
--- a/lib/Basic/Diagnostic.cpp
+++ b/lib/Basic/Diagnostic.cpp
@@ -221,7 +221,9 @@
   
   if (DiagLevel >= Diagnostic::Error) {
     ErrorOccurred = true;
-    ++NumErrors;
+    
+    if (C == &Client)
+      ++NumErrors;
   }
 
   // Finally, report it.
@@ -230,7 +232,9 @@
   
   C->HandleDiagnostic(*this, DiagLevel, Pos, (diag::kind)DiagID,
                       Strs, NumStrs, Ranges, NumRanges);
-  ++NumDiagnostics;
+  
+  if (C == &Client)
+    ++NumDiagnostics;
 }
 
 DiagnosticClient::~DiagnosticClient() {}