diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-04-29 21:04:26 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-04-29 21:04:26 +0000 |
commit | 1b8bd4d71c2098126041b4de4267175a82f0103c (patch) | |
tree | 2f4530dca8ccf37e2c6e9dfc019613a831957ebb /lib/Analysis/ValueState.cpp | |
parent | 688e659cb57839b8318d566f08a879ca1c2bd1b4 (diff) |
Major rewrite/refactoring of static analysis engine. We now use
EvalStore/EvalLoad to handle all loads/stores from symbolic memory, allowing us
to do checks for null dereferences, etc., at any arbitrary load/store (these
were missed checks before). This also resulted in some major cleanups, some
conceptual, and others just in the structure of the code.
This temporarily introduces a regression in the test suite (null-deref-ps.c)
before I add a new LVal type for structure fields.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50443 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ValueState.cpp')
-rw-r--r-- | lib/Analysis/ValueState.cpp | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/lib/Analysis/ValueState.cpp b/lib/Analysis/ValueState.cpp index e36bbfa9d3..cba0253ea1 100644 --- a/lib/Analysis/ValueState.cpp +++ b/lib/Analysis/ValueState.cpp @@ -271,22 +271,6 @@ RVal ValueStateManager::GetRVal(ValueState* St, Expr* E) { E = cast<ParenExpr>(E)->getSubExpr(); continue; - // DeclRefExprs can either evaluate to an LVal or a Non-LVal - // (assuming an implicit "load") depending on the context. In this - // context we assume that we are retrieving the value contained - // within the referenced variables. - - case Stmt::DeclRefExprClass: { - - // Check if this expression is a block-level expression. If so, - // return its value. - ValueState::ExprBindingsTy::TreeTy* T=St->BlockExprBindings.SlimFind(E); - if (T) return T->getValue().second; - - RVal X = RVal::MakeVal(BasicVals, cast<DeclRefExpr>(E)); - return isa<lval::DeclVal>(X) ? GetRVal(St, cast<lval::DeclVal>(X)) : X; - } - case Stmt::CharacterLiteralClass: { CharacterLiteral* C = cast<CharacterLiteral>(E); return NonLVal::MakeVal(BasicVals, C->getValue(), C->getType()); @@ -326,18 +310,6 @@ RVal ValueStateManager::GetRVal(ValueState* St, Expr* E) { break; } - case Stmt::UnaryOperatorClass: { - - UnaryOperator* U = cast<UnaryOperator>(E); - - if (U->getOpcode() == UnaryOperator::Plus) { - E = U->getSubExpr(); - continue; - } - - break; - } - // Handle all other Expr* using a lookup. default: @@ -377,34 +349,6 @@ RVal ValueStateManager::GetBlkExprRVal(ValueState* St, Expr* E) { } } -RVal ValueStateManager::GetLVal(ValueState* St, Expr* E) { - - E = E->IgnoreParens(); - - if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(E)) { - ValueDecl* VD = DR->getDecl(); - - if (FunctionDecl* FD = dyn_cast<FunctionDecl>(VD)) - return lval::FuncVal(FD); - else - return lval::DeclVal(cast<VarDecl>(DR->getDecl())); - } - - if (UnaryOperator* U = dyn_cast<UnaryOperator>(E)) - if (U->getOpcode() == UnaryOperator::Deref) { - E = U->getSubExpr()->IgnoreParens(); - - if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(E)) { - lval::DeclVal X(cast<VarDecl>(DR->getDecl())); - return GetRVal(St, X); - } - else - return GetRVal(St, E); - } - - return GetRVal(St, E); -} - ValueState* ValueStateManager::SetRVal(ValueState* St, Expr* E, RVal V, bool isBlkExpr, bool Invalidate) { |