[cfe-commits] r47617 - in /cfe/trunk/Analysis: GRExprEngine.cpp ValueState.cpp
Ted Kremenek
kremenek at apple.com
Tue Feb 26 11:17:10 PST 2008
Author: kremenek
Date: Tue Feb 26 13:17:09 2008
New Revision: 47617
URL: http://llvm.org/viewvc/llvm-project?rev=47617&view=rev
Log:
optimization: no longer create ExplodedNodes for IntegerLiteral and
CharacterLiteral expressions.
Modified:
cfe/trunk/Analysis/GRExprEngine.cpp
cfe/trunk/Analysis/ValueState.cpp
Modified: cfe/trunk/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRExprEngine.cpp?rev=47617&r1=47616&r2=47617&view=diff
==============================================================================
--- cfe/trunk/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/Analysis/GRExprEngine.cpp Tue Feb 26 13:17:09 2008
@@ -1170,7 +1170,7 @@
default:
// Cases we intentionally have "default" handle:
- // AddrLabelExpr
+ // AddrLabelExpr, IntegerLiteral, CharacterLiteral
Dst.Add(Pred); // No-op. Simply propagate the current state unchanged.
break;
@@ -1203,20 +1203,7 @@
VisitCast(C, C->getSubExpr(), Pred, Dst);
break;
}
-
- // While explicitly creating a node+state for visiting a CharacterLiteral
- // seems wasteful, it also solves a bunch of problems when handling
- // the ?, &&, and ||.
-
- case Stmt::CharacterLiteralClass: {
- CharacterLiteral* C = cast<CharacterLiteral>(S);
- StateTy St = Pred->getState();
- NonLVal X = NonLVal::MakeVal(ValMgr, C->getValue(), C->getType(),
- C->getLoc());
- Nodify(Dst, C, Pred, SetRVal(St, C, X));
- break;
- }
-
+
// FIXME: ChooseExpr is really a constant. We need to fix
// the CFG do not model them as explicit control-flow.
@@ -1244,18 +1231,6 @@
VisitDeclStmt(cast<DeclStmt>(S), Pred, Dst);
break;
- // While explicitly creating a node+state for visiting an IntegerLiteral
- // seems wasteful, it also solves a bunch of problems when handling
- // the ?, &&, and ||.
-
- case Stmt::IntegerLiteralClass: {
- StateTy St = Pred->getState();
- IntegerLiteral* I = cast<IntegerLiteral>(S);
- NonLVal X = NonLVal::MakeVal(ValMgr, I);
- Nodify(Dst, I, Pred, SetRVal(St, I, X));
- break;
- }
-
case Stmt::ImplicitCastExprClass: {
ImplicitCastExpr* C = cast<ImplicitCastExpr>(S);
VisitCast(C, C->getSubExpr(), Pred, Dst);
Modified: cfe/trunk/Analysis/ValueState.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/ValueState.cpp?rev=47617&r1=47616&r2=47617&view=diff
==============================================================================
--- cfe/trunk/Analysis/ValueState.cpp (original)
+++ cfe/trunk/Analysis/ValueState.cpp Tue Feb 26 13:17:09 2008
@@ -264,6 +264,16 @@
return UnknownVal();
}
+
+ case Stmt::CharacterLiteralClass: {
+ CharacterLiteral* C = cast<CharacterLiteral>(E);
+ return NonLVal::MakeVal(ValMgr, C->getValue(), C->getType(),
+ C->getLoc());
+ }
+
+ case Stmt::IntegerLiteralClass: {
+ return NonLVal::MakeVal(ValMgr, cast<IntegerLiteral>(E));
+ }
// Casts where the source and target type are the same
// are no-ops. We blast through these to get the descendant
@@ -332,9 +342,23 @@
RVal ValueStateManager::GetBlkExprRVal(ValueState St, Expr* E) {
assert (!isa<ParenExpr>(E));
-
- ValueState::ExprBindingsTy::TreeTy* T = St->BlockExprBindings.SlimFind(E);
- return T ? T->getValue().second : UnknownVal();
+
+ switch (E->getStmtClass()) {
+ case Stmt::CharacterLiteralClass: {
+ CharacterLiteral* C = cast<CharacterLiteral>(E);
+ return NonLVal::MakeVal(ValMgr, C->getValue(), C->getType(),
+ C->getLoc());
+ }
+
+ case Stmt::IntegerLiteralClass: {
+ return NonLVal::MakeVal(ValMgr, cast<IntegerLiteral>(E));
+ }
+
+ default: {
+ ValueState::ExprBindingsTy::TreeTy* T = St->BlockExprBindings.SlimFind(E);
+ return T ? T->getValue().second : UnknownVal();
+ }
+ }
}
RVal ValueStateManager::GetLVal(ValueState St, Expr* E) {
More information about the cfe-commits
mailing list