]> granicus.if.org Git - clang/commitdiff
Allocate vertices using a BumpPtrAllocator.
authorTed Kremenek <kremenek@apple.com>
Wed, 2 Jan 2008 17:00:32 +0000 (17:00 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 2 Jan 2008 17:00:32 +0000 (17:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45486 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/PathSensitive/SimulGraph.h

index 4e8f48fcab864fc01f2c94868aa30b320da8aa0c..cdf9dabb11d687b0699da0f60840b6ae2444f5b1 100644 (file)
@@ -19,6 +19,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/Support/Allocator.h"
 
 namespace clang {
   
@@ -48,6 +49,9 @@ class SimulGraph {
     
   /// VerticesOfEdge - A mapping from edges to vertices.
   EdgeVertexSetMap VerticesOfEdge;
+  
+  /// Allocator - BumpPtrAllocator to create vertices.
+  llvm::BumpPtrAllocator Allocator;
 
 public:
   SimulGraph() : VertexCounter(0) {}
@@ -72,11 +76,12 @@ public:
     if (V = VSet::FindNodeOrInsertPos(profile,InsertPos))
       return V;
       
-    // FIXME: Allocate from a BumpPtrAllocator.
-    V = new VertexTy(VertexCounter++,Loc,State);
+    // No cache hit.  Allocate a new vertex.
+    V = (VertexTy*) Allocator.Allocate<VertexTy>();
+    new (V) VertexTy(VertexCounter++,Loc,State);
 
     // Insert the vertex in the vertex set and return it.
-    VSet.InserNode(V,InsertPos);
+    VSet.InsertNode(V,InsertPos);
     
     return V;
   }