retain/release checker: Record the summary used to generate a given node.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64876 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index 81faf21..8fea99b 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -1284,6 +1284,7 @@
 
 private:
   RetainSummaryManager Summaries;  
+  llvm::DenseMap<const GRExprEngine::NodeTy*, const RetainSummary*> SummaryLog;
   const LangOptions&   LOpts;
 
   BugType *useAfterRelease, *releaseNotOwned;
@@ -1655,11 +1656,15 @@
     }
   }
   
-  // Is this a sink?
-  if (IsEndPath(Summ))
-    Builder.MakeSinkNode(Dst, Ex, Pred, state);
-  else
-    Builder.MakeNode(Dst, Ex, Pred, state);
+  // Generate a sink node if we are at the end of a path.
+  GRExprEngine::NodeTy *NewNode =
+    IsEndPath(Summ) ? Builder.MakeSinkNode(Dst, Ex, Pred, state)
+                    : Builder.MakeNode(Dst, Ex, Pred, state);
+  
+  // Annotate the edge with summary we used.
+  // FIXME: This assumes that we always use the same summary when generating
+  //  this node.
+  if (NewNode) SummaryLog[NewNode] = Summ;
 }