Skip to content

Commit

Permalink
Clean up attribute handling in create_function_debug_context().
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwoerister committed Apr 17, 2018
1 parent 6f9c36e commit 2814928
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/librustc_trans/debuginfo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ use self::source_loc::InternalDebugLocation::{self, UnknownLocation};
use llvm;
use llvm::{ModuleRef, ContextRef, ValueRef};
use llvm::debuginfo::{DIFile, DIType, DIScope, DIBuilderRef, DISubprogram, DIArray, DIFlags};
use rustc::hir::TransFnAttrFlags;
use rustc::hir::def_id::{DefId, CrateNum};
use rustc::ty::subst::Substs;

use abi::Abi;
use common::CodegenCx;
use builder::Builder;
use monomorphize::Instance;
use rustc::ty::{self, ParamEnv, Ty};
use rustc::ty::{self, ParamEnv, Ty, InstanceDef};
use rustc::mir;
use rustc::session::config::{self, FullDebugInfo, LimitedDebugInfo, NoDebugInfo};
use rustc::util::nodemap::{DefIdMap, FxHashMap, FxHashSet};
Expand Down Expand Up @@ -210,13 +211,12 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
return FunctionDebugContext::DebugInfoDisabled;
}

for attr in instance.def.attrs(cx.tcx).iter() {
if attr.check_name("no_debug") {
if let InstanceDef::Item(def_id) = instance.def {
if cx.tcx.trans_fn_attrs(def_id).flags.contains(TransFnAttrFlags::NO_DEBUG) {
return FunctionDebugContext::FunctionWithoutDebugInfo;
}
}

let containing_scope = get_containing_scope(cx, instance);
let span = mir.span;

// This can be the case for functions inlined from another crate
Expand All @@ -226,6 +226,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
}

let def_id = instance.def_id();
let containing_scope = get_containing_scope(cx, instance);
let loc = span_start(cx, span);
let file_metadata = file_metadata(cx, &loc.file.name, def_id.krate);

Expand Down

0 comments on commit 2814928

Please sign in to comment.