aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/GRCoreEngine.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-04-11 22:03:04 +0000
committerTed Kremenek <kremenek@apple.com>2008-04-11 22:03:04 +0000
commit11062b118476368fa5b294954713e5df97d8599f (patch)
tree870b50a4cdd64d4b0b0e41c43f667517bffa3937 /lib/Analysis/GRCoreEngine.cpp
parentb8873558cf16893989778095cff342ae2adbc56a (diff)
Added "GREndPathNodeBuilder", a new node builder that will be used for
evaluating transfer functions at the end-of-path. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49561 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/GRCoreEngine.cpp')
-rw-r--r--lib/Analysis/GRCoreEngine.cpp36
1 files changed, 27 insertions, 9 deletions
diff --git a/lib/Analysis/GRCoreEngine.cpp b/lib/Analysis/GRCoreEngine.cpp
index 53831ed06d..42c89270f9 100644
--- a/lib/Analysis/GRCoreEngine.cpp
+++ b/lib/Analysis/GRCoreEngine.cpp
@@ -124,16 +124,10 @@ void GRCoreEngineImpl::HandleBlockEdge(const BlockEdge& L,
assert (getCFG().getExit().size() == 0
&& "EXIT block cannot contain Stmts.");
- // Process the final state transition.
- void* State = ProcessEOP(Blk, Pred->State);
+ // Process the final state transition.
+ GREndPathNodeBuilderImpl Builder(Blk, Pred, this);
+ ProcessEndPath(Builder);
- bool IsNew;
- ExplodedNodeImpl* Node = G->getNodeImpl(BlockEntrance(Blk), State, &IsNew);
- Node->addPredecessor(Pred);
-
- // If the node was freshly created, mark it as an "End-Of-Path" node.
- if (IsNew) G->addEndOfPath(Node);
-
// This path is done. Don't enqueue any more nodes.
return;
}
@@ -442,3 +436,27 @@ GRSwitchNodeBuilderImpl::generateDefaultCaseNodeImpl(void* St, bool isSink) {
return NULL;
}
+
+GREndPathNodeBuilderImpl::~GREndPathNodeBuilderImpl() {
+ // Auto-generate an EOP node if one has not been generated.
+ if (!HasGeneratedNode) generateNodeImpl(Pred->State);
+}
+
+ExplodedNodeImpl* GREndPathNodeBuilderImpl::generateNodeImpl(void* State) {
+ HasGeneratedNode = true;
+
+ bool IsNew;
+
+ ExplodedNodeImpl* Node =
+ Eng.G->getNodeImpl(BlockEntrance(&B), Pred->State, &IsNew);
+
+
+ Node->addPredecessor(Pred);
+
+ if (IsNew) {
+ Node->markAsSink();
+ Eng.G->addEndOfPath(Node);
+ }
+
+ return Node;
+}