aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/Environment.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-11-12 19:21:30 +0000
committerTed Kremenek <kremenek@apple.com>2008-11-12 19:21:30 +0000
commitd4931632946fe86fc2b09496f2b62443440a7da4 (patch)
treeb2e2c781ba996e12086d90e8cb2775949b5a866f /lib/Analysis/Environment.cpp
parent42577d145e2c6c3f77731645d442faa716f4c852 (diff)
GRStateRef:
- Rename SetSVal to BindLoc - Add BindDecl - Add BindExpr GRState: - Environment now binds to Stmt* instead of Expr*. This is needed for processing ObjCForCollectionStmt (essentially the declaration of the the 'element' variable can have an SVal attached to it). - BindDecl no longer accepts Expr* for the initialization value; use SVal* instead. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59152 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/Environment.cpp')
-rw-r--r--lib/Analysis/Environment.cpp42
1 files changed, 23 insertions, 19 deletions
diff --git a/lib/Analysis/Environment.cpp b/lib/Analysis/Environment.cpp
index 0effe3ae58..a67965e35a 100644
--- a/lib/Analysis/Environment.cpp
+++ b/lib/Analysis/Environment.cpp
@@ -1,4 +1,4 @@
-//== Environment.cpp - Map from Expr* to Locations/Values -------*- C++ -*--==//
+//== Environment.cpp - Map from Stmt* to Locations/Values -------*- C++ -*--==//
//
// The LLVM Compiler Infrastructure
//
@@ -18,7 +18,7 @@
using namespace clang;
-SVal Environment::GetSVal(Expr* E, BasicValueFactory& BasicVals) const {
+SVal Environment::GetSVal(Stmt* E, BasicValueFactory& BasicVals) const {
for (;;) {
@@ -58,7 +58,7 @@ SVal Environment::GetSVal(Expr* E, BasicValueFactory& BasicVals) const {
break;
}
- // Handle all other Expr* using a lookup.
+ // Handle all other Stmt* using a lookup.
default:
break;
@@ -70,26 +70,30 @@ SVal Environment::GetSVal(Expr* E, BasicValueFactory& BasicVals) const {
return LookupExpr(E);
}
-SVal Environment::GetBlkExprSVal(Expr* E, BasicValueFactory& BasicVals) const {
+SVal Environment::GetBlkExprSVal(Stmt* E, BasicValueFactory& BasicVals) const {
- E = E->IgnoreParens();
-
- switch (E->getStmtClass()) {
- case Stmt::CharacterLiteralClass: {
- CharacterLiteral* C = cast<CharacterLiteral>(E);
- return NonLoc::MakeVal(BasicVals, C->getValue(), C->getType());
- }
-
- case Stmt::IntegerLiteralClass: {
- return NonLoc::MakeVal(BasicVals, cast<IntegerLiteral>(E));
+ while (1) {
+ switch (E->getStmtClass()) {
+ case Stmt::ParenExprClass:
+ E = cast<ParenExpr>(E)->getSubExpr();
+ continue;
+
+ case Stmt::CharacterLiteralClass: {
+ CharacterLiteral* C = cast<CharacterLiteral>(E);
+ return NonLoc::MakeVal(BasicVals, C->getValue(), C->getType());
+ }
+
+ case Stmt::IntegerLiteralClass: {
+ return NonLoc::MakeVal(BasicVals, cast<IntegerLiteral>(E));
+ }
+
+ default:
+ return LookupBlkExpr(E);
}
-
- default:
- return LookupBlkExpr(E);
}
}
-Environment EnvironmentManager::BindExpr(const Environment& Env, Expr* E,SVal V,
+Environment EnvironmentManager::BindExpr(const Environment& Env, Stmt* E,SVal V,
bool isBlkExpr, bool Invalidate) {
assert (E);
@@ -115,7 +119,7 @@ EnvironmentManager::RemoveDeadBindings(Environment Env, Stmt* Loc,
// Iterate over the block-expr bindings.
for (Environment::beb_iterator I = Env.beb_begin(), E = Env.beb_end();
I != E; ++I) {
- Expr* BlkExpr = I.getKey();
+ Stmt* BlkExpr = I.getKey();
if (Liveness.isLive(Loc, BlkExpr)) {
SVal X = I.getData();