diff options
| author | James Miller <james@aatch.net> | 2015-02-19 15:33:53 +0100 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-02-22 12:01:59 +0100 |
| commit | a0b7bad00e5134e26fea08d2e4691360c61e68f0 (patch) | |
| tree | 92e3d11805d5cda87901a99cd676baec113aba86 | |
| parent | 97c1711894ec3d8dfabe04f8e7218e86496b1ff9 (diff) | |
| download | rust-a0b7bad00e5134e26fea08d2e4691360c61e68f0.tar.gz rust-a0b7bad00e5134e26fea08d2e4691360c61e68f0.zip | |
remove the `exit_map` field, it is unnecessary.
(Factoring of aatch CFG code, Part 2.)
| -rw-r--r-- | src/librustc/middle/cfg/construct.rs | 13 | ||||
| -rw-r--r-- | src/librustc/middle/cfg/mod.rs | 2 |
2 files changed, 2 insertions, 13 deletions
diff --git a/src/librustc/middle/cfg/construct.rs b/src/librustc/middle/cfg/construct.rs index e8df9dfa1b1..4b06eecaffe 100644 --- a/src/librustc/middle/cfg/construct.rs +++ b/src/librustc/middle/cfg/construct.rs @@ -16,11 +16,9 @@ use middle::ty; use syntax::ast; use syntax::ast_util; use syntax::ptr::P; -use util::nodemap::NodeMap; struct CFGBuilder<'a, 'tcx: 'a> { tcx: &'a ty::ctxt<'tcx>, - exit_map: NodeMap<CFGIndex>, graph: CFGGraph, fn_exit: CFGIndex, loop_scopes: Vec<LoopScope>, @@ -46,7 +44,6 @@ pub fn construct(tcx: &ty::ctxt, let block_exit; let mut cfg_builder = CFGBuilder { - exit_map: NodeMap(), graph: graph, fn_exit: fn_exit, tcx: tcx, @@ -54,9 +51,8 @@ pub fn construct(tcx: &ty::ctxt, }; block_exit = cfg_builder.block(blk, entry); cfg_builder.add_contained_edge(block_exit, fn_exit); - let CFGBuilder {exit_map, graph, ..} = cfg_builder; - CFG {exit_map: exit_map, - graph: graph, + let CFGBuilder {graph, ..} = cfg_builder; + CFG {graph: graph, entry: entry, exit: fn_exit} } @@ -512,7 +508,6 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { } fn add_ast_node(&mut self, id: ast::NodeId, preds: &[CFGIndex]) -> CFGIndex { - assert!(!self.exit_map.contains_key(&id)); assert!(id != ast::DUMMY_NODE_ID); self.add_node(CFGNodeData::AST(id), preds) } @@ -523,10 +518,6 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { fn add_node(&mut self, data: CFGNodeData, preds: &[CFGIndex]) -> CFGIndex { let node = self.graph.add_node(data); - if let CFGNodeData::AST(id) = data { - assert!(!self.exit_map.contains_key(&id)); - self.exit_map.insert(id, node); - } for &pred in preds { self.add_contained_edge(pred, node); } diff --git a/src/librustc/middle/cfg/mod.rs b/src/librustc/middle/cfg/mod.rs index 71f6c738522..e8a99f59b1e 100644 --- a/src/librustc/middle/cfg/mod.rs +++ b/src/librustc/middle/cfg/mod.rs @@ -14,13 +14,11 @@ use middle::graph; use middle::ty; use syntax::ast; -use util::nodemap::NodeMap; mod construct; pub mod graphviz; pub struct CFG { - pub exit_map: NodeMap<CFGIndex>, pub graph: CFGGraph, pub entry: CFGIndex, pub exit: CFGIndex, |
