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

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181083 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/StaticAnalyzer/Core/BugReporter.cpp b/lib/StaticAnalyzer/Core/BugReporter.cpp
index 4606b21..1df4970 100644
--- a/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ b/lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -1595,6 +1595,12 @@
           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 @@
           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 @@
                                               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 @@
       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);
       }
     }