Skip to content

Commit 1a7d0e9

Browse files
michaelwoeristeralexcrichton
authored andcommitted
---
yaml --- r: 110565 b: refs/heads/master c: 43e8ace h: refs/heads/master i: 110563: 75d3023 v: v3
1 parent bf8305c commit 1a7d0e9

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 5bcb76181a3b0df2df5ade348af3a1d29fca795e
2+
refs/heads/master: 43e8ace76b01820032679f276f3e298b92288ad6
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: e263ef1df7b892ed29e53313565eb05ab75e52f4
55
refs/heads/try: 597a645456b55e1c886ce15d23a192abdf4d55cf

trunk/src/librustc/middle/trans/debuginfo.rs

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -533,21 +533,26 @@ pub fn create_argument_metadata(bcx: &Block, arg: &ast::Arg) {
533533
pub fn set_source_location(fcx: &FunctionContext,
534534
node_id: ast::NodeId,
535535
span: Span) {
536-
if fn_should_be_ignored(fcx) {
537-
return;
538-
}
539-
540-
let cx = fcx.ccx;
536+
match fcx.debug_context {
537+
DebugInfoDisabled => return,
538+
FunctionWithoutDebugInfo => {
539+
set_debug_location(fcx.ccx, UnknownLocation);
540+
return;
541+
}
542+
FunctionDebugContext(~ref function_debug_context) => {
543+
let cx = fcx.ccx;
541544

542-
debug!("set_source_location: {}", cx.sess().codemap().span_to_str(span));
545+
debug!("set_source_location: {}", cx.sess().codemap().span_to_str(span));
543546

544-
if fcx.debug_context.get_ref(cx, span).source_locations_enabled.get() {
545-
let loc = span_start(cx, span);
546-
let scope = scope_metadata(fcx, node_id, span);
547+
if function_debug_context.source_locations_enabled.get() {
548+
let loc = span_start(cx, span);
549+
let scope = scope_metadata(fcx, node_id, span);
547550

548-
set_debug_location(cx, DebugLocation::new(scope, loc.line, loc.col.to_uint()));
549-
} else {
550-
set_debug_location(cx, UnknownLocation);
551+
set_debug_location(cx, DebugLocation::new(scope, loc.line, loc.col.to_uint()));
552+
} else {
553+
set_debug_location(cx, UnknownLocation);
554+
}
555+
}
551556
}
552557
}
553558

@@ -590,6 +595,10 @@ pub fn create_function_debug_context(cx: &CrateContext,
590595
return DebugInfoDisabled;
591596
}
592597

598+
// Clear the debug location so we don't assign them in the function prelude. Do this here
599+
// already, in case we do an early exit from this function.
600+
set_debug_location(cx, UnknownLocation);
601+
593602
if fn_ast_id == -1 {
594603
return FunctionWithoutDebugInfo;
595604
}
@@ -740,9 +749,6 @@ pub fn create_function_debug_context(cx: &CrateContext,
740749
fn_metadata,
741750
&mut *fn_debug_context.scope_map.borrow_mut());
742751

743-
// Clear the debug location so we don't assign them in the function prelude
744-
set_debug_location(cx, UnknownLocation);
745-
746752
return FunctionDebugContext(fn_debug_context);
747753

748754
fn get_function_signature(cx: &CrateContext,

0 commit comments

Comments
 (0)