Skip to content

Commit 003847e

Browse files
committed
---
yaml --- r: 56029 b: refs/heads/auto c: 10d930d h: refs/heads/master i: 56027: 9daee33 v: v3
1 parent 1a71c0c commit 003847e

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: cf22d749eb9717e1e5befa727db5a9f7c47e8f48
17+
refs/heads/auto: 10d930d51ea6a00349c08b53ecf6ffb1ee514219
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/src/librustc/middle/trans/base.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,13 @@ impl get_insn_ctxt for fn_ctxt {
131131
}
132132
}
133133

134+
fn fcx_has_nonzero_span(fcx: fn_ctxt) -> bool {
135+
match fcx.span {
136+
None => true,
137+
Some(span) => *span.lo != 0 || *span.hi != 0
138+
}
139+
}
140+
134141
pub fn log_fn_time(ccx: @CrateContext, +name: ~str, start: time::Timespec,
135142
end: time::Timespec) {
136143
let elapsed = 1000 * ((end.sec - start.sec) as int) +
@@ -1158,7 +1165,8 @@ pub fn trans_stmt(cx: block, s: ast::stmt) -> block {
11581165
ast::decl_local(ref locals) => {
11591166
for locals.each |local| {
11601167
bcx = init_local(bcx, *local);
1161-
if cx.sess().opts.extra_debuginfo {
1168+
if cx.sess().opts.extra_debuginfo
1169+
&& fcx_has_nonzero_span(bcx.fcx) {
11621170
debuginfo::create_local_var(bcx, *local);
11631171
}
11641172
}
@@ -1738,7 +1746,7 @@ pub fn copy_args_to_allocas(fcx: fn_ctxt,
17381746
17391747
fcx.llargs.insert(arg_id, local_mem(llarg));
17401748
1741-
if fcx.ccx.sess.opts.extra_debuginfo {
1749+
if fcx.ccx.sess.opts.extra_debuginfo && fcx_has_nonzero_span(fcx) {
17421750
debuginfo::create_arg(bcx, args[arg_n], args[arg_n].ty.span);
17431751
}
17441752
}
@@ -1861,7 +1869,8 @@ pub fn trans_fn(ccx: @CrateContext,
18611869
trans_closure(ccx, path, decl, body, llfndecl, ty_self,
18621870
param_substs, id, impl_id,
18631871
|fcx| {
1864-
if ccx.sess.opts.extra_debuginfo {
1872+
if ccx.sess.opts.extra_debuginfo
1873+
&& fcx_has_nonzero_span(fcx) {
18651874
debuginfo::create_function(fcx);
18661875
}
18671876
},

branches/auto/src/librustc/middle/trans/debuginfo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ pub fn create_arg(bcx: block, arg: ast::arg, sp: span)
946946
}
947947
948948
pub fn update_source_pos(cx: block, s: span) {
949-
if !cx.sess().opts.debuginfo {
949+
if !cx.sess().opts.debuginfo || (*s.lo == 0 && *s.hi == 0) {
950950
return;
951951
}
952952
let cm = cx.sess().codemap;

0 commit comments

Comments
 (0)