[cfe-commits] r45991 - in /cfe/trunk: Analysis/GREngine.cpp include/clang/Analysis/PathSensitive/GREngine.h
Ted Kremenek
kremenek at apple.com
Mon Jan 14 16:24:09 PST 2008
Author: kremenek
Date: Mon Jan 14 18:24:08 2008
New Revision: 45991
URL: http://llvm.org/viewvc/llvm-project?rev=45991&view=rev
Log:
Removed implicit transitions to a "BlockExit" location; we now handle
the end of the block by processing empty blocks (at BlockEntrance) or
when we have just processed the last statement in a block (at PostStmt).
Modified:
cfe/trunk/Analysis/GREngine.cpp
cfe/trunk/include/clang/Analysis/PathSensitive/GREngine.h
Modified: cfe/trunk/Analysis/GREngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GREngine.cpp?rev=45991&r1=45990&r2=45991&view=diff
==============================================================================
--- cfe/trunk/Analysis/GREngine.cpp (original)
+++ cfe/trunk/Analysis/GREngine.cpp Mon Jan 14 18:24:08 2008
@@ -88,7 +88,7 @@
break;
case ProgramPoint::BlockExitKind:
- HandleBlockExit(cast<BlockExit>(Node->getLocation()), Node);
+ assert (false && "BlockExit location never occur in forward analysis.");
break;
case ProgramPoint::PostStmtKind:
@@ -127,10 +127,7 @@
// FIXME: we will dispatch to a function that
// manipulates the state at the entrance to a block.
- if (!Blk->empty())
- GenerateNode(BlockEntrance(Blk), Pred->State, Pred);
- else
- GenerateNode(BlockExit(Blk), Pred->State, Pred);
+ GenerateNode(BlockEntrance(Blk), Pred->State, Pred);
}
void GREngineImpl::HandleBlockEntrance(const BlockEntrance& L,
@@ -140,14 +137,12 @@
GRNodeBuilderImpl Builder(L.getBlock(), 0, Pred, this);
ProcessStmt(S, Builder);
}
- else
- GenerateNode(BlockExit(L.getBlock()), Pred->State, Pred);
+ else
+ HandleBlockExit(L.getBlock(), Pred);
}
-void GREngineImpl::HandleBlockExit(const BlockExit& L, ExplodedNodeImpl* Pred) {
-
- CFGBlock* B = L.getBlock();
+void GREngineImpl::HandleBlockExit(CFGBlock * B, ExplodedNodeImpl* Pred) {
if (Stmt* Terminator = B->getTerminator())
ProcessTerminator(Terminator, B, Pred);
@@ -164,12 +159,8 @@
assert (!B->empty());
- if (StmtIdx == B->size()) {
- // FIXME: This is essentially an epsilon-transition. Do we need it?
- // It does simplify the logic, and it is also another point
- // were we could introduce a dispatch to the client.
- GenerateNode(BlockExit(B), Pred->State, Pred);
- }
+ if (StmtIdx == B->size())
+ HandleBlockExit(B, Pred);
else {
GRNodeBuilderImpl Builder(B, StmtIdx, Pred, this);
ProcessStmt(L.getStmt(), Builder);
Modified: cfe/trunk/include/clang/Analysis/PathSensitive/GREngine.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/GREngine.h?rev=45991&r1=45990&r2=45991&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/GREngine.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/GREngine.h Mon Jan 14 18:24:08 2008
@@ -60,7 +60,7 @@
void HandleBlockEdge(const BlockEdge& E, ExplodedNodeImpl* Pred);
void HandleBlockEntrance(const BlockEntrance& E, ExplodedNodeImpl* Pred);
- void HandleBlockExit(const BlockExit& E, ExplodedNodeImpl* Pred);
+ void HandleBlockExit(CFGBlock* B, ExplodedNodeImpl* Pred);
void HandlePostStmt(const PostStmt& S, CFGBlock* B,
unsigned StmtIdx, ExplodedNodeImpl *Pred);
@@ -195,7 +195,9 @@
/// a DFS exploration of the exploded graph.
GREngine(CFG& Cfg)
: GREngineImpl(cfg, new GraphTy(), GRWorkList::MakeDFS()),
- Checker(static_cast<GraphTy*>(G.get())->getCheckerState()) {}
+ Checker(static_cast<GraphTy*>(G.get())->getCheckerState()) {
+ Checker->Initialize(cfg);
+ }
/// Construct a GREngine object to analyze the provided CFG and to
/// use the provided worklist object to execute the worklist algorithm.
More information about the cfe-commits
mailing list