@@ -131,6 +131,13 @@ impl get_insn_ctxt for fn_ctxt {
131
131
}
132
132
}
133
133
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
+
134
141
pub fn log_fn_time ( ccx : @CrateContext , +name : ~str , start : time:: Timespec ,
135
142
end : time:: Timespec ) {
136
143
let elapsed = 1000 * ( ( end. sec - start. sec ) as int ) +
@@ -1158,7 +1165,8 @@ pub fn trans_stmt(cx: block, s: ast::stmt) -> block {
1158
1165
ast::decl_local(ref locals) => {
1159
1166
for locals.each |local| {
1160
1167
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) {
1162
1170
debuginfo::create_local_var(bcx, *local);
1163
1171
}
1164
1172
}
@@ -1738,7 +1746,7 @@ pub fn copy_args_to_allocas(fcx: fn_ctxt,
1738
1746
1739
1747
fcx.llargs.insert(arg_id, local_mem(llarg));
1740
1748
1741
- if fcx.ccx.sess.opts.extra_debuginfo {
1749
+ if fcx.ccx.sess.opts.extra_debuginfo && fcx_has_nonzero_span(fcx) {
1742
1750
debuginfo::create_arg(bcx, args[arg_n], args[arg_n].ty.span);
1743
1751
}
1744
1752
}
@@ -1861,7 +1869,8 @@ pub fn trans_fn(ccx: @CrateContext,
1861
1869
trans_closure(ccx, path, decl, body, llfndecl, ty_self,
1862
1870
param_substs, id, impl_id,
1863
1871
|fcx| {
1864
- if ccx.sess.opts.extra_debuginfo {
1872
+ if ccx.sess.opts.extra_debuginfo
1873
+ && fcx_has_nonzero_span(fcx) {
1865
1874
debuginfo::create_function(fcx);
1866
1875
}
1867
1876
},
0 commit comments