diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-01-29 00:33:40 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-01-29 00:33:40 +0000 |
commit | cb48b9c9c3c95f2650b74530264c288d1f58c73c (patch) | |
tree | 81aacccbab04522de07fc8f5394bdf6de085cdc8 /include/clang/Analysis/PathSensitive/ExplodedGraph.h | |
parent | ba03eda1599dd89da935a2b46da10659afe46add (diff) |
Driver now passes the top-level FunctionDecl* to GRConstants.
Refactoring: for GREngine and GRConstants, pushed references to CFG, ASTContext,
and the top-level FunctionDecl into ExplodedGraphImpl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46475 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Analysis/PathSensitive/ExplodedGraph.h')
-rw-r--r-- | include/clang/Analysis/PathSensitive/ExplodedGraph.h | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/include/clang/Analysis/PathSensitive/ExplodedGraph.h b/include/clang/Analysis/PathSensitive/ExplodedGraph.h index 9818095350..9545e7c0d8 100644 --- a/include/clang/Analysis/PathSensitive/ExplodedGraph.h +++ b/include/clang/Analysis/PathSensitive/ExplodedGraph.h @@ -29,7 +29,11 @@ namespace clang { class GREngineImpl; class ExplodedNodeImpl; class GRNodeBuilderImpl; +class CFG; +class ASTContext; +class FunctionDecl; + class ExplodedNodeImpl : public llvm::FoldingSetNode { protected: friend class ExplodedGraphImpl; @@ -210,6 +214,15 @@ protected: /// Allocator - BumpPtrAllocator to create nodes. llvm::BumpPtrAllocator Allocator; + + /// cfg - The CFG associated with this analysis graph. + CFG& cfg; + + /// FD - The function declaration of the function being analyzed. + FunctionDecl& FD; + + /// Ctx - The ASTContext used to "interpret" FD. + ASTContext& Ctx; /// getNodeImpl - Retrieve the node associated with a (Location,State) /// pair, where 'State' is represented as an opaque void*. This method @@ -228,12 +241,20 @@ protected: EndNodes.push_back(V); return V; } + + // ctor. + ExplodedGraphImpl(CFG& c, FunctionDecl& f, ASTContext& ctx) + : cfg(c), FD(f), Ctx(ctx) {} public: virtual ~ExplodedGraphImpl(); unsigned num_roots() const { return Roots.size(); } unsigned num_eops() const { return EndNodes.size(); } + + CFG& getCFG() { return cfg; } + ASTContext& getContext() { return Ctx; } + FunctionDecl& getFunctionDecl() { return FD; } }; template <typename CHECKER> @@ -243,7 +264,7 @@ public: typedef typename CHECKER::StateTy StateTy; typedef ExplodedNode<StateTy> NodeTy; -protected: +protected: llvm::OwningPtr<CheckerTy> CheckerState; protected: @@ -253,7 +274,8 @@ protected: } public: - ExplodedGraph() : CheckerState(new CheckerTy()) {} + ExplodedGraph(CFG& c, FunctionDecl& fd, ASTContext& ctx) + : ExplodedGraphImpl(c, fd, ctx), CheckerState(new CheckerTy(*this)) {} /// getCheckerState - Returns the internal checker state associated /// with the exploded graph. Ownership remains with the ExplodedGraph |