Emit EndRegion statements when given -Z mir-emit-validate=N (for N > 0).

This way the miri test suite does not have to be updated to explcitly
request `-Z emit-end-regions`.
This commit is contained in:
Felix S. Klock II 2017-09-05 15:28:08 +02:00
parent c11f3e36c8
commit f2892ad281
3 changed files with 6 additions and 2 deletions

View File

@ -410,6 +410,10 @@ impl Session {
pub fn print_llvm_passes(&self) -> bool {
self.opts.debugging_opts.print_llvm_passes
}
pub fn emit_end_regions(&self) -> bool {
self.opts.debugging_opts.emit_end_regions ||
(self.opts.debugging_opts.mir_emit_validate > 0)
}
pub fn lto(&self) -> bool {
self.opts.cg.lto
}

View File

@ -50,7 +50,7 @@ impl<'tcx> CFG<'tcx> {
block: BasicBlock,
source_info: SourceInfo,
region_scope: region::Scope) {
if tcx.sess.opts.debugging_opts.emit_end_regions {
if tcx.sess.emit_end_regions() {
self.push(block, Statement {
source_info,
kind: StatementKind::EndRegion(region_scope),

View File

@ -42,7 +42,7 @@ impl MirPass for CleanEndRegions {
tcx: TyCtxt<'a, 'tcx, 'tcx>,
_source: MirSource,
mir: &mut Mir<'tcx>) {
if !tcx.sess.opts.debugging_opts.emit_end_regions { return; }
if !tcx.sess.emit_end_regions() { return; }
let mut gather = GatherBorrowedRegions {
seen_regions: FxHashSet()