]> granicus.if.org Git - clang/commitdiff
Handle any number of SourceRanges inside BugReporter::FlushReport.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 3 Dec 2010 00:58:10 +0000 (00:58 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 3 Dec 2010 00:58:10 +0000 (00:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120769 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Checker/BugReporter.cpp

index 3fc62f3fbd16029d68e475f9c42ce8def15a0915..0ef99ad09a8384d2d699fb6bd3166db6b07dadec 100644 (file)
@@ -1850,12 +1850,10 @@ void BugReporter::FlushReport(BugReportEquivClass& EQ) {
     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.