Skip to content

Commit 26b5097

Browse files
committed
rustc_codegen_llvm: move NoReturn attribute to apply_attrs_llfn.
1 parent cc6486e commit 26b5097

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
@@ -389,6 +389,11 @@ impl<'tcx> FnAbiLlvmExt<'tcx> for FnAbi<'tcx, Ty<'tcx>> {
389389
}
390390

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