diff options
Diffstat (limited to 'include/clang/Analysis/PathSensitive/GRExprEngine.h')
-rw-r--r-- | include/clang/Analysis/PathSensitive/GRExprEngine.h | 122 |
1 files changed, 12 insertions, 110 deletions
diff --git a/include/clang/Analysis/PathSensitive/GRExprEngine.h b/include/clang/Analysis/PathSensitive/GRExprEngine.h index 25e4703..1b6d0bd 100644 --- a/include/clang/Analysis/PathSensitive/GRExprEngine.h +++ b/include/clang/Analysis/PathSensitive/GRExprEngine.h @@ -111,14 +111,6 @@ public: // was larger than sizeof(void *) (an undefined value). ErrorNodes NilReceiverLargerThanVoidPtrRetImplicit; - /// RetsStackAddr - Nodes in the ExplodedGraph that result from returning - /// the address of a stack variable. - ErrorNodes RetsStackAddr; - - /// RetsUndef - Nodes in the ExplodedGraph that result from returning - /// an undefined value. - ErrorNodes RetsUndef; - /// UndefBranches - Nodes in the ExplodedGraph that result from /// taking a branch based on an undefined value. ErrorNodes UndefBranches; @@ -131,22 +123,10 @@ public: // calling a function with the attribute "noreturn". ErrorNodes NoReturnCalls; - /// ImplicitBadSizedVLA - Nodes in the ExplodedGraph that result from - /// constructing a zero-sized VLA where the size may be zero. - ErrorNodes ImplicitBadSizedVLA; - - /// ExplicitBadSizedVLA - Nodes in the ExplodedGraph that result from - /// constructing a zero-sized VLA where the size must be zero. - ErrorNodes ExplicitBadSizedVLA; - /// UndefResults - Nodes in the ExplodedGraph where the operands are defined /// by the result is not. Excludes divide-by-zero errors. ErrorNodes UndefResults; - /// BadCalls - Nodes in the ExplodedGraph resulting from calls to function - /// pointers that are NULL (or other constants) or Undefined. - ErrorNodes BadCalls; - /// UndefReceiver - Nodes in the ExplodedGraph resulting from message /// ObjC message expressions where the receiver is undefined (uninitialized). ErrorNodes UndefReceivers; @@ -156,14 +136,6 @@ public: /// value. UndefArgsTy MsgExprUndefArgs; - /// OutOfBoundMemAccesses - Nodes in the ExplodedGraph resulting from - /// out-of-bound memory accesses where the index MAY be out-of-bound. - ErrorNodes ImplicitOOBMemAccesses; - - /// OutOfBoundMemAccesses - Nodes in the ExplodedGraph resulting from - /// out-of-bound memory accesses where the index MUST be out-of-bound. - ErrorNodes ExplicitOOBMemAccesses; - public: GRExprEngine(AnalysisManager &mgr); @@ -223,58 +195,10 @@ public: return static_cast<CHECKER*>(lookupChecker(CHECKER::getTag())); } - bool isRetStackAddr(const ExplodedNode* N) const { - return N->isSink() && RetsStackAddr.count(const_cast<ExplodedNode*>(N)) != 0; - } - - bool isUndefControlFlow(const ExplodedNode* N) const { - return N->isSink() && UndefBranches.count(const_cast<ExplodedNode*>(N)) != 0; - } - - bool isUndefStore(const ExplodedNode* N) const { - return N->isSink() && UndefStores.count(const_cast<ExplodedNode*>(N)) != 0; - } - - bool isImplicitNullDeref(const ExplodedNode* N) const { - return false; - } - - bool isExplicitNullDeref(const ExplodedNode* N) const { - return false; - } - - bool isUndefDeref(const ExplodedNode* N) const { - return false; - } - bool isNoReturnCall(const ExplodedNode* N) const { return N->isSink() && NoReturnCalls.count(const_cast<ExplodedNode*>(N)) != 0; } - bool isUndefResult(const ExplodedNode* N) const { - return N->isSink() && UndefResults.count(const_cast<ExplodedNode*>(N)) != 0; - } - - bool isBadCall(const ExplodedNode* N) const { - return false; - } - - bool isUndefArg(const ExplodedNode* N) const { - return false; - } - - bool isUndefReceiver(const ExplodedNode* N) const { - return N->isSink() && UndefReceivers.count(const_cast<ExplodedNode*>(N)) != 0; - } - - typedef ErrorNodes::iterator ret_stackaddr_iterator; - ret_stackaddr_iterator ret_stackaddr_begin() { return RetsStackAddr.begin(); } - ret_stackaddr_iterator ret_stackaddr_end() { return RetsStackAddr.end(); } - - typedef ErrorNodes::iterator ret_undef_iterator; - ret_undef_iterator ret_undef_begin() { return RetsUndef.begin(); } - ret_undef_iterator ret_undef_end() { return RetsUndef.end(); } - typedef ErrorNodes::iterator undef_branch_iterator; undef_branch_iterator undef_branches_begin() { return UndefBranches.begin(); } undef_branch_iterator undef_branches_end() { return UndefBranches.end(); } @@ -305,10 +229,6 @@ public: undef_result_iterator undef_results_begin() { return UndefResults.begin(); } undef_result_iterator undef_results_end() { return UndefResults.end(); } - typedef ErrorNodes::iterator bad_calls_iterator; - bad_calls_iterator bad_calls_begin() { return BadCalls.begin(); } - bad_calls_iterator bad_calls_end() { return BadCalls.end(); } - typedef UndefArgsTy::iterator undef_arg_iterator; undef_arg_iterator msg_expr_undef_arg_begin() { return MsgExprUndefArgs.begin(); @@ -327,20 +247,6 @@ public: return UndefReceivers.end(); } - typedef ErrorNodes::iterator oob_memacc_iterator; - oob_memacc_iterator implicit_oob_memacc_begin() { - return ImplicitOOBMemAccesses.begin(); - } - oob_memacc_iterator implicit_oob_memacc_end() { - return ImplicitOOBMemAccesses.end(); - } - oob_memacc_iterator explicit_oob_memacc_begin() { - return ExplicitOOBMemAccesses.begin(); - } - oob_memacc_iterator explicit_oob_memacc_end() { - return ExplicitOOBMemAccesses.end(); - } - void AddCheck(GRSimpleAPICheck* A, Stmt::StmtClass C); void AddCheck(GRSimpleAPICheck* A); @@ -368,10 +274,7 @@ public: /// ProcessEndPath - Called by GRCoreEngine. Used to generate end-of-path /// nodes when the control reaches the end of a function. - void ProcessEndPath(GREndPathNodeBuilder& builder) { - getTF().EvalEndPath(*this, builder); - StateMgr.EndPath(builder.getState()); - } + void ProcessEndPath(GREndPathNodeBuilder& builder); GRStateManager& getStateManager() { return StateMgr; } const GRStateManager& getStateManager() const { return StateMgr; } @@ -516,9 +419,6 @@ protected: void VisitUnaryOperator(UnaryOperator* B, ExplodedNode* Pred, ExplodedNodeSet& Dst, bool asLValue); - const GRState* CheckDivideZero(Expr* Ex, const GRState* St, ExplodedNode* Pred, - SVal Denom); - /// EvalEagerlyAssume - Given the nodes in 'Src', eagerly assume symbolic /// expressions of the form 'x != 0' and generate new nodes (stored in Dst) /// with those assumptions. @@ -553,15 +453,11 @@ public: } protected: - void EvalCall(ExplodedNodeSet& Dst, CallExpr* CE, SVal L, ExplodedNode* Pred); - void EvalObjCMessageExpr(ExplodedNodeSet& Dst, ObjCMessageExpr* ME, ExplodedNode* Pred) { assert (Builder && "GRStmtNodeBuilder must be defined."); getTF().EvalObjCMessageExpr(Dst, *this, *Builder, ME, Pred); } - void EvalReturn(ExplodedNodeSet& Dst, ReturnStmt* s, ExplodedNode* Pred); - const GRState* MarkBranch(const GRState* St, Stmt* Terminator, bool branchTaken); @@ -573,16 +469,22 @@ protected: bool atDeclInit = false); public: + // FIXME: 'tag' should be removed, and a LocationContext should be used + // instead. void EvalLoad(ExplodedNodeSet& Dst, Expr* Ex, ExplodedNode* Pred, - const GRState* St, SVal location, const void *tag = 0); + const GRState* St, SVal location, const void *tag = 0, + QualType LoadTy = QualType()); - ExplodedNode* EvalLocation(Stmt* Ex, ExplodedNode* Pred, + // FIXME: 'tag' should be removed, and a LocationContext should be used + // instead. + void EvalLocation(ExplodedNodeSet &Dst, Stmt *S, ExplodedNode* Pred, const GRState* St, SVal location, - const void *tag = 0); + const void *tag, bool isLoad); + // FIXME: 'tag' should be removed, and a LocationContext should be used + // instead. void EvalStore(ExplodedNodeSet& Dst, Expr* AssignE, Expr* StoreE, - ExplodedNode* Pred, - const GRState* St, SVal TargetLV, SVal Val, + ExplodedNode* Pred, const GRState* St, SVal TargetLV, SVal Val, const void *tag = 0); }; |