Skip to content

debuginfo: Generate cross-crate unique type identifiers for debuginfo types #14819

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

Closed
Closed
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
1 change: 1 addition & 0 deletions src/librustc/lib/llvm.rs
Original file line number Diff line number Diff line change
@@ -1809,6 +1809,7 @@ pub mod llvm {
pub fn LLVMRustDestroyArchive(AR: ArchiveRef);

pub fn LLVMRustSetDLLExportStorageClass(V: ValueRef);
pub fn LLVMVersionMajor() -> c_int;
pub fn LLVMVersionMinor() -> c_int;

pub fn LLVMRustGetSectionName(SI: SectionIteratorRef,
815 changes: 672 additions & 143 deletions src/librustc/middle/trans/debuginfo.rs

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions src/rustllvm/RustWrapper.cpp
Original file line number Diff line number Diff line change
@@ -318,7 +318,7 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateStructType(
unwrapDI<DIArray>(Elements),
RunTimeLang,
unwrapDI<DIType>(VTableHolder)
#if LLVM_VERSION_MINOR >= 5
#if LLVM_VERSION_MINOR >= 4
,UniqueId
#endif
));
@@ -510,7 +510,7 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateUnionType(
Flags,
unwrapDI<DIArray>(Elements),
RunTimeLang
#if LLVM_VERSION_MINOR >= 5
#if LLVM_VERSION_MINOR >= 4
,UniqueId
#endif
));
@@ -734,6 +734,11 @@ LLVMVersionMinor() {
return LLVM_VERSION_MINOR;
}

extern "C" int
LLVMVersionMajor() {
return LLVM_VERSION_MAJOR;
}

// Note that the two following functions look quite similar to the
// LLVMGetSectionName function. Sadly, it appears that this function only
// returns a char* pointer, which isn't guaranteed to be null-terminated. The
26 changes: 26 additions & 0 deletions src/test/auxiliary/cross_crate_debuginfo_type_uniquing.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// no-prefer-dynamic
#![crate_type = "rlib"]
// compile-flags:-g

struct S1;

impl S1 {
fn f(&mut self) { }
}


struct S2;

impl S2 {
fn f(&mut self) { }
}
24 changes: 24 additions & 0 deletions src/test/debuginfo/cross-crate-type-uniquing.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// ignore-android: FIXME(#10381)

// aux-build:cross_crate_debuginfo_type_uniquing.rs
extern crate cross_crate_debuginfo_type_uniquing;

// no-prefer-dynamic
// compile-flags:-g -Zlto

pub struct C;
pub fn p() -> C {
C
}

fn main() { }