diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-12-17 21:50:35 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-12-17 21:50:35 +0000 |
commit | 62d4c12d2cde2cb7dabab4d7da240f1c5162b22e (patch) | |
tree | 38925f8713c8dfac195fb6be3283f650e368698e /clang/lib/Analysis/BasicConstraintManager.cpp | |
parent | f327e89dabc34946f0086961b30813d4e25d22a5 (diff) | |
download | bcm5719-llvm-62d4c12d2cde2cb7dabab4d7da240f1c5162b22e.tar.gz bcm5719-llvm-62d4c12d2cde2cb7dabab4d7da240f1c5162b22e.zip |
CF-retain/release checker:
- Fix regression reported in <rdar://problem/6452745>. After a null check, null references to resources should not have a retain count. This regression was caused by removing the call to "GRTransferFuncs::EvalAssume" in BasicConstraintManager.
- Added a test case to test this behavior.
llvm-svn: 61155
Diffstat (limited to 'clang/lib/Analysis/BasicConstraintManager.cpp')
-rw-r--r-- | clang/lib/Analysis/BasicConstraintManager.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/clang/lib/Analysis/BasicConstraintManager.cpp b/clang/lib/Analysis/BasicConstraintManager.cpp index 7c303b2ac3c..d9d97c601a7 100644 --- a/clang/lib/Analysis/BasicConstraintManager.cpp +++ b/clang/lib/Analysis/BasicConstraintManager.cpp @@ -15,6 +15,7 @@ #include "clang/Analysis/PathSensitive/ConstraintManager.h" #include "clang/Analysis/PathSensitive/GRState.h" #include "clang/Analysis/PathSensitive/GRStateTrait.h" +#include "clang/Analysis/PathSensitive/GRTransferFuncs.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/raw_ostream.h" @@ -115,8 +116,15 @@ const GRState* BasicConstraintManager::Assume(const GRState* St, SVal Cond, const GRState* BasicConstraintManager::Assume(const GRState* St, Loc Cond, bool Assumption, bool& isFeasible) { St = AssumeAux(St, Cond, Assumption, isFeasible); - // TF->EvalAssume(*this, St, Cond, Assumption, isFeasible) - return St; + + if (!isFeasible) + return St; + + // EvalAssume is used to call into the GRTransferFunction object to perform + // any checker-specific update of the state based on this assumption being + // true or false. + return StateMgr.getTransferFuncs().EvalAssume(StateMgr, St, Cond, Assumption, + isFeasible); } const GRState* BasicConstraintManager::AssumeAux(const GRState* St, Loc Cond, @@ -173,8 +181,15 @@ const GRState* BasicConstraintManager::Assume(const GRState* St, NonLoc Cond, bool Assumption, bool& isFeasible) { St = AssumeAux(St, Cond, Assumption, isFeasible); - // TF->EvalAssume() does nothing now. - return St; + + if (!isFeasible) + return St; + + // EvalAssume is used to call into the GRTransferFunction object to perform + // any checker-specific update of the state based on this assumption being + // true or false. + return StateMgr.getTransferFuncs().EvalAssume(StateMgr, St, Cond, Assumption, + isFeasible); } const GRState* |