diff options
author | Christian Poveda <christian.poveda@ferrous-systems.com> | 2022-09-01 16:11:05 -0500 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2022-09-22 20:25:33 -1000 |
commit | 953acc526a808dac53660cee79c68d15ac309a63 (patch) | |
tree | af64bc688dd7e74bcfb85fadd210bedb170641fb /src | |
parent | 2ffc8d8946a44f2a695a0c148ad24e7e0e9637d2 (diff) |
handle `__attribute__((noreturn))` attribute
Diffstat (limited to 'src')
-rw-r--r-- | src/ir/function.rs | 7 |
1 files changed, 6 insertions, 1 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; |