From: Ted Kremenek Date: Mon, 18 Feb 2008 23:00:23 +0000 (+0000) Subject: Added "size()" and "empty()" methods to ExplodedGraphImpl. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=39b4c6c98d391b25c376782cf92346aa88c96f7e;p=clang Added "size()" and "empty()" methods to ExplodedGraphImpl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47289 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Analysis/PathSensitive/ExplodedGraph.h b/include/clang/Analysis/PathSensitive/ExplodedGraph.h index b6e31b9ffe..16dff25037 100644 --- a/include/clang/Analysis/PathSensitive/ExplodedGraph.h +++ b/include/clang/Analysis/PathSensitive/ExplodedGraph.h @@ -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