]> granicus.if.org Git - clang/commitdiff
Added "size()" and "empty()" methods to ExplodedGraphImpl.
authorTed Kremenek <kremenek@apple.com>
Mon, 18 Feb 2008 23:00:23 +0000 (23:00 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 18 Feb 2008 23:00:23 +0000 (23:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47289 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/PathSensitive/ExplodedGraph.h

index b6e31b9ffeef6713e6b7db626459e396f4ff2d3d..16dff250378f5f832cf1572e7908594d1b6a06b8 100644 (file)
@@ -234,6 +234,9 @@ protected:
   
   /// Ctx - The ASTContext used to "interpret" FD.
   ASTContext& Ctx;
+  
+  /// NumNodes - The number of nodes in the graph.
+  unsigned NumNodes;
 
   /// getNodeImpl - Retrieve the node associated with a (Location,State)
   ///  pair, where 'State' is represented as an opaque void*.  This method
@@ -255,7 +258,7 @@ protected:
   
   // ctor.
   ExplodedGraphImpl(CFG& c, FunctionDecl& f, ASTContext& ctx)
-    : cfg(c), FD(f), Ctx(ctx) {}
+    : cfg(c), FD(f), Ctx(ctx), NumNodes(0) {}
 
 public:
   virtual ~ExplodedGraphImpl();
@@ -263,6 +266,9 @@ public:
   unsigned num_roots() const { return Roots.size(); }
   unsigned num_eops() const { return EndNodes.size(); }
   
+  bool empty() const { return NumNodes == 0; }
+  unsigned size() const { return NumNodes; }
+  
   llvm::BumpPtrAllocator& getAllocator() { return Allocator; }
   CFG& getCFG() { return cfg; }
   ASTContext& getContext() { return Ctx; }
@@ -322,6 +328,8 @@ public:
       // Insert the node into the node set and return it.
       VSet->InsertNode(V, InsertPos);
       
+      ++NumNodes;
+      
       if (IsNew) *IsNew = true;
     }
     else