aboutsummaryrefslogtreecommitdiff
path: root/Analysis/ValueState.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-02-12 18:50:32 +0000
committerTed Kremenek <kremenek@apple.com>2008-02-12 18:50:32 +0000
commit5d2986bdadd59cb2bce541aec4da4afbff82847e (patch)
tree69c56cc7fcb46d209afc3a6af23c1c103199e32a /Analysis/ValueState.cpp
parent78492dae00fb85e0da0f966df4745edafdafb66c (diff)
Renamed local variable.
Added transfer function support for CharacterLiteral. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47014 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Analysis/ValueState.cpp')
-rw-r--r--Analysis/ValueState.cpp30
1 files changed, 19 insertions, 11 deletions
diff --git a/Analysis/ValueState.cpp b/Analysis/ValueState.cpp
index f51175fdca..d550716fd5 100644
--- a/Analysis/ValueState.cpp
+++ b/Analysis/ValueState.cpp
@@ -165,14 +165,14 @@ ValueStateManager::AddEQ(ValueState St, SymbolID sym, const llvm::APSInt& V) {
return getPersistentState(NewSt);
}
-RValue ValueStateManager::GetValue(ValueState St, Expr* S, bool* hasVal) {
+RValue ValueStateManager::GetValue(ValueState St, Expr* E, bool* hasVal) {
for (;;) {
- switch (S->getStmtClass()) {
+ switch (E->getStmtClass()) {
// ParenExprs are no-ops.
case Stmt::ParenExprClass:
- S = cast<ParenExpr>(S)->getSubExpr();
+ E = cast<ParenExpr>(E)->getSubExpr();
continue;
// DeclRefExprs can either evaluate to an LValue or a Non-LValue
@@ -181,31 +181,39 @@ RValue ValueStateManager::GetValue(ValueState St, Expr* S, bool* hasVal) {
// within the referenced variables.
case Stmt::DeclRefExprClass:
- return GetValue(St, lval::DeclVal(cast<DeclRefExpr>(S)->getDecl()));
+ return GetValue(St, lval::DeclVal(cast<DeclRefExpr>(E)->getDecl()));
// Integer literals evaluate to an RValue. Simply retrieve the
// RValue for the literal.
case Stmt::IntegerLiteralClass:
- return NonLValue::GetValue(ValMgr, cast<IntegerLiteral>(S));
+ return NonLValue::GetValue(ValMgr, cast<IntegerLiteral>(E));
+ case Stmt::CharacterLiteralClass: {
+ CharacterLiteral* C = cast<CharacterLiteral>(E);
+
+ return NonLValue::GetValue(ValMgr, C->getValue(), C->getType(),
+ C->getLoc());
+ }
+
// Casts where the source and target type are the same
// are no-ops. We blast through these to get the descendant
// subexpression that has a value.
+
case Stmt::ImplicitCastExprClass: {
- ImplicitCastExpr* C = cast<ImplicitCastExpr>(S);
+ ImplicitCastExpr* C = cast<ImplicitCastExpr>(E);
if (C->getType() == C->getSubExpr()->getType()) {
- S = C->getSubExpr();
+ E = C->getSubExpr();
continue;
}
break;
}
case Stmt::CastExprClass: {
- CastExpr* C = cast<CastExpr>(S);
+ CastExpr* C = cast<CastExpr>(E);
if (C->getType() == C->getSubExpr()->getType()) {
- S = C->getSubExpr();
+ E = C->getSubExpr();
continue;
}
break;
@@ -220,14 +228,14 @@ RValue ValueStateManager::GetValue(ValueState St, Expr* S, bool* hasVal) {
break;
}
- ValueState::ExprBindingsTy::TreeTy* T = St->SubExprBindings.SlimFind(S);
+ ValueState::ExprBindingsTy::TreeTy* T = St->SubExprBindings.SlimFind(E);
if (T) {
if (hasVal) *hasVal = true;
return T->getValue().second;
}
- T = St->BlockExprBindings.SlimFind(S);
+ T = St->BlockExprBindings.SlimFind(E);
if (T) {
if (hasVal) *hasVal = true;