From: Ted Kremenek Date: Tue, 4 Mar 2008 23:50:00 +0000 (+0000) Subject: Make GRStmtNodeBuilder only depend on StateTy, and not the type definition X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f116bd654bcdb5d7c22656f224deeb7a67f7d0cd;p=clang Make GRStmtNodeBuilder only depend on StateTy, and not the type definition of the entire checker. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47920 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Analysis/PathSensitive/GRCoreEngine.h b/include/clang/Analysis/PathSensitive/GRCoreEngine.h index b8541309a1..2051850c92 100644 --- a/include/clang/Analysis/PathSensitive/GRCoreEngine.h +++ b/include/clang/Analysis/PathSensitive/GRCoreEngine.h @@ -136,8 +136,6 @@ public: ~GRStmtNodeBuilderImpl(); - const ExplodedGraphImpl& getGraph() const { return *Eng.G; } - inline ExplodedNodeImpl* getLastNode() { return LastNode ? (LastNode->isSink() ? NULL : LastNode) : NULL; } @@ -156,22 +154,16 @@ public: CFGBlock* getBlock() const { return &B; } }; -template +template class GRStmtNodeBuilder { - typedef CHECKER CheckerTy; - typedef typename CheckerTy::StateTy StateTy; - typedef ExplodedGraph GraphTy; - typedef typename GraphTy::NodeTy NodeTy; + typedef STATE StateTy; + typedef ExplodedNode NodeTy; GRStmtNodeBuilderImpl& NB; public: GRStmtNodeBuilder(GRStmtNodeBuilderImpl& nb) : NB(nb) {} - - const GraphTy& getGraph() const { - return static_cast(NB.getGraph()); - } - + NodeTy* getLastNode() const { return static_cast(NB.getLastNode()); } @@ -449,7 +441,7 @@ protected: } virtual void ProcessStmt(Stmt* S, GRStmtNodeBuilderImpl& BuilderImpl) { - GRStmtNodeBuilder Builder(BuilderImpl); + GRStmtNodeBuilder Builder(BuilderImpl); Checker->ProcessStmt(S, Builder); } diff --git a/include/clang/Analysis/PathSensitive/GRExprEngine.h b/include/clang/Analysis/PathSensitive/GRExprEngine.h index 2937dd6129..a6d502f2a3 100644 --- a/include/clang/Analysis/PathSensitive/GRExprEngine.h +++ b/include/clang/Analysis/PathSensitive/GRExprEngine.h @@ -27,7 +27,7 @@ public: typedef GraphTy::NodeTy NodeTy; // Builders. - typedef GRStmtNodeBuilder StmtNodeBuilder; + typedef GRStmtNodeBuilder StmtNodeBuilder; typedef GRBranchNodeBuilder BranchNodeBuilder; typedef GRIndirectGotoNodeBuilder IndirectGotoNodeBuilder; typedef GRSwitchNodeBuilder SwitchNodeBuilder; @@ -325,13 +325,6 @@ protected: return Builder->Nodify(Dst, S, Pred, St); } -#if 0 - /// Nodify - This version of Nodify is used to batch process a set of states. - /// The states are not guaranteed to be unique. - void Nodify(NodeSet& Dst, Stmt* S, NodeTy* Pred, - const ValueState*::BufferTy& SB); -#endif - /// HandleUndefinedStore - Create the necessary sink node to represent /// a store to an "undefined" LVal. void HandleUndefinedStore(Stmt* S, NodeTy* Pred); diff --git a/include/clang/Analysis/PathSensitive/GRTransferFuncs.h b/include/clang/Analysis/PathSensitive/GRTransferFuncs.h index 01e67ea68d..a91a97b91a 100644 --- a/include/clang/Analysis/PathSensitive/GRTransferFuncs.h +++ b/include/clang/Analysis/PathSensitive/GRTransferFuncs.h @@ -16,6 +16,7 @@ #define LLVM_CLANG_ANALYSIS_GRTF #include "clang/Analysis/PathSensitive/RValues.h" +#include "clang/Analysis/PathSensitive/GRCoreEngine.h" namespace clang {