[cfe-commits] r76452 - /cfe/trunk/include/clang/Analysis/FlowSensitive/DataflowSolver.h
Ted Kremenek
kremenek at apple.com
Mon Jul 20 11:52:34 PDT 2009
Author: kremenek
Date: Mon Jul 20 13:52:34 2009
New Revision: 76452
URL: http://llvm.org/viewvc/llvm-project?rev=76452&view=rev
Log:
Update DataflowSolver to handle the case where a successor/predecessor block
could be NULL. This allows the solver to handle optimized CFGs where branches
can be determined during CFG-construction to be infeasible.
Modified:
cfe/trunk/include/clang/Analysis/FlowSensitive/DataflowSolver.h
Modified: cfe/trunk/include/clang/Analysis/FlowSensitive/DataflowSolver.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/FlowSensitive/DataflowSolver.h?rev=76452&r1=76451&r2=76452&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/FlowSensitive/DataflowSolver.h (original)
+++ cfe/trunk/include/clang/Analysis/FlowSensitive/DataflowSolver.h Mon Jul 20 13:52:34 2009
@@ -194,9 +194,9 @@
while (!WorkList.isEmpty()) {
const CFGBlock* B = WorkList.dequeue();
- ProcessMerge(cfg,B);
+ ProcessMerge(cfg, B);
ProcessBlock(B, recordStmtValues, AnalysisDirTag());
- UpdateEdges(cfg,B,TF.getVal());
+ UpdateEdges(cfg, B, TF.getVal());
}
}
@@ -211,16 +211,22 @@
bool firstMerge = true;
for (PrevBItr I=ItrTraits::PrevBegin(B),E=ItrTraits::PrevEnd(B); I!=E; ++I){
+
+ CFGBlock *PrevBlk = *I;
+
+ if (!PrevBlk)
+ continue;
typename EdgeDataMapTy::iterator EI =
- M.find(ItrTraits::PrevEdge(B, *I));
+ M.find(ItrTraits::PrevEdge(B, PrevBlk));
if (EI != M.end()) {
if (firstMerge) {
firstMerge = false;
V.copyValues(EI->second);
}
- else Merge(V,EI->second);
+ else
+ Merge(V, EI->second);
}
}
@@ -263,7 +269,8 @@
// forward/backward analysis respectively)
void UpdateEdges(CFG& cfg, const CFGBlock* B, ValTy& V) {
for (NextBItr I=ItrTraits::NextBegin(B), E=ItrTraits::NextEnd(B); I!=E; ++I)
- UpdateEdgeValue(ItrTraits::NextEdge(B, *I),V,*I);
+ if (CFGBlock *NextBlk = *I)
+ UpdateEdgeValue(ItrTraits::NextEdge(B, NextBlk),V, NextBlk);
}
/// UpdateEdgeValue - Update the value associated with a given edge.
More information about the cfe-commits
mailing list