Skip to content

Commit a0b7bad

Browse files
Aatchpnkfelix
authored andcommitted
remove the exit_map field, it is unnecessary.
(Factoring of aatch CFG code, Part 2.)
1 parent 97c1711 commit a0b7bad

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

src/librustc/middle/cfg/construct.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ use middle::ty;
1616
use syntax::ast;
1717
use syntax::ast_util;
1818
use syntax::ptr::P;
19-
use util::nodemap::NodeMap;
2019

2120
struct CFGBuilder<'a, 'tcx: 'a> {
2221
tcx: &'a ty::ctxt<'tcx>,
23-
exit_map: NodeMap<CFGIndex>,
2422
graph: CFGGraph,
2523
fn_exit: CFGIndex,
2624
loop_scopes: Vec<LoopScope>,
@@ -46,17 +44,15 @@ pub fn construct(tcx: &ty::ctxt,
4644
let block_exit;
4745

4846
let mut cfg_builder = CFGBuilder {
49-
exit_map: NodeMap(),
5047
graph: graph,
5148
fn_exit: fn_exit,
5249
tcx: tcx,
5350
loop_scopes: Vec::new()
5451
};
5552
block_exit = cfg_builder.block(blk, entry);
5653
cfg_builder.add_contained_edge(block_exit, fn_exit);
57-
let CFGBuilder {exit_map, graph, ..} = cfg_builder;
58-
CFG {exit_map: exit_map,
59-
graph: graph,
54+
let CFGBuilder {graph, ..} = cfg_builder;
55+
CFG {graph: graph,
6056
entry: entry,
6157
exit: fn_exit}
6258
}
@@ -512,7 +508,6 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
512508
}
513509

514510
fn add_ast_node(&mut self, id: ast::NodeId, preds: &[CFGIndex]) -> CFGIndex {
515-
assert!(!self.exit_map.contains_key(&id));
516511
assert!(id != ast::DUMMY_NODE_ID);
517512
self.add_node(CFGNodeData::AST(id), preds)
518513
}
@@ -523,10 +518,6 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
523518

524519
fn add_node(&mut self, data: CFGNodeData, preds: &[CFGIndex]) -> CFGIndex {
525520
let node = self.graph.add_node(data);
526-
if let CFGNodeData::AST(id) = data {
527-
assert!(!self.exit_map.contains_key(&id));
528-
self.exit_map.insert(id, node);
529-
}
530521
for &pred in preds {
531522
self.add_contained_edge(pred, node);
532523
}

src/librustc/middle/cfg/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@
1414
use middle::graph;
1515
use middle::ty;
1616
use syntax::ast;
17-
use util::nodemap::NodeMap;
1817

1918
mod construct;
2019
pub mod graphviz;
2120

2221
pub struct CFG {
23-
pub exit_map: NodeMap<CFGIndex>,
2422
pub graph: CFGGraph,
2523
pub entry: CFGIndex,
2624
pub exit: CFGIndex,

0 commit comments

Comments
 (0)