[cfe-commits] r47289 - /cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h

Ted Kremenek kremenek at apple.com
Mon Feb 18 15:00:23 PST 2008


Author: kremenek
Date: Mon Feb 18 17:00:23 2008
New Revision: 47289

URL: http://llvm.org/viewvc/llvm-project?rev=47289&view=rev
Log:
Added "size()" and "empty()" methods to ExplodedGraphImpl.

Modified:
    cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h?rev=47289&r1=47288&r2=47289&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h Mon Feb 18 17:00:23 2008
@@ -234,6 +234,9 @@
   
   /// 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 @@
   
   // 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 @@
   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 @@
       // Insert the node into the node set and return it.
       VSet->InsertNode(V, InsertPos);
       
+      ++NumNodes;
+      
       if (IsNew) *IsNew = true;
     }
     else





More information about the cfe-commits mailing list