Skip to content

Commit 5b7d0f3

Browse files
committed
rustc_codegen_llvm: move NoReturn attribute to apply_attrs_llfn.
1 parent 95b9442 commit 5b7d0f3

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/librustc_codegen_llvm/abi.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,11 @@ impl<'tcx> FnAbiLlvmExt<'tcx> for FnAbi<'tcx, Ty<'tcx>> {
388388
}
389389

390390
fn apply_attrs_llfn(&self, cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value) {
391+
// FIXME(eddyb) can this also be applied to callsites?
392+
if self.ret.layout.abi.is_uninhabited() {
393+
llvm::Attribute::NoReturn.apply_llfn(llvm::AttributePlace::Function, llfn);
394+
}
395+
391396
let mut i = 0;
392397
let mut apply = |attrs: &ArgAttributes, ty: Option<&Type>| {
393398
attrs.apply_llfn(llvm::AttributePlace::Argument(i), llfn, ty);

src/librustc_codegen_llvm/declare.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,7 @@ impl DeclareMethods<'tcx> for CodegenCx<'ll, 'tcx> {
9898
debug!("declare_rust_fn(name={:?}, fn_abi={:?})", name, fn_abi);
9999

100100
let llfn = declare_raw_fn(self, name, fn_abi.llvm_cconv(), fn_abi.llvm_type(self));
101-
102-
// FIXME(eddyb) move into `FnAbi::apply_attrs_llfn`.
103-
if fn_abi.ret.layout.abi.is_uninhabited() {
104-
llvm::Attribute::NoReturn.apply_llfn(Function, llfn);
105-
}
106-
107101
fn_abi.apply_attrs_llfn(self, llfn);
108-
109102
llfn
110103
}
111104

0 commit comments

Comments
 (0)