Skip to content
Permalink
Browse files

rustc_codegen_llvm: move NoReturn attribute to apply_attrs_llfn.

  • Loading branch information
eddyb committed Oct 29, 2019
1 parent 95b9442 commit 5b7d0f389f1ae4177f675a5ac535226ef92027a3
Showing with 5 additions and 7 deletions.
  1. +5 −0 src/librustc_codegen_llvm/abi.rs
  2. +0 −7 src/librustc_codegen_llvm/declare.rs
@@ -388,6 +388,11 @@ impl<'tcx> FnAbiLlvmExt<'tcx> for FnAbi<'tcx, Ty<'tcx>> {
}

fn apply_attrs_llfn(&self, cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value) {
// FIXME(eddyb) can this also be applied to callsites?
if self.ret.layout.abi.is_uninhabited() {
llvm::Attribute::NoReturn.apply_llfn(llvm::AttributePlace::Function, llfn);
}

let mut i = 0;
let mut apply = |attrs: &ArgAttributes, ty: Option<&Type>| {
attrs.apply_llfn(llvm::AttributePlace::Argument(i), llfn, ty);
@@ -98,14 +98,7 @@ impl DeclareMethods<'tcx> for CodegenCx<'ll, 'tcx> {
debug!("declare_rust_fn(name={:?}, fn_abi={:?})", name, fn_abi);

let llfn = declare_raw_fn(self, name, fn_abi.llvm_cconv(), fn_abi.llvm_type(self));

// FIXME(eddyb) move into `FnAbi::apply_attrs_llfn`.
if fn_abi.ret.layout.abi.is_uninhabited() {
llvm::Attribute::NoReturn.apply_llfn(Function, llfn);
}

fn_abi.apply_attrs_llfn(self, llfn);

llfn
}

0 comments on commit 5b7d0f3

Please sign in to comment.
You can’t perform that action at this time.