r181083 - [analyzer; alternate edges] - add in events (loop iterations, etc)

Ted Kremenek kremenek at apple.com
Fri May 3 18:12:55 PDT 2013


Author: kremenek
Date: Fri May  3 20:12:55 2013
New Revision: 181083

URL: http://llvm.org/viewvc/llvm-project?rev=181083&view=rev
Log:
[analyzer;alternate edges] - add in events (loop iterations, etc)

These were being dropped due a transcription mistake from the original
algorithm.

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=181083&r1=181082&r2=181083&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp Fri May  3 20:12:55 2013
@@ -1595,6 +1595,12 @@ GenerateAlternateExtensivePathDiagnostic
           reversePropagateIntererstingSymbols(*PDB.getBugReport(), IE,
                                               N->getState().getPtr(), Ex,
                                               N->getLocationContext());
+
+        PathDiagnosticLocation L =
+         cleanUpLocation(PathDiagnosticLocation::createBegin(PS->getStmt(), SM,
+                                                             LC), LC);
+
+        addEdgeToPath(PD.getActivePath(), PrevLoc, L, LC);
         break;
       }
 
@@ -1686,6 +1692,7 @@ GenerateAlternateExtensivePathDiagnostic
           p->setPrunable(true);
 
           addEdgeToPath(PD.getActivePath(), PrevLoc, p->getLocation(), LC);
+          PD.getActivePath().push_front(p);
 
           if (CS) {
             addEdgeToPath(PD.getActivePath(), PrevLoc,
@@ -1706,12 +1713,13 @@ GenerateAlternateExtensivePathDiagnostic
                                               N),
                             Term))
           {
-              PathDiagnosticLocation L(Term, SM, PDB.LC);
-              PathDiagnosticEventPiece *PE =
+            PathDiagnosticLocation L(Term, SM, PDB.LC);
+            PathDiagnosticEventPiece *PE =
               new PathDiagnosticEventPiece(L, "Loop body executed 0 times");
-              PE->setPrunable(true);
-              addEdgeToPath(PD.getActivePath(), PrevLoc,
-                            PE->getLocation(), LC);
+            PE->setPrunable(true);
+            addEdgeToPath(PD.getActivePath(), PrevLoc,
+                          PE->getLocation(), LC);
+            PD.getActivePath().push_front(PE);
           }
         }
         break;
@@ -1722,12 +1730,12 @@ GenerateAlternateExtensivePathDiagnostic
       continue;
 
     // Add pieces from custom visitors.
-    BugReport *R = PDB.getBugReport();
     for (ArrayRef<BugReporterVisitor *>::iterator I = visitors.begin(),
          E = visitors.end();
          I != E; ++I) {
-      if (PathDiagnosticPiece *p = (*I)->VisitNode(N, NextNode, PDB, *R)) {
+      if (PathDiagnosticPiece *p = (*I)->VisitNode(N, NextNode, PDB, *report)) {
         addEdgeToPath(PD.getActivePath(), PrevLoc, p->getLocation(), LC);
+        PD.getActivePath().push_front(p);
         updateStackPiecesWithMessage(p, CallStack);
       }
     }





More information about the cfe-commits mailing list