Hide extended, unfinished debug information behind --xg compiler flag.

This commit is contained in:
Josh Matthews 2011-12-14 15:47:05 -05:00
parent 8597077b7a
commit c6f16ed2c4
4 changed files with 18 additions and 10 deletions

View File

@ -421,7 +421,8 @@ fn build_session_options(match: getopts::match)
let libcore = !opt_present(match, "no-core");
let verify = !opt_present(match, "no-verify");
let save_temps = opt_present(match, "save-temps");
let debuginfo = opt_present(match, "g");
let extra_debuginfo = opt_present(match, "xg");
let debuginfo = opt_present(match, "g") || extra_debuginfo;
let stats = opt_present(match, "stats");
let time_passes = opt_present(match, "time-passes");
let time_llvm_passes = opt_present(match, "time-llvm-passes");
@ -468,6 +469,7 @@ fn build_session_options(match: getopts::match)
libcore: libcore,
optimize: opt_level,
debuginfo: debuginfo,
extra_debuginfo: extra_debuginfo,
verify: verify,
save_temps: save_temps,
stats: stats,
@ -516,7 +518,7 @@ fn opts() -> [getopts::opt] {
optflag("emit-llvm"), optflagopt("pretty"),
optflag("ls"), optflag("parse-only"), optflag("no-trans"),
optflag("O"), optopt("opt-level"), optmulti("L"), optflag("S"),
optopt("o"), optopt("out-dir"),
optopt("o"), optopt("out-dir"), optflag("xg"),
optflag("c"), optflag("g"), optflag("save-temps"),
optopt("sysroot"), optopt("target"), optflag("stats"),
optflag("time-passes"), optflag("time-llvm-passes"),

View File

@ -31,6 +31,7 @@ type options =
libcore: bool,
optimize: uint,
debuginfo: bool,
extra_debuginfo: bool,
verify: bool,
save_temps: bool,
stats: bool,

View File

@ -782,9 +782,14 @@ fn create_function(fcx: @fn_ctxt, item: @ast::item, llfndecl: ValueRef)
let ret_ty = alt item.node {
ast::item_fn(f, _) { f.decl.output }
};
let ty_node = alt ret_ty.node {
ast::ty_nil. { llnull() }
_ { create_ty(cx, ty::node_id_to_type(ccx_tcx(cx), item.id), ret_ty).node }
let ty_node = if cx.sess.get_opts().extra_debuginfo {
alt ret_ty.node {
ast::ty_nil. { llnull() }
_ { create_ty(cx, ty::node_id_to_type(ccx_tcx(cx), item.id),
ret_ty).node }
}
} else {
llnull()
};
let sub_node = create_composite_type(SubroutineTag, "", file_node, 0, 0,
0, 0, option::none,

View File

@ -4027,7 +4027,7 @@ fn trans_stmt(cx: @block_ctxt, s: ast::stmt) -> @block_ctxt {
} else {
bcx = init_ref_local(bcx, local);
}
if bcx_ccx(cx).sess.get_opts().debuginfo {
if bcx_ccx(cx).sess.get_opts().extra_debuginfo {
debuginfo::create_local_var(bcx, local);
}
}
@ -4422,7 +4422,7 @@ fn create_llargs_for_fn_args(cx: @fn_ctxt, ty_self: self_arg,
fn copy_args_to_allocas(fcx: @fn_ctxt, bcx: @block_ctxt, args: [ast::arg],
arg_tys: [ty::arg]) -> @block_ctxt {
if fcx_ccx(fcx).sess.get_opts().debuginfo {
if fcx_ccx(fcx).sess.get_opts().extra_debuginfo {
llvm::LLVMAddAttribute(llvm::LLVMGetFirstParam(fcx.llfn),
lib::llvm::LLVMStructRetAttribute as
lib::llvm::llvm::Attribute);
@ -4446,7 +4446,7 @@ fn copy_args_to_allocas(fcx: @fn_ctxt, bcx: @block_ctxt, args: [ast::arg],
}
ast::by_ref. {}
}
if fcx_ccx(fcx).sess.get_opts().debuginfo {
if fcx_ccx(fcx).sess.get_opts().extra_debuginfo {
debuginfo::create_arg(bcx, args[arg_n]);
}
arg_n += 1u;
@ -4584,7 +4584,7 @@ fn trans_fn(cx: @local_ctxt, sp: span, f: ast::_fn, llfndecl: ValueRef,
let start = do_time ? time::get_time() : {sec: 0u32, usec: 0u32};
let fcx = option::none;
trans_closure(cx, sp, f, llfndecl, ty_self, ty_params, id, {|new_fcx| fcx = option::some(new_fcx);});
if cx.ccx.sess.get_opts().debuginfo {
if cx.ccx.sess.get_opts().extra_debuginfo {
let item = alt option::get(cx.ccx.ast_map.find(id)) {
ast_map::node_item(item) { item }
};
@ -5654,7 +5654,7 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt,
let td = mk_target_data(sess.get_targ_cfg().target_strs.data_layout);
let tn = mk_type_names();
let intrinsics = declare_intrinsics(llmod);
if sess.get_opts().debuginfo {
if sess.get_opts().extra_debuginfo {
declare_dbg_intrinsics(llmod, intrinsics);
}
let int_type = T_int(targ_cfg);