aboutsummaryrefslogtreecommitdiff
path: root/Analysis/ValueState.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-03-09 03:30:59 +0000
committerTed Kremenek <kremenek@apple.com>2008-03-09 03:30:59 +0000
commit9b5551d7f0209cec8b9c555cf70e893940674e5c (patch)
treeefed4b85d9d95f4050c792b63a27032c44496383 /Analysis/ValueState.cpp
parenta3b605ef0d535c5c5ac3f00e1e2d46fa7336d26c (diff)
Bug fix: Don't call RemoveDeadBindings more than once (can kill newly generated values to Block-Level Expressions).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48079 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Analysis/ValueState.cpp')
-rw-r--r--Analysis/ValueState.cpp26
1 files changed, 6 insertions, 20 deletions
diff --git a/Analysis/ValueState.cpp b/Analysis/ValueState.cpp
index 4eb2a5eb54..4b097ee4a4 100644
--- a/Analysis/ValueState.cpp
+++ b/Analysis/ValueState.cpp
@@ -232,28 +232,14 @@ RVal ValueStateManager::GetRVal(ValueState* St, Expr* E) {
// within the referenced variables.
case Stmt::DeclRefExprClass: {
-
- ValueDecl* D = cast<DeclRefExpr>(E)->getDecl();
-
- if (VarDecl* VD = dyn_cast<VarDecl>(D)) {
- return GetRVal(St, lval::DeclVal(VD));
- }
- else if (EnumConstantDecl* ED = dyn_cast<EnumConstantDecl>(D)) {
-
- // FIXME: Do we need to cache a copy of this enum, since it
- // already has persistent storage? We do this because we
- // are comparing states using pointer equality. Perhaps there is
- // a better way, since APInts are fairly lightweight.
- return nonlval::ConcreteInt(BasicVals.getValue(ED->getInitVal()));
- }
- else if (FunctionDecl* FD = dyn_cast<FunctionDecl>(D))
- return lval::FuncVal(FD);
-
- assert (false &&
- "ValueDecl support for this ValueDecl not implemented.");
+ // 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;
- return UnknownVal();
+ RVal X = RVal::MakeVal(BasicVals, cast<DeclRefExpr>(E));
+ return isa<lval::DeclVal>(X) ? GetRVal(St, cast<lval::DeclVal>(X)) : X;
}
case Stmt::CharacterLiteralClass: {