[cfe-commits] r120769 - /cfe/trunk/lib/Checker/BugReporter.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Thu Dec 2 16:58:11 PST 2010


Author: akirtzidis
Date: Thu Dec  2 18:58:10 2010
New Revision: 120769

URL: http://llvm.org/viewvc/llvm-project?rev=120769&view=rev
Log:
Handle any number of SourceRanges inside BugReporter::FlushReport.

Modified:
    cfe/trunk/lib/Checker/BugReporter.cpp

Modified: cfe/trunk/lib/Checker/BugReporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/BugReporter.cpp?rev=120769&r1=120768&r2=120769&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/BugReporter.cpp (original)
+++ cfe/trunk/lib/Checker/BugReporter.cpp Thu Dec  2 18:58:10 2010
@@ -1850,12 +1850,10 @@
     ErrorDiag = Diag.getCustomDiagID(Diagnostic::Warning, TmpStr);
   }        
 
-  switch (End-Beg) {
-    default: assert(0 && "Don't handle this many ranges yet!");
-    case 0: Diag.Report(L, ErrorDiag); break;
-    case 1: Diag.Report(L, ErrorDiag) << Beg[0]; break;
-    case 2: Diag.Report(L, ErrorDiag) << Beg[0] << Beg[1]; break;
-    case 3: Diag.Report(L, ErrorDiag) << Beg[0] << Beg[1] << Beg[2]; break;
+  {
+    DiagnosticBuilder diagBuilder = Diag.Report(L, ErrorDiag);
+    for (const SourceRange *I = Beg; I != End; ++I)
+      diagBuilder << *I;
   }
 
   // Emit a full diagnostic for the path if we have a PathDiagnosticClient.





More information about the cfe-commits mailing list