Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit column info in debuginfo for non msvc like targets #51980

Merged
merged 1 commit into from
Jul 3, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/librustc_codegen_llvm/debuginfo/source_loc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down