diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-12-09 12:16:07 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-12-09 12:16:07 +0000 |
commit | 8cca37fae0e6f05ba8987fcdc86a780175ae0121 (patch) | |
tree | 144d7c49d4af13491dce9f2bf88c884c76d04ce9 /clang/lib/Analysis/GRExprEngine.cpp | |
parent | 75017b7cef1603f87a5644b6b557ddc4f03dcf45 (diff) | |
download | bcm5719-llvm-8cca37fae0e6f05ba8987fcdc86a780175ae0121.tar.gz bcm5719-llvm-8cca37fae0e6f05ba8987fcdc86a780175ae0121.zip |
Use a temporary destination set such that we can clear fake auto transitions.
Otherwise, even when real evaluation occurs, the previous fake auto
transitions would still be in the destination set, causing fake state
bifurcation.
llvm-svn: 90967
Diffstat (limited to 'clang/lib/Analysis/GRExprEngine.cpp')
-rw-r--r-- | clang/lib/Analysis/GRExprEngine.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/clang/lib/Analysis/GRExprEngine.cpp b/clang/lib/Analysis/GRExprEngine.cpp index daa249f901c..a31b57331b2 100644 --- a/clang/lib/Analysis/GRExprEngine.cpp +++ b/clang/lib/Analysis/GRExprEngine.cpp @@ -152,13 +152,26 @@ void GRExprEngine::CheckerEvalNilReceiver(const ObjCMessageExpr *ME, ExplodedNodeSet &Dst, const GRState *state, ExplodedNode *Pred) { + bool Evaluated = false; + ExplodedNodeSet DstTmp; + for (CheckersOrdered::iterator I=Checkers.begin(),E=Checkers.end();I!=E;++I) { void *tag = I->first; Checker *checker = I->second; - if (checker->GR_EvalNilReceiver(Dst, *Builder, *this, ME, Pred, state, tag)) + if (checker->GR_EvalNilReceiver(DstTmp, *Builder, *this, ME, Pred, state, + tag)) { + Evaluated = true; break; + } else + // The checker didn't evaluate the expr. Restore the Dst. + DstTmp.clear(); } + + if (Evaluated) + Dst.insert(DstTmp); + else + Dst.insert(Pred); } // CheckerEvalCall returns true if one of the checkers processed the node. @@ -168,17 +181,25 @@ bool GRExprEngine::CheckerEvalCall(const CallExpr *CE, ExplodedNodeSet &Dst, ExplodedNode *Pred) { bool Evaluated = false; + ExplodedNodeSet DstTmp; for (CheckersOrdered::iterator I=Checkers.begin(),E=Checkers.end();I!=E;++I) { void *tag = I->first; Checker *checker = I->second; - if (checker->GR_EvalCallExpr(Dst, *Builder, *this, CE, Pred, tag)) { + if (checker->GR_EvalCallExpr(DstTmp, *Builder, *this, CE, Pred, tag)) { Evaluated = true; break; - } + } else + // The checker didn't evaluate the expr. Restore the DstTmp set. + DstTmp.clear(); } + if (Evaluated) + Dst.insert(DstTmp); + else + Dst.insert(Pred); + return Evaluated; } |