diff options
| author | est31 <MTest31@outlook.com> | 2018-07-02 11:40:32 +0200 |
|---|---|---|
| committer | est31 <MTest31@outlook.com> | 2018-07-02 12:16:05 +0200 |
| commit | 3779a4cb74d567153557036c4d86266bc8df196a (patch) | |
| tree | e2b2b3e0905de530008516d0b570236ed6be79e0 | |
| parent | a53bd20fae43cb35d394d7823aacdf52ccbd19cb (diff) | |
| download | rust-3779a4cb74d567153557036c4d86266bc8df196a.tar.gz rust-3779a4cb74d567153557036c4d86266bc8df196a.zip | |
Emit column info in debuginfo for non msvc like targets
| -rw-r--r-- | src/librustc_codegen_llvm/debuginfo/source_loc.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/librustc_codegen_llvm/debuginfo/source_loc.rs b/src/librustc_codegen_llvm/debuginfo/source_loc.rs index eb37e7f931c..958d09413ed 100644 --- a/src/librustc_codegen_llvm/debuginfo/source_loc.rs +++ b/src/librustc_codegen_llvm/debuginfo/source_loc.rs @@ -81,16 +81,22 @@ impl InternalDebugLocation { pub fn set_debug_location(bx: &Builder, debug_location: InternalDebugLocation) { let metadata_node = match debug_location { - KnownLocation { scope, line, .. } => { - // Always set the column to zero like Clang and GCC - let col = UNKNOWN_COLUMN_NUMBER; + KnownLocation { scope, line, col } => { + // For MSVC, set the column number to zero. + // Otherwise, emit it. This mimics clang behaviour. + // See discussion in https://github.com/rust-lang/rust/issues/42921 + let col_used = if bx.cx.sess().target.target.options.is_like_msvc { + UNKNOWN_COLUMN_NUMBER + } else { + col as c_uint + }; debug!("setting debug location to {} {}", line, col); unsafe { llvm::LLVMRustDIBuilderCreateDebugLocation( debug_context(bx.cx).llcontext, line as c_uint, - col as c_uint, + col_used, scope, ptr::null_mut()) } |
