@@ -5,7 +5,6 @@ use rustc_codegen_ssa::mir::debuginfo::VariableKind::*;
55
66use self :: metadata:: { file_metadata, type_metadata, TypeMap } ;
77use self :: namespace:: mangled_name_of_instance;
8- use self :: source_loc:: InternalDebugLocation :: { self , UnknownLocation } ;
98use self :: type_names:: compute_debuginfo_type_name;
109use self :: utils:: { create_DIArray, is_node_local_to_unit, span_start, DIB } ;
1110
@@ -38,7 +37,7 @@ use std::ffi::CString;
3837use rustc:: ty:: layout:: { self , HasTyCtxt , LayoutOf , Size } ;
3938use rustc_codegen_ssa:: traits:: * ;
4039use rustc_span:: symbol:: Symbol ;
41- use rustc_span:: { self , BytePos , Pos , Span } ;
40+ use rustc_span:: { self , BytePos , Span } ;
4241use smallvec:: SmallVec ;
4342use syntax:: ast;
4443
@@ -148,20 +147,18 @@ impl DebugInfoBuilderMethods for Builder<'a, 'll, 'tcx> {
148147 // names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
149148 fn dbg_var_addr (
150149 & mut self ,
151- dbg_context : & FunctionDebugContext < & ' ll DIScope > ,
152150 dbg_var : & ' ll DIVariable ,
153151 scope_metadata : & ' ll DIScope ,
154152 variable_alloca : Self :: Value ,
155153 direct_offset : Size ,
156154 indirect_offsets : & [ Size ] ,
157155 span : Span ,
158156 ) {
159- assert ! ( !dbg_context. source_locations_enabled) ;
160157 let cx = self . cx ( ) ;
161158
162- let loc = span_start ( cx, span) ;
163-
164159 // 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.
165162 let op_deref = || unsafe { llvm:: LLVMRustDIBuilderCreateOpDeref ( ) } ;
166163 let op_plus_uconst = || unsafe { llvm:: LLVMRustDIBuilderCreateOpPlusUconst ( ) } ;
167164 let mut addr_ops = SmallVec :: < [ _ ; 8 ] > :: new ( ) ;
@@ -178,28 +175,22 @@ impl DebugInfoBuilderMethods for Builder<'a, 'll, 'tcx> {
178175 }
179176 }
180177
181- // FIXME(eddyb) maybe this information could be extracted from `var `,
178+ // FIXME(eddyb) maybe this information could be extracted from `dbg_var `,
182179 // 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) ;
187182 unsafe {
188- let debug_loc = llvm:: LLVMGetCurrentDebugLocation ( self . llbuilder ) ;
189183 // FIXME(eddyb) replace `llvm.dbg.declare` with `llvm.dbg.addr`.
190- let instr = llvm:: LLVMRustDIBuilderInsertDeclareAtEnd (
184+ llvm:: LLVMRustDIBuilderInsertDeclareAtEnd (
191185 DIB ( cx) ,
192186 variable_alloca,
193187 dbg_var,
194188 addr_ops. as_ptr ( ) ,
195189 addr_ops. len ( ) as c_uint ,
196- debug_loc ,
190+ dbg_loc ,
197191 self . llbb ( ) ,
198192 ) ;
199-
200- llvm:: LLVMSetInstDebugLocation ( self . llbuilder , instr) ;
201193 }
202- source_loc:: set_debug_location ( self , UnknownLocation ) ;
203194 }
204195
205196 fn set_source_location (
0 commit comments