};
}
-/// 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
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;
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