Skip to content

Commit c6f16ed

Browse files
committed
Hide extended, unfinished debug information behind --xg compiler flag.
1 parent 8597077 commit c6f16ed

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

src/comp/driver/rustc.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,8 @@ fn build_session_options(match: getopts::match)
421421
let libcore = !opt_present(match, "no-core");
422422
let verify = !opt_present(match, "no-verify");
423423
let save_temps = opt_present(match, "save-temps");
424-
let debuginfo = opt_present(match, "g");
424+
let extra_debuginfo = opt_present(match, "xg");
425+
let debuginfo = opt_present(match, "g") || extra_debuginfo;
425426
let stats = opt_present(match, "stats");
426427
let time_passes = opt_present(match, "time-passes");
427428
let time_llvm_passes = opt_present(match, "time-llvm-passes");
@@ -468,6 +469,7 @@ fn build_session_options(match: getopts::match)
468469
libcore: libcore,
469470
optimize: opt_level,
470471
debuginfo: debuginfo,
472+
extra_debuginfo: extra_debuginfo,
471473
verify: verify,
472474
save_temps: save_temps,
473475
stats: stats,
@@ -516,7 +518,7 @@ fn opts() -> [getopts::opt] {
516518
optflag("emit-llvm"), optflagopt("pretty"),
517519
optflag("ls"), optflag("parse-only"), optflag("no-trans"),
518520
optflag("O"), optopt("opt-level"), optmulti("L"), optflag("S"),
519-
optopt("o"), optopt("out-dir"),
521+
optopt("o"), optopt("out-dir"), optflag("xg"),
520522
optflag("c"), optflag("g"), optflag("save-temps"),
521523
optopt("sysroot"), optopt("target"), optflag("stats"),
522524
optflag("time-passes"), optflag("time-llvm-passes"),

src/comp/driver/session.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ type options =
3131
libcore: bool,
3232
optimize: uint,
3333
debuginfo: bool,
34+
extra_debuginfo: bool,
3435
verify: bool,
3536
save_temps: bool,
3637
stats: bool,

src/comp/middle/debuginfo.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -782,9 +782,14 @@ fn create_function(fcx: @fn_ctxt, item: @ast::item, llfndecl: ValueRef)
782782
let ret_ty = alt item.node {
783783
ast::item_fn(f, _) { f.decl.output }
784784
};
785-
let ty_node = alt ret_ty.node {
786-
ast::ty_nil. { llnull() }
787-
_ { create_ty(cx, ty::node_id_to_type(ccx_tcx(cx), item.id), ret_ty).node }
785+
let ty_node = if cx.sess.get_opts().extra_debuginfo {
786+
alt ret_ty.node {
787+
ast::ty_nil. { llnull() }
788+
_ { create_ty(cx, ty::node_id_to_type(ccx_tcx(cx), item.id),
789+
ret_ty).node }
790+
}
791+
} else {
792+
llnull()
788793
};
789794
let sub_node = create_composite_type(SubroutineTag, "", file_node, 0, 0,
790795
0, 0, option::none,

src/comp/middle/trans.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4027,7 +4027,7 @@ fn trans_stmt(cx: @block_ctxt, s: ast::stmt) -> @block_ctxt {
40274027
} else {
40284028
bcx = init_ref_local(bcx, local);
40294029
}
4030-
if bcx_ccx(cx).sess.get_opts().debuginfo {
4030+
if bcx_ccx(cx).sess.get_opts().extra_debuginfo {
40314031
debuginfo::create_local_var(bcx, local);
40324032
}
40334033
}
@@ -4422,7 +4422,7 @@ fn create_llargs_for_fn_args(cx: @fn_ctxt, ty_self: self_arg,
44224422

44234423
fn copy_args_to_allocas(fcx: @fn_ctxt, bcx: @block_ctxt, args: [ast::arg],
44244424
arg_tys: [ty::arg]) -> @block_ctxt {
4425-
if fcx_ccx(fcx).sess.get_opts().debuginfo {
4425+
if fcx_ccx(fcx).sess.get_opts().extra_debuginfo {
44264426
llvm::LLVMAddAttribute(llvm::LLVMGetFirstParam(fcx.llfn),
44274427
lib::llvm::LLVMStructRetAttribute as
44284428
lib::llvm::llvm::Attribute);
@@ -4446,7 +4446,7 @@ fn copy_args_to_allocas(fcx: @fn_ctxt, bcx: @block_ctxt, args: [ast::arg],
44464446
}
44474447
ast::by_ref. {}
44484448
}
4449-
if fcx_ccx(fcx).sess.get_opts().debuginfo {
4449+
if fcx_ccx(fcx).sess.get_opts().extra_debuginfo {
44504450
debuginfo::create_arg(bcx, args[arg_n]);
44514451
}
44524452
arg_n += 1u;
@@ -4584,7 +4584,7 @@ fn trans_fn(cx: @local_ctxt, sp: span, f: ast::_fn, llfndecl: ValueRef,
45844584
let start = do_time ? time::get_time() : {sec: 0u32, usec: 0u32};
45854585
let fcx = option::none;
45864586
trans_closure(cx, sp, f, llfndecl, ty_self, ty_params, id, {|new_fcx| fcx = option::some(new_fcx);});
4587-
if cx.ccx.sess.get_opts().debuginfo {
4587+
if cx.ccx.sess.get_opts().extra_debuginfo {
45884588
let item = alt option::get(cx.ccx.ast_map.find(id)) {
45894589
ast_map::node_item(item) { item }
45904590
};
@@ -5654,7 +5654,7 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt,
56545654
let td = mk_target_data(sess.get_targ_cfg().target_strs.data_layout);
56555655
let tn = mk_type_names();
56565656
let intrinsics = declare_intrinsics(llmod);
5657-
if sess.get_opts().debuginfo {
5657+
if sess.get_opts().extra_debuginfo {
56585658
declare_dbg_intrinsics(llmod, intrinsics);
56595659
}
56605660
let int_type = T_int(targ_cfg);

0 commit comments

Comments
 (0)