@@ -253,6 +253,7 @@ top_level_options!(
253
253
// Include the debug_assertions flag into dependency tracking, since it
254
254
// can influence whether overflow checks are done or not.
255
255
debug_assertions: bool [ TRACKED ] ,
256
+ debug_prefix_map: Option <( String , String ) > [ TRACKED ] ,
256
257
debuginfo: DebugInfoLevel [ TRACKED ] ,
257
258
lint_opts: Vec <( String , lint:: Level ) > [ TRACKED ] ,
258
259
lint_cap: Option <lint:: Level > [ TRACKED ] ,
@@ -445,6 +446,7 @@ pub fn basic_options() -> Options {
445
446
libs : Vec :: new ( ) ,
446
447
unstable_features : UnstableFeatures :: Disallow ,
447
448
debug_assertions : true ,
449
+ debug_prefix_map : None ,
448
450
actually_rustdoc : false ,
449
451
}
450
452
}
@@ -801,6 +803,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
801
803
"optimize with possible levels 0-3, s, or z" ) ,
802
804
debug_assertions: Option <bool > = ( None , parse_opt_bool, [ TRACKED ] ,
803
805
"explicitly enable the cfg(debug_assertions) directive" ) ,
806
+ debug_prefix_map: String = ( "" . to_string( ) , parse_string, [ TRACKED ] ,
807
+ "remap OLD to NEW in debug info (OLD=NEW)" ) ,
804
808
inline_threshold: Option <usize > = ( None , parse_opt_uint, [ TRACKED ] ,
805
809
"set the inlining threshold for" ) ,
806
810
panic: Option <PanicStrategy > = ( None , parse_panic_strategy,
@@ -1423,6 +1427,20 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
1423
1427
}
1424
1428
} ;
1425
1429
let debug_assertions = cg. debug_assertions . unwrap_or ( opt_level == OptLevel :: No ) ;
1430
+
1431
+ let debug_prefix_map = if !cg. debug_prefix_map . is_empty ( ) {
1432
+ let mut parts = cg. debug_prefix_map . splitn ( 2 , '=' ) ;
1433
+ let old = parts. next ( ) . unwrap ( ) ;
1434
+ let new = match parts. next ( ) {
1435
+ Some ( new) => new,
1436
+ None => early_error ( error_format,
1437
+ "-C debug-prefix-map value must be of the format `OLD=NEW`" ) ,
1438
+ } ;
1439
+ Some ( ( old. to_string ( ) , new. to_string ( ) ) )
1440
+ } else {
1441
+ None
1442
+ } ;
1443
+
1426
1444
let debuginfo = if matches. opt_present ( "g" ) {
1427
1445
if cg. debuginfo . is_some ( ) {
1428
1446
early_error ( error_format, "-g and -C debuginfo both provided" ) ;
@@ -1539,6 +1557,7 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
1539
1557
libs : libs,
1540
1558
unstable_features : UnstableFeatures :: from_environment ( ) ,
1541
1559
debug_assertions : debug_assertions,
1560
+ debug_prefix_map : debug_prefix_map,
1542
1561
actually_rustdoc : false ,
1543
1562
} ,
1544
1563
cfg)
@@ -1714,6 +1733,7 @@ mod dep_tracking {
1714
1733
impl_dep_tracking_hash_via_hash ! ( Option <bool >) ;
1715
1734
impl_dep_tracking_hash_via_hash ! ( Option <usize >) ;
1716
1735
impl_dep_tracking_hash_via_hash ! ( Option <String >) ;
1736
+ impl_dep_tracking_hash_via_hash ! ( Option <( String , String ) >) ;
1717
1737
impl_dep_tracking_hash_via_hash ! ( Option <PanicStrategy >) ;
1718
1738
impl_dep_tracking_hash_via_hash ! ( Option <lint:: Level >) ;
1719
1739
impl_dep_tracking_hash_via_hash ! ( Option <PathBuf >) ;
0 commit comments