提交 e4e67bd4 编写于 作者: B Björn Steinbrink

Add an attribute to mark function as unwinding

上级 90c48bed
......@@ -59,7 +59,6 @@ pub fn emit_uwtable(val: ValueRef, emit: bool) {
/// Tell LLVM whether the function can or cannot unwind.
#[inline]
#[allow(dead_code)] // possibly useful function
pub fn unwind(val: ValueRef, can_unwind: bool) {
if can_unwind {
unsafe {
......@@ -118,6 +117,8 @@ pub fn from_fn_attrs(ccx: &CrateContext, attrs: &[hir::Attribute], llfn: ValueRe
}
} else if attr.check_name("allocator") {
llvm::Attribute::NoAlias.apply_llfn(llvm::ReturnIndex as c_uint, llfn);
} else if attr.check_name("unwind") {
unwind(llfn, true);
}
}
}
......
......@@ -188,6 +188,9 @@
// allow `extern "platform-intrinsic" { ... }`
("platform_intrinsics", "1.4.0", Some(27731), Active),
// allow `#[unwind]`
("unwind_attributes", "1.4.0", None, Active),
];
// (changing above list without updating src/doc/reference.md makes @cmr sad)
......@@ -316,6 +319,7 @@ enum Status {
("unsafe_no_drop_flag", Whitelisted, Gated("unsafe_no_drop_flag",
"unsafe_no_drop_flag has unstable semantics \
and may be removed in the future")),
("unwind", Whitelisted, Gated("unwind_attributes", "#[unwind] is experimental")),
// used in resolve
("prelude_import", Whitelisted, Gated("prelude_import",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册