File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
librustc_trans/trans/debuginfo Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ use dep_graph::{DepGraph, DepNode};
19
19
20
20
use middle:: cstore:: InlinedItem ;
21
21
use middle:: cstore:: InlinedItem as II ;
22
- use middle:: def_id:: DefId ;
22
+ use middle:: def_id:: { CRATE_DEF_INDEX , DefId } ;
23
23
24
24
use syntax:: abi:: Abi ;
25
25
use syntax:: ast:: { self , Name , NodeId , DUMMY_NODE_ID } ;
@@ -388,6 +388,15 @@ impl<'ast> Map<'ast> {
388
388
self . forest . krate ( )
389
389
}
390
390
391
+ /// Get the attributes on the krate. This is preferable to
392
+ /// invoking `krate.attrs` because it registers a tighter
393
+ /// dep-graph access.
394
+ pub fn krate_attrs ( & self ) -> & ' ast [ ast:: Attribute ] {
395
+ let crate_root_def_id = DefId :: local ( CRATE_DEF_INDEX ) ;
396
+ self . dep_graph . read ( DepNode :: Hir ( crate_root_def_id) ) ;
397
+ & self . forest . krate . attrs
398
+ }
399
+
391
400
/// Retrieve the Node corresponding to `id`, panicking if it cannot
392
401
/// be found.
393
402
pub fn get ( & self , id : NodeId ) -> Node < ' ast > {
Original file line number Diff line number Diff line change @@ -90,10 +90,7 @@ pub fn get_or_insert_gdb_debug_scripts_section_global(ccx: &CrateContext)
90
90
91
91
pub fn needs_gdb_debug_scripts_section ( ccx : & CrateContext ) -> bool {
92
92
let omit_gdb_pretty_printer_section =
93
- attr:: contains_name ( & ccx. tcx ( )
94
- . map
95
- . krate ( )
96
- . attrs ,
93
+ attr:: contains_name ( & ccx. tcx ( ) . map . krate_attrs ( ) ,
97
94
"omit_gdb_pretty_printer_section" ) ;
98
95
99
96
!omit_gdb_pretty_printer_section &&
You can’t perform that action at this time.
0 commit comments