@@ -23,6 +23,7 @@ use llvm::{self, ValueRef};
23
23
use llvm:: debuginfo:: { DIType , DIFile , DIScope , DIDescriptor ,
24
24
DICompositeType , DILexicalBlock , DIFlags } ;
25
25
26
+ use rustc:: hir:: TransFnAttrFlags ;
26
27
use rustc:: hir:: def:: CtorKind ;
27
28
use rustc:: hir:: def_id:: { DefId , CrateNum , LOCAL_CRATE } ;
28
29
use rustc:: ty:: fold:: TypeVisitor ;
@@ -41,7 +42,7 @@ use std::ffi::CString;
41
42
use std:: fmt:: Write ;
42
43
use std:: ptr;
43
44
use std:: path:: { Path , PathBuf } ;
44
- use syntax:: { ast, attr } ;
45
+ use syntax:: ast;
45
46
use syntax:: symbol:: { Interner , InternedString , Symbol } ;
46
47
use syntax_pos:: { self , Span , FileName } ;
47
48
@@ -1644,11 +1645,17 @@ pub fn create_global_var_metadata(cx: &CodegenCx,
1644
1645
}
1645
1646
1646
1647
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 ) ;
1648
1655
// We may want to remove the namespace scope if we're in an extern block, see:
1649
1656
// https://github.com/rust-lang/rust/pull/46457#issuecomment-351750952
1650
1657
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) ;
1652
1659
1653
1660
let ( file_metadata, line_number) = if span != syntax_pos:: DUMMY_SP {
1654
1661
let loc = span_start ( cx, span) ;
0 commit comments