[cfe-commits] r56492 - /cfe/trunk/include/clang/Analysis/FlowSensitive/DataflowSolver.h
Ted Kremenek
kremenek at apple.com
Tue Sep 23 11:02:10 PDT 2008
Author: kremenek
Date: Tue Sep 23 13:02:10 2008
New Revision: 56492
URL: http://llvm.org/viewvc/llvm-project?rev=56492&view=rev
Log:
Fix PR 2819: Compute dataflow values for all CFG blocks by not relying on having the "Exit" block being reachable by all (or any) of the blocks in the CFG.
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=56492&r1=56491&r2=56492&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/FlowSensitive/DataflowSolver.h (original)
+++ cfe/trunk/include/clang/Analysis/FlowSensitive/DataflowSolver.h Tue Sep 23 13:02:10 2008
@@ -187,7 +187,10 @@
/// SolveDataflowEquations - Perform the actual worklist algorithm
/// to compute dataflow values.
void SolveDataflowEquations(CFG& cfg, bool recordStmtValues) {
- EnqueueFirstBlock(cfg,AnalysisDirTag());
+ // Enqueue all blocks to ensure the dataflow values are computed
+ // for every block. Not all blocks are guaranteed to reach the exit block.
+ for (CFG::iterator I=cfg.begin(), E=cfg.end(); I!=E; ++I)
+ WorkList.enqueue(&*I);
while (!WorkList.isEmpty()) {
const CFGBlock* B = WorkList.dequeue();
@@ -195,14 +198,6 @@
ProcessBlock(B, recordStmtValues, AnalysisDirTag());
UpdateEdges(cfg,B,TF.getVal());
}
- }
-
- void EnqueueFirstBlock(const CFG& cfg, dataflow::forward_analysis_tag) {
- WorkList.enqueue(&cfg.getEntry());
- }
-
- void EnqueueFirstBlock(const CFG& cfg, dataflow::backward_analysis_tag) {
- WorkList.enqueue(&cfg.getExit());
}
void ResetValues(CFG& cfg, ValTy& V, const CFGBlock* B,
More information about the cfe-commits
mailing list