summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ir/function.rs7
-rw-r--r--tests/expectations/tests/noreturn.rs2
2 files changed, 7 insertions, 2 deletions
diff --git a/src/ir/function.rs b/src/ir/function.rs
index a967954e..928b5aad 100644
--- a/src/ir/function.rs
+++ b/src/ir/function.rs
@@ -450,7 +450,7 @@ impl FunctionSig {
}
};
- let (must_use, is_divergent) =
+ let (must_use, mut is_divergent) =
if ctx.options().enable_function_attribute_detection {
let [must_use, no_return, no_return_cpp] = cursor.has_attrs(&[
Attribute::MUST_USE,
@@ -462,6 +462,11 @@ impl FunctionSig {
Default::default()
};
+ // This looks easy to break but the clang parser keeps the type spelling clean even if
+ // other attributes are added.
+ is_divergent =
+ is_divergent || ty.spelling().contains("__attribute__((noreturn))");
+
let is_method = kind == CXCursor_CXXMethod;
let is_constructor = kind == CXCursor_Constructor;
let is_destructor = kind == CXCursor_Destructor;
diff --git a/tests/expectations/tests/noreturn.rs b/tests/expectations/tests/noreturn.rs
index 1ffce9c0..19457495 100644
--- a/tests/expectations/tests/noreturn.rs
+++ b/tests/expectations/tests/noreturn.rs
@@ -11,7 +11,7 @@ extern "C" {
}
extern "C" {
#[link_name = "\u{1}_Z1gv"]
- pub fn g();
+ pub fn g() -> !;
}
extern "C" {
#[link_name = "\u{1}_Z1hv"]