use the type name as the pass name

This commit is contained in:
Ariel Ben-Yehuda 2016-06-09 00:16:35 +03:00 committed by Ariel Ben-Yehuda
parent 065a264976
commit f5b1ba6e90
13 changed files with 12 additions and 27 deletions

View File

@ -28,6 +28,7 @@
#![feature(box_syntax)]
#![feature(collections)]
#![feature(const_fn)]
#![feature(core_intrinsics)]
#![feature(enumset)]
#![feature(iter_arith)]
#![feature(libc)]

View File

@ -76,7 +76,9 @@ pub trait Pass {
fn dep_node(&self, def_id: DefId) -> DepNode<DefId> {
DepNode::MirPass(def_id)
}
fn name(&self) -> &str;
fn name(&self) -> &str {
unsafe { ::std::intrinsics::type_name::<Self>() }
}
fn disambiguator<'a>(&'a self) -> Option<Box<fmt::Display+'a>> { None }
}

View File

@ -69,9 +69,7 @@ impl<'tcx> MirPass<'tcx> for ElaborateDrops {
}
}
impl Pass for ElaborateDrops {
fn name(&self) -> &str { "elaborate-drops" }
}
impl Pass for ElaborateDrops {}
struct InitializationData {
live: IdxSetBuf<MovePathIndex>,

View File

@ -1059,7 +1059,7 @@ pub fn phase_4_translate_to_llvm<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
passes.push_pass(box mir::transform::simplify_cfg::SimplifyCfg::new("elaborate-drops"));
passes.push_pass(box mir::transform::add_call_guards::AddCallGuards);
passes.push_pass(box mir::transform::dump_mir::Marker("pre-trans"));
passes.push_pass(box mir::transform::dump_mir::Marker("PreTrans"));
passes.run_passes(tcx, &mut mir_map);
});

View File

@ -82,6 +82,4 @@ impl<'tcx> MirPass<'tcx> for AddCallGuards {
}
}
impl Pass for AddCallGuards {
fn name(&self) -> &str { "add-call-guards" }
}
impl Pass for AddCallGuards {}

View File

@ -70,6 +70,4 @@ impl<'tcx> MirPassHook<'tcx> for DumpMir {
}
}
impl<'b> Pass for DumpMir {
fn name(&self) -> &str { "dump-mir" }
}
impl<'b> Pass for DumpMir {}

View File

@ -43,9 +43,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for EraseRegionsVisitor<'a, 'tcx> {
pub struct EraseRegions;
impl Pass for EraseRegions {
fn name(&self) -> &str { "erase-regions" }
}
impl Pass for EraseRegions {}
impl<'tcx> MirPass<'tcx> for EraseRegions {
fn run_pass<'a>(&mut self, tcx: TyCtxt<'a, 'tcx, 'tcx>,

View File

@ -50,6 +50,4 @@ impl<'tcx> MirPass<'tcx> for NoLandingPads {
}
}
impl Pass for NoLandingPads {
fn name(&self) -> &str { "no-landing-pads" }
}
impl Pass for NoLandingPads {}

View File

@ -906,9 +906,7 @@ fn qualify_const_item_cached<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
pub struct QualifyAndPromoteConstants;
impl Pass for QualifyAndPromoteConstants {
fn name(&self) -> &str { "qualify-consts" }
}
impl Pass for QualifyAndPromoteConstants {}
impl<'tcx> MirMapPass<'tcx> for QualifyAndPromoteConstants {
fn run_pass<'a>(&mut self,

View File

@ -57,7 +57,6 @@ impl<'l, 'tcx> MirPass<'tcx> for SimplifyBranches<'l> {
}
impl<'l> Pass for SimplifyBranches<'l> {
fn name(&self) -> &str { "simplify-branches" }
fn disambiguator<'a>(&'a self) -> Option<Box<fmt::Display+'a>> {
Some(Box::new(self.label))
}

View File

@ -59,7 +59,6 @@ impl<'l, 'tcx> MirPass<'tcx> for SimplifyCfg<'l> {
}
impl<'l> Pass for SimplifyCfg<'l> {
fn name(&self) -> &str { "simplify-cfg" }
fn disambiguator<'a>(&'a self) -> Option<Box<fmt::Display+'a>> {
Some(Box::new(self.label))
}

View File

@ -717,6 +717,4 @@ impl Pass for TypeckMir {
fn dep_node(&self, def_id: DefId) -> DepNode<DefId> {
DepNode::MirTypeck(def_id)
}
fn name(&self) -> &str { "typeck-mir" }
}

View File

@ -28,9 +28,7 @@ use rustc_plugin::Registry;
struct Pass;
impl transform::Pass for Pass {
fn name(&self) -> &str { "dummy-mir-pass" }
}
impl transform::Pass for Pass {}
impl<'tcx> MirPass<'tcx> for Pass {
fn run_pass<'a>(&mut self, _: TyCtxt<'a, 'tcx, 'tcx>,