Skip to content

Commit 953acc5

Browse files
pvdrzemilio
authored andcommitted
handle __attribute__((noreturn)) attribute
1 parent 2ffc8d8 commit 953acc5

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/ir/function.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ impl FunctionSig {
450450
}
451451
};
452452

453-
let (must_use, is_divergent) =
453+
let (must_use, mut is_divergent) =
454454
if ctx.options().enable_function_attribute_detection {
455455
let [must_use, no_return, no_return_cpp] = cursor.has_attrs(&[
456456
Attribute::MUST_USE,
@@ -462,6 +462,11 @@ impl FunctionSig {
462462
Default::default()
463463
};
464464

465+
// This looks easy to break but the clang parser keeps the type spelling clean even if
466+
// other attributes are added.
467+
is_divergent =
468+
is_divergent || ty.spelling().contains("__attribute__((noreturn))");
469+
465470
let is_method = kind == CXCursor_CXXMethod;
466471
let is_constructor = kind == CXCursor_Constructor;
467472
let is_destructor = kind == CXCursor_Destructor;

tests/expectations/tests/noreturn.rs

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)