]> granicus.if.org Git - clang/commitdiff
SimulGraph::getVertex() now also returns a bool indicating if the returned
authorTed Kremenek <kremenek@apple.com>
Thu, 3 Jan 2008 22:08:52 +0000 (22:08 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 3 Jan 2008 22:08:52 +0000 (22:08 +0000)
vertex was freshly created.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45550 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/PathSensitive/SimulGraph.h

index 302d176d4b020d9ccac64c103219b4efe63df74e..a26e12ab3658a96d0d13f6c3ef9c196c0763e411 100644 (file)
@@ -58,8 +58,10 @@ public:
   
   /// getVertex - Retrieve the vertex associated with a (Location,State) pair,
   ///  where the 'Location' is a ProgramEdge in the CFG.  If no vertex for
-  ///  this pair exists, it is created.
-  VertexTy* getVertex(const ProgramEdge& L, typename VertexTy::StateTy State) {
+  ///  this pair exists, it is created.  The bool returned in the pair
+  ///  is true if the vertex was freshly created.
+  std::pair<VertexTy*,bool> getVertex(const ProgramEdge& L,
+                                      typename VertexTy::StateTy State) {
     
     // Retrieve the vertex set associated with Loc.
     VertexSet& VSet = VerticesOfEdge[L];
@@ -75,7 +77,7 @@ public:
     VertexTy::StateTy::Profile(profile, State);
     
     if ((V = VSet.FindNodeOrInsertPos(profile,InsertPos)))
-      return V;
+      return std::make_pair(V,false);
       
     // No cache hit.  Allocate a new vertex.
     V = (VertexTy*) Allocator.Allocate<VertexTy>();
@@ -84,7 +86,7 @@ public:
     // Insert the vertex into the vertex set and return it.
     VSet.InsertNode(V,InsertPos);
     
-    return V;
+    return std::make_pair(V,true);
   }
   
   /// addRoot - Add a vertex to the set of roots.