make asm_comments something that you opt in to

This commit is contained in:
Niko Matsakis 2013-05-04 14:29:08 -04:00
parent bf2d3c71e3
commit ccf2f7b979
7 changed files with 8 additions and 14 deletions

View File

@ -600,11 +600,6 @@ pub fn build_session_options(binary: @~str,
let target_opt = getopts::opt_maybe_str(matches, ~"target");
let target_feature_opt = getopts::opt_maybe_str(matches, ~"target-feature");
let save_temps = getopts::opt_present(matches, ~"save-temps");
match output_type {
// unless we're emitting huamn-readable assembly, omit comments.
link::output_type_llvm_assembly | link::output_type_assembly => (),
_ => debugging_opts |= session::no_asm_comments
}
let opt_level = {
if (debugging_opts & session::no_opt) != 0 {
No

View File

@ -45,7 +45,7 @@ pub static time_passes: uint = 1 << 1;
pub static count_llvm_insns: uint = 1 << 2;
pub static time_llvm_passes: uint = 1 << 3;
pub static trans_stats: uint = 1 << 4;
pub static no_asm_comments: uint = 1 << 5;
pub static asm_comments: uint = 1 << 5;
pub static no_verify: uint = 1 << 6;
pub static trace: uint = 1 << 7;
pub static coherence: uint = 1 << 8;
@ -72,7 +72,7 @@ pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
(~"time-llvm-passes", ~"measure time of each LLVM pass",
time_llvm_passes),
(~"trans-stats", ~"gather trans statistics", trans_stats),
(~"no-asm-comments", ~"omit comments when using -S", no_asm_comments),
(~"asm-comments", ~"generate comments into the assembly (may change behavior)", asm_comments),
(~"no-verify", ~"skip LLVM verification", no_verify),
(~"trace", ~"emit trace logs", trace),
(~"coherence", ~"perform coherence checking", coherence),
@ -267,7 +267,7 @@ pub impl Session_ {
}
fn trans_stats(@self) -> bool { self.debugging_opt(trans_stats) }
fn meta_stats(@self) -> bool { self.debugging_opt(meta_stats) }
fn no_asm_comments(@self) -> bool { self.debugging_opt(no_asm_comments) }
fn asm_comments(@self) -> bool { self.debugging_opt(asm_comments) }
fn no_verify(@self) -> bool { self.debugging_opt(no_verify) }
fn trace(@self) -> bool { self.debugging_opt(trace) }
fn coherence(@self) -> bool { self.debugging_opt(coherence) }

View File

@ -374,7 +374,7 @@ pub impl<'self> CheckLoanCtxt<'self> {
}
}
mc::cat_deref(base, deref_count, mc::gc_ptr(ast::m_mutbl)) => {
mc::cat_deref(_, deref_count, mc::gc_ptr(ast::m_mutbl)) => {
// Dynamically check writes to `@mut`
let key = root_map_key {

View File

@ -378,7 +378,6 @@ pub impl mem_categorization_ctxt {
debug!("cat_expr: id=%d expr=%s",
expr.id, pprust::expr_to_str(expr, self.tcx.sess.intr()));
let tcx = self.tcx;
let expr_ty = self.expr_ty(expr);
match expr.node {
ast::expr_unary(ast::deref, e_base) => {

View File

@ -1133,7 +1133,7 @@ pub fn trans_stmt(cx: block, s: &ast::stmt) -> block {
let _icx = cx.insn_ctxt("trans_stmt");
debug!("trans_stmt(%s)", stmt_to_str(s, cx.tcx().sess.intr()));
if !cx.sess().no_asm_comments() {
if cx.sess().asm_comments() {
add_span_comment(cx, s.span, stmt_to_str(s, cx.ccx().sess.intr()));
}

View File

@ -846,7 +846,7 @@ pub fn _UndefReturn(cx: block, Fn: ValueRef) -> ValueRef {
pub fn add_span_comment(bcx: block, sp: span, text: &str) {
let ccx = bcx.ccx();
if !ccx.sess.no_asm_comments() {
if ccx.sess.asm_comments() {
let s = fmt!("%s (%s)", text, ccx.sess.codemap.span_to_str(sp));
debug!("%s", copy s);
add_comment(bcx, s);
@ -856,7 +856,7 @@ pub fn add_span_comment(bcx: block, sp: span, text: &str) {
pub fn add_comment(bcx: block, text: &str) {
unsafe {
let ccx = bcx.ccx();
if !ccx.sess.no_asm_comments() {
if ccx.sess.asm_comments() {
let sanitized = str::replace(text, ~"$", ~"");
let comment_text = ~"# " +
str::replace(sanitized, ~"\n", ~"\n\t# ");

View File

@ -224,7 +224,7 @@ pub fn store_environment(bcx: block,
for vec::eachi(bound_values) |i, bv| {
debug!("Copy %s into closure", bv.to_str(ccx));
if !ccx.sess.no_asm_comments() {
if ccx.sess.asm_comments() {
add_comment(bcx, fmt!("Copy %s into closure",
bv.to_str(ccx)));
}