@@ -5,7 +5,6 @@ use rustc_codegen_ssa::mir::debuginfo::VariableKind::*;
5
5
6
6
use self :: metadata:: { file_metadata, type_metadata, TypeMap } ;
7
7
use self :: namespace:: mangled_name_of_instance;
8
- use self :: source_loc:: InternalDebugLocation :: { self , UnknownLocation } ;
9
8
use self :: type_names:: compute_debuginfo_type_name;
10
9
use self :: utils:: { create_DIArray, is_node_local_to_unit, span_start, DIB } ;
11
10
@@ -38,7 +37,7 @@ use std::ffi::CString;
38
37
use rustc:: ty:: layout:: { self , HasTyCtxt , LayoutOf , Size } ;
39
38
use rustc_codegen_ssa:: traits:: * ;
40
39
use rustc_span:: symbol:: Symbol ;
41
- use rustc_span:: { self , BytePos , Pos , Span } ;
40
+ use rustc_span:: { self , BytePos , Span } ;
42
41
use smallvec:: SmallVec ;
43
42
use syntax:: ast;
44
43
@@ -148,20 +147,18 @@ impl DebugInfoBuilderMethods for Builder<'a, 'll, 'tcx> {
148
147
// names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
149
148
fn dbg_var_addr (
150
149
& mut self ,
151
- dbg_context : & FunctionDebugContext < & ' ll DIScope > ,
152
150
dbg_var : & ' ll DIVariable ,
153
151
scope_metadata : & ' ll DIScope ,
154
152
variable_alloca : Self :: Value ,
155
153
direct_offset : Size ,
156
154
indirect_offsets : & [ Size ] ,
157
155
span : Span ,
158
156
) {
159
- assert ! ( !dbg_context. source_locations_enabled) ;
160
157
let cx = self . cx ( ) ;
161
158
162
- let loc = span_start ( cx, span) ;
163
-
164
159
// Convert the direct and indirect offsets to address ops.
160
+ // FIXME(eddyb) use `const`s instead of getting the values via FFI,
161
+ // the values should match the ones in the DWARF standard anyway.
165
162
let op_deref = || unsafe { llvm:: LLVMRustDIBuilderCreateOpDeref ( ) } ;
166
163
let op_plus_uconst = || unsafe { llvm:: LLVMRustDIBuilderCreateOpPlusUconst ( ) } ;
167
164
let mut addr_ops = SmallVec :: < [ _ ; 8 ] > :: new ( ) ;
@@ -178,28 +175,22 @@ impl DebugInfoBuilderMethods for Builder<'a, 'll, 'tcx> {
178
175
}
179
176
}
180
177
181
- // FIXME(eddyb) maybe this information could be extracted from `var `,
178
+ // FIXME(eddyb) maybe this information could be extracted from `dbg_var `,
182
179
// to avoid having to pass it down in both places?
183
- source_loc:: set_debug_location (
184
- self ,
185
- InternalDebugLocation :: new ( scope_metadata, loc. line , loc. col . to_usize ( ) ) ,
186
- ) ;
180
+ // NB: `var` doesn't seem to know about the column, so that's a limitation.
181
+ let dbg_loc = cx. create_debug_loc ( scope_metadata, span) ;
187
182
unsafe {
188
- let debug_loc = llvm:: LLVMGetCurrentDebugLocation ( self . llbuilder ) ;
189
183
// FIXME(eddyb) replace `llvm.dbg.declare` with `llvm.dbg.addr`.
190
- let instr = llvm:: LLVMRustDIBuilderInsertDeclareAtEnd (
184
+ llvm:: LLVMRustDIBuilderInsertDeclareAtEnd (
191
185
DIB ( cx) ,
192
186
variable_alloca,
193
187
dbg_var,
194
188
addr_ops. as_ptr ( ) ,
195
189
addr_ops. len ( ) as c_uint ,
196
- debug_loc ,
190
+ dbg_loc ,
197
191
self . llbb ( ) ,
198
192
) ;
199
-
200
- llvm:: LLVMSetInstDebugLocation ( self . llbuilder , instr) ;
201
193
}
202
- source_loc:: set_debug_location ( self , UnknownLocation ) ;
203
194
}
204
195
205
196
fn set_source_location (
0 commit comments