Move debug info check into create_function_debug_context
This commit is contained in:
parent
a445199afb
commit
0256f60461
@ -195,15 +195,6 @@ pub fn finalize(cx: &CrateContext) {
|
||||
};
|
||||
}
|
||||
|
||||
/// Creates a function-specific debug context for a function w/o debuginfo.
|
||||
pub fn empty_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>) -> FunctionDebugContext {
|
||||
if cx.sess().opts.debuginfo == NoDebugInfo {
|
||||
FunctionDebugContext::DebugInfoDisabled
|
||||
} else {
|
||||
FunctionDebugContext::FunctionWithoutDebugInfo
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates the function-specific debug context.
|
||||
///
|
||||
/// Returns the FunctionDebugContext for the function which holds state needed
|
||||
@ -220,6 +211,12 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
|
||||
return FunctionDebugContext::DebugInfoDisabled;
|
||||
}
|
||||
|
||||
for attr in cx.tcx().get_attrs(instance.def).iter() {
|
||||
if attr.check_name("no_debug") {
|
||||
return FunctionDebugContext::FunctionWithoutDebugInfo;
|
||||
}
|
||||
}
|
||||
|
||||
let containing_scope = get_containing_scope(cx, instance);
|
||||
let span = mir.span;
|
||||
|
||||
|
@ -199,22 +199,10 @@ pub fn trans_mir<'a, 'tcx: 'a>(
|
||||
sig: &ty::FnSig<'tcx>,
|
||||
abi: Abi,
|
||||
) {
|
||||
let def_id = instance.def;
|
||||
let local_id = fcx.ccx.tcx().map.as_local_node_id(def_id);
|
||||
let no_debug = if let Some(id) = local_id {
|
||||
fcx.ccx.tcx().map.attrs(id).iter().any(|item| item.check_name("no_debug"))
|
||||
} else {
|
||||
fcx.ccx.sess().cstore.item_attrs(def_id).iter().any(|item| item.check_name("no_debug"))
|
||||
};
|
||||
|
||||
let debug_context = if !no_debug {
|
||||
debuginfo::create_function_debug_context(fcx.ccx, instance, sig, abi, fcx.llfn, mir)
|
||||
} else {
|
||||
debuginfo::empty_function_debug_context(fcx.ccx)
|
||||
};
|
||||
let debug_context =
|
||||
debuginfo::create_function_debug_context(fcx.ccx, instance, sig, abi, fcx.llfn, mir);
|
||||
let bcx = fcx.get_entry_block();
|
||||
|
||||
// Analyze the temps to determine which must be lvalues
|
||||
let cleanup_kinds = analyze::cleanup_kinds(&mir);
|
||||
|
||||
// Allocate a `Block` for every basic block
|
||||
|
Loading…
Reference in New Issue
Block a user