Commit 3779a4c 1 parent a53bd20 commit 3779a4c Copy full SHA for 3779a4c
File tree 1 file changed +10
-4
lines changed
src/librustc_codegen_llvm/debuginfo
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -81,16 +81,22 @@ impl InternalDebugLocation {
81
81
82
82
pub fn set_debug_location ( bx : & Builder , debug_location : InternalDebugLocation ) {
83
83
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
+ } ;
87
93
debug ! ( "setting debug location to {} {}" , line, col) ;
88
94
89
95
unsafe {
90
96
llvm:: LLVMRustDIBuilderCreateDebugLocation (
91
97
debug_context ( bx. cx ) . llcontext ,
92
98
line as c_uint ,
93
- col as c_uint ,
99
+ col_used ,
94
100
scope,
95
101
ptr:: null_mut ( ) )
96
102
}
You can’t perform that action at this time.
0 commit comments