[cfe-commits] r48114 - in /cfe/trunk: Analysis/GRExprEngine.cpp include/clang/Analysis/PathSensitive/GRExprEngine.h
Ted Kremenek
kremenek at apple.com
Sun Mar 9 11:28:42 PDT 2008
Author: kremenek
Date: Sun Mar 9 13:28:41 2008
New Revision: 48114
URL: http://llvm.org/viewvc/llvm-project?rev=48114&view=rev
Log:
When processing the transfer function for a statement, evaluate
RemoveDeadBindings early because (1) it will always be called and (2) we can
dispatch to a plug-in transfer function that can evaluate the effect of dead
symbols (not yet added).
Modified:
cfe/trunk/Analysis/GRExprEngine.cpp
cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h
Modified: cfe/trunk/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRExprEngine.cpp?rev=48114&r1=48113&r2=48114&view=diff
==============================================================================
--- cfe/trunk/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/Analysis/GRExprEngine.cpp Sun Mar 9 13:28:41 2008
@@ -39,16 +39,6 @@
using llvm::cast;
using llvm::APSInt;
-ValueState* GRExprEngine::RemoveDeadBindings(ValueState* St) {
-
- if (StateCleaned || !CurrentStmt)
- return St;
-
- StateCleaned = true;
-
- return StateMgr.RemoveDeadBindings(St, CurrentStmt, Liveness);
-}
-
ValueState* GRExprEngine::getInitialState() {
@@ -420,7 +410,13 @@
StmtEntryNode = builder.getLastNode();
CurrentStmt = S;
NodeSet Dst;
- StateCleaned = false;
+
+ // Create the cleaned state.
+
+ RDBInState = StmtEntryNode->getState();
+ RDBOutState = StateMgr.RemoveDeadBindings(RDBInState, CurrentStmt, Liveness);
+
+ // Visit the statement.
Visit(S, StmtEntryNode, Dst);
@@ -428,10 +424,7 @@
// dead mappings removed.
if (Dst.size() == 1 && *Dst.begin() == StmtEntryNode) {
- ValueState* St =
- StateCleaned ? StmtEntryNode->getState() :
- RemoveDeadBindings(StmtEntryNode->getState());
-
+ ValueState* St = RemoveDeadBindings(StmtEntryNode->getState());
builder.generateNode(S, St, StmtEntryNode);
}
@@ -440,6 +433,8 @@
CurrentStmt = NULL;
StmtEntryNode = NULL;
Builder = NULL;
+ RDBInState = NULL;
+ RDBOutState = NULL;
}
void GRExprEngine::VisitDeclRefExpr(DeclRefExpr* D, NodeTy* Pred, NodeSet& Dst){
Modified: cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h?rev=48114&r1=48113&r2=48114&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h Sun Mar 9 13:28:41 2008
@@ -120,7 +120,8 @@
/// where a pass-by-value argument has an undefined value.
UndefArgsTy UndefArgs;
- bool StateCleaned;
+ ValueState* RDBInState;
+ ValueState* RDBOutState;
public:
GRExprEngine(GraphTy& g) :
@@ -265,7 +266,10 @@
/// that all subexpression mappings are removed and that any
/// block-level expressions that are not live at 'CurrentStmt' also have
/// their mappings removed.
- ValueState* RemoveDeadBindings(ValueState* St);
+ ValueState* RemoveDeadBindings(ValueState* St) {
+ assert (St);
+ return St == RDBInState ? RDBOutState : St;
+ }
ValueState* SetRVal(ValueState* St, Expr* Ex, RVal V);
More information about the cfe-commits
mailing list