do not stringify AST nodes unless emitting comments

This commit is contained in:
Niko Matsakis 2011-12-06 14:02:06 -08:00
parent 15d60326f6
commit aa99bfa170
2 changed files with 6 additions and 2 deletions

View File

@ -4536,7 +4536,9 @@ fn zero_alloca(cx: @block_ctxt, llptr: ValueRef, t: ty::t)
fn trans_stmt(cx: @block_ctxt, s: ast::stmt) -> @block_ctxt {
// FIXME Fill in cx.sp
add_span_comment(cx, s.span, stmt_to_str(s));
if (!bcx_ccx(cx).sess.get_opts().no_asm_comments) {
add_span_comment(cx, s.span, stmt_to_str(s));
}
let bcx = cx;
alt s.node {

View File

@ -515,7 +515,9 @@ fn add_span_comment(bcx: @block_ctxt, sp: span, text: str) {
fn add_comment(bcx: @block_ctxt, text: str) {
let ccx = bcx_ccx(bcx);
if (!ccx.sess.get_opts().no_asm_comments) {
let comment_text = "; " + text;
check str::is_not_empty("$");
let sanitized = str::replace(text, "$", "");
let comment_text = "; " + sanitized;
let asm = str::as_buf(comment_text, { |c|
str::as_buf("", { |e|
llvm::LLVMConstInlineAsm(T_fn([], T_void()), c, e, 0, 0)})});