diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-11-06 02:24:13 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-11-06 02:24:13 +0000 |
commit | 1053d246f451c399468248625d1146e3d845e21e (patch) | |
tree | 3a3ff1f9d0efd20a2998769ad42e2872e645f3e9 /include/clang/Analysis | |
parent | b653c52d9176a4faecf923f792758f4454f7f78c (diff) |
static analyzer: refactor checking logic for returning the address of a stack variable or a garbage
value into their own respective subclasses of Checker (and put them in .cpp files where their
implementation details are hidden from GRExprEngine).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86215 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Analysis')
-rw-r--r-- | include/clang/Analysis/PathSensitive/Checker.h | 4 | ||||
-rw-r--r-- | include/clang/Analysis/PathSensitive/CheckerVisitor.def | 3 | ||||
-rw-r--r-- | include/clang/Analysis/PathSensitive/GRExprEngine.h | 14 |
3 files changed, 6 insertions, 15 deletions
diff --git a/include/clang/Analysis/PathSensitive/Checker.h b/include/clang/Analysis/PathSensitive/Checker.h index 4fc0a617ec..2564a73089 100644 --- a/include/clang/Analysis/PathSensitive/Checker.h +++ b/include/clang/Analysis/PathSensitive/Checker.h @@ -76,6 +76,10 @@ public: BugReporter &getBugReporter() { return Eng.getBugReporter(); } + + SourceManager &getSourceManager() { + return getBugReporter().getSourceManager(); + } ExplodedNode *GenerateNode(const Stmt *S, bool markAsSink = false) { return GenerateNode(S, getState(), markAsSink); diff --git a/include/clang/Analysis/PathSensitive/CheckerVisitor.def b/include/clang/Analysis/PathSensitive/CheckerVisitor.def index ff6528dae8..3f68a7a9d5 100644 --- a/include/clang/Analysis/PathSensitive/CheckerVisitor.def +++ b/include/clang/Analysis/PathSensitive/CheckerVisitor.def @@ -11,8 +11,9 @@ // //===---------------------------------------------------------------------===// +PREVISIT(BinaryOperator) PREVISIT(CallExpr) PREVISIT(ObjCMessageExpr) -PREVISIT(BinaryOperator) +PREVISIT(ReturnStmt) #undef PREVISIT diff --git a/include/clang/Analysis/PathSensitive/GRExprEngine.h b/include/clang/Analysis/PathSensitive/GRExprEngine.h index 25e47038d7..f6971374e8 100644 --- a/include/clang/Analysis/PathSensitive/GRExprEngine.h +++ b/include/clang/Analysis/PathSensitive/GRExprEngine.h @@ -223,10 +223,6 @@ 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; } @@ -267,14 +263,6 @@ public: 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(); } @@ -560,8 +548,6 @@ protected: 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); |