@@ -23,6 +23,7 @@ use llvm::{self, ValueRef};
2323use llvm:: debuginfo:: { DIType , DIFile , DIScope , DIDescriptor ,
2424 DICompositeType , DILexicalBlock , DIFlags } ;
2525
26+ use rustc:: hir:: TransFnAttrFlags ;
2627use rustc:: hir:: def:: CtorKind ;
2728use rustc:: hir:: def_id:: { DefId , CrateNum , LOCAL_CRATE } ;
2829use rustc:: ty:: fold:: TypeVisitor ;
@@ -41,7 +42,7 @@ use std::ffi::CString;
4142use std:: fmt:: Write ;
4243use std:: ptr;
4344use std:: path:: { Path , PathBuf } ;
44- use syntax:: { ast, attr } ;
45+ use syntax:: ast;
4546use syntax:: symbol:: { Interner , InternedString , Symbol } ;
4647use syntax_pos:: { self , Span , FileName } ;
4748
@@ -1644,11 +1645,17 @@ pub fn create_global_var_metadata(cx: &CodegenCx,
16441645 }
16451646
16461647 let tcx = cx. tcx ;
1647- let no_mangle = attr:: contains_name ( & tcx. get_attrs ( def_id) , "no_mangle" ) ;
1648+ let attrs = tcx. trans_fn_attrs ( def_id) ;
1649+
1650+ if attrs. flags . contains ( TransFnAttrFlags :: NO_DEBUG ) {
1651+ return ;
1652+ }
1653+
1654+ let no_mangle = attrs. flags . contains ( TransFnAttrFlags :: NO_MANGLE ) ;
16481655 // We may want to remove the namespace scope if we're in an extern block, see:
16491656 // https://github.com/rust-lang/rust/pull/46457#issuecomment-351750952
16501657 let var_scope = get_namespace_for_item ( cx, def_id) ;
1651- let span = cx . tcx . def_span ( def_id) ;
1658+ let span = tcx. def_span ( def_id) ;
16521659
16531660 let ( file_metadata, line_number) = if span != syntax_pos:: DUMMY_SP {
16541661 let loc = span_start ( cx, span) ;
0 commit comments