r177214 - [analyzer] Don't repeat a bug equivalence class if every report is invalid.

Jordan Rose jordan_rose at apple.com
Fri Mar 15 18:07:47 PDT 2013


Author: jrose
Date: Fri Mar 15 20:07:47 2013
New Revision: 177214

URL: http://llvm.org/viewvc/llvm-project?rev=177214&view=rev
Log:
[analyzer] Don't repeat a bug equivalence class if every report is invalid.

I removed this check in the recursion->iteration commit, but forgot that
generatePathDiagnostic may be called multiple times if there are multiple
PathDiagnosticConsumers.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=177214&r1=177213&r2=177214&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp Fri Mar 15 20:07:47 2013
@@ -2114,13 +2114,23 @@ bool GRBugReporter::generatePathDiagnost
                                            ArrayRef<BugReport *> &bugReports) {
   assert(!bugReports.empty());
 
+  bool HasValid = false;
   SmallVector<const ExplodedNode *, 32> errorNodes;
   for (ArrayRef<BugReport*>::iterator I = bugReports.begin(),
-                                      E = bugReports.end();
-       I != E; ++I) {
-    errorNodes.push_back((*I)->getErrorNode());
+                                      E = bugReports.end(); I != E; ++I) {
+    if ((*I)->isValid()) {
+      HasValid = true;
+      errorNodes.push_back((*I)->getErrorNode());
+    } else {
+      errorNodes.push_back(0);
+    }
   }
 
+  // If all the reports have been marked invalid by a previous path generation,
+  // we're done.
+  if (!HasValid)
+    return false;
+
   typedef PathDiagnosticConsumer::PathGenerationScheme PathGenerationScheme;
   PathGenerationScheme ActiveScheme = PC.getGenerationScheme();
 





More information about the cfe-commits mailing list