File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
src/librustc_codegen_llvm/debuginfo Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -81,16 +81,22 @@ impl InternalDebugLocation {
8181
8282pub fn set_debug_location ( bx : & Builder , debug_location : InternalDebugLocation ) {
8383 let metadata_node = match debug_location {
84- KnownLocation { scope, line, .. } => {
85- // Always set the column to zero like Clang and GCC
86- let col = UNKNOWN_COLUMN_NUMBER ;
84+ KnownLocation { scope, line, col } => {
85+ // For MSVC, set the column number to zero.
86+ // Otherwise, emit it. This mimics clang behaviour.
87+ // See discussion in https://github.com/rust-lang/rust/issues/42921
88+ let col_used = if bx. cx . sess ( ) . target . target . options . is_like_msvc {
89+ UNKNOWN_COLUMN_NUMBER
90+ } else {
91+ col as c_uint
92+ } ;
8793 debug ! ( "setting debug location to {} {}" , line, col) ;
8894
8995 unsafe {
9096 llvm:: LLVMRustDIBuilderCreateDebugLocation (
9197 debug_context ( bx. cx ) . llcontext ,
9298 line as c_uint ,
93- col as c_uint ,
99+ col_used ,
94100 scope,
95101 ptr:: null_mut ( ) )
96102 }
You can’t perform that action at this time.
0 commit comments