diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-01-18 00:38:55 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-01-18 00:38:55 +0000 |
commit | 51f5499420e3e2344c1e6c3eff4764c4ec0b47ca (patch) | |
tree | 9262544f0f04933ca8d0974bc6f0f9f193c3ac3e | |
parent | 86946745225096243f6969dc745267b78fc211a6 (diff) |
Changed DataflowSolver to always associated recorded dataflow values with
the position *before* a statement, regardless of whether we are doing a
forward or backwards analysis.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46151 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Analysis/FlowSensitive/DataflowSolver.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/include/clang/Analysis/FlowSensitive/DataflowSolver.h b/include/clang/Analysis/FlowSensitive/DataflowSolver.h index 24ef6bb0ba..15f7107f26 100644 --- a/include/clang/Analysis/FlowSensitive/DataflowSolver.h +++ b/include/clang/Analysis/FlowSensitive/DataflowSolver.h @@ -235,10 +235,18 @@ private: /// ProcessBlock - Process the transfer functions for a given block. void ProcessBlock(const CFGBlock* B, bool recordStmtValues) { - for (StmtItr I=ItrTraits::StmtBegin(B), E=ItrTraits::StmtEnd(B); I!=E;++I) { - if (recordStmtValues) D.getStmtDataMap()[*I] = TF.getVal(); - TF.BlockStmt_Visit(const_cast<Stmt*>(*I)); - } + for (StmtItr I=ItrTraits::StmtBegin(B), E=ItrTraits::StmtEnd(B); I!=E;++I) + ProcessStmt(*I, recordStmtValues, AnalysisDirTag()); + } + + void ProcessStmt(const Stmt* S, bool record, dataflow::forward_analysis_tag) { + if (record) D.getStmtDataMap()[S] = TF.getVal(); + TF.BlockStmt_Visit(const_cast<Stmt*>(S)); + } + + void ProcessStmt(const Stmt* S, bool record, dataflow::backward_analysis_tag){ + TF.BlockStmt_Visit(const_cast<Stmt*>(S)); + if (record) D.getStmtDataMap()[S] = TF.getVal(); } /// UpdateEdges - After processing the transfer functions for a |