Skip to content

Commit 5083af2

Browse files
committed
Adapt code to latest rustc master changes
1 parent 677c3af commit 5083af2

File tree

3 files changed

+10
-68
lines changed

3 files changed

+10
-68
lines changed

src/librustc_codegen_llvm/debuginfo/metadata.rs

Lines changed: 1 addition & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,13 +2012,7 @@ pub fn create_vtable_metadata(
20122012
llvm::LLVMRustDIBuilderCreateStaticVariable(DIB(cx),
20132013
NO_SCOPE_METADATA,
20142014
name.as_ptr(),
2015-
// LLVM 3.9
2016-
// doesn't accept
2017-
// null here, so
2018-
// pass the name
2019-
// as the linkage
2020-
// name.
2021-
name.as_ptr(),
2015+
ptr::null(),
20222016
unknown_file_metadata(cx),
20232017
UNKNOWN_LINE_NUMBER,
20242018
vtable_type,
@@ -2044,62 +2038,3 @@ pub fn extend_scope_to_file(
20442038
file_metadata)
20452039
}
20462040
}
2047-
2048-
impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx, &'ll Value> {
2049-
2050-
/// Creates debug information for the given vtable, which is for the
2051-
/// given type.
2052-
///
2053-
/// Adds the created metadata nodes directly to the crate's IR.
2054-
fn create_vtable_metadata(
2055-
&self,
2056-
ty: ty::Ty<'tcx>,
2057-
vtable: &'ll Value,
2058-
) {
2059-
if self.dbg_cx.is_none() {
2060-
return;
2061-
}
2062-
2063-
let type_metadata = type_metadata(&self, ty, syntax_pos::DUMMY_SP);
2064-
2065-
unsafe {
2066-
// LLVMRustDIBuilderCreateStructType() wants an empty array. A null
2067-
// pointer will lead to hard to trace and debug LLVM assertions
2068-
// later on in llvm/lib/IR/Value.cpp.
2069-
let empty_array = create_DIArray(DIB(&self), &[]);
2070-
2071-
let name = const_cstr!("vtable");
2072-
2073-
// Create a new one each time. We don't want metadata caching
2074-
// here, because each vtable will refer to a unique containing
2075-
// type.
2076-
let vtable_type = llvm::LLVMRustDIBuilderCreateStructType(
2077-
DIB(&self),
2078-
NO_SCOPE_METADATA,
2079-
name.as_ptr(),
2080-
unknown_file_metadata(&self),
2081-
UNKNOWN_LINE_NUMBER,
2082-
Size::ZERO.bits(),
2083-
self.tcx.data_layout.pointer_align.abi_bits() as u32,
2084-
DIFlags::FlagArtificial,
2085-
None,
2086-
empty_array,
2087-
0,
2088-
Some(type_metadata),
2089-
name.as_ptr()
2090-
);
2091-
2092-
llvm::LLVMRustDIBuilderCreateStaticVariable(DIB(&self),
2093-
NO_SCOPE_METADATA,
2094-
name.as_ptr(),
2095-
ptr::null(),
2096-
unknown_file_metadata(&self),
2097-
UNKNOWN_LINE_NUMBER,
2098-
vtable_type,
2099-
true,
2100-
vtable,
2101-
None,
2102-
0);
2103-
}
2104-
}
2105-
}

src/librustc_codegen_llvm/debuginfo/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,13 +356,13 @@ impl<'ll, 'tcx: 'll> DebugInfoMethods<'ll, 'tcx> for CodegenCx<'ll, 'tcx, &'ll V
356356
let mut flags = DIFlags::FlagPrototyped;
357357

358358
let local_id = self.tcx().hir.as_local_node_id(def_id);
359-
if let Some((id, _, _)) = *cx.sess().entry_fn.borrow() {
359+
if let Some((id, _, _)) = *self.sess().entry_fn.borrow() {
360360
if local_id == Some(id) {
361361
flags |= DIFlags::FlagMainSubprogram;
362362
}
363363
}
364364

365-
if cx.layout_of(sig.output()).abi.is_uninhabited() {
365+
if self.layout_of(sig.output()).abi.is_uninhabited() {
366366
flags |= DIFlags::FlagNoReturn;
367367
}
368368

src/librustc_codegen_llvm/declare.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,13 @@ impl DeclareMethods<'ll, 'tcx> for CodegenCx<'ll, 'tcx, &'ll Value> {
141141
let sig = self.tcx.normalize_erasing_late_bound_regions(ty::ParamEnv::reveal_all(), &sig);
142142
debug!("declare_rust_fn (after region erasure) sig={:?}", sig);
143143

144+
let fty = FnType::new(self, sig, &[]);
145+
let llfn = declare_raw_fn(self, name, fty.llvm_cconv(), fty.llvm_type(self));
146+
147+
if self.layout_of(sig.output()).abi.is_uninhabited() {
148+
llvm::Attribute::NoReturn.apply_llfn(Function, llfn);
149+
}
150+
144151
if sig.abi != Abi::Rust && sig.abi != Abi::RustCall {
145152
attributes::unwind(llfn, false);
146153
}

0 commit comments

Comments
 (0)