]> granicus.if.org Git - clang/commitdiff
Frontend/VerifyDiagnosticConsumer.cpp: Fix an expression that had side-effect.
authorNAKAMURA Takumi <geek4civic@gmail.com>
Sat, 17 Dec 2011 13:00:31 +0000 (13:00 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Sat, 17 Dec 2011 13:00:31 +0000 (13:00 +0000)
It had been causing test "Misc/diag-verify.cpp" failure on ms cl.exe. The emission was ordered unexpectedly as below;

First)  error: 'error' diagnostics seen but not expected:
Second) error: 'error' diagnostics expected but not seen:

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146830 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/VerifyDiagnosticConsumer.cpp

index 96c990c54f25a04b52df7e6512c0dc07e94d6bfb..88e36ade5796dcdf143393f8cb53fe5dfa4f1f47 100644 (file)
@@ -459,10 +459,10 @@ static unsigned CheckLists(DiagnosticsEngine &Diags, SourceManager &SourceMgr,
     }
   }
   // Now all that's left in Right are those that were not matched.
-
-  return (PrintProblem(Diags, &SourceMgr, LeftOnly, Label, true) +
-          PrintProblem(Diags, &SourceMgr, Right.begin(), Right.end(),
-                       Label, false));
+  unsigned num = PrintProblem(Diags, &SourceMgr, LeftOnly, Label, true);
+  num += PrintProblem(Diags, &SourceMgr, Right.begin(), Right.end(),
+                      Label, false);
+  return num;
 }
 
 /// CheckResults - This compares the expected results to those that