mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
C++: Also support the __noreturn__ attribute in exits
Observed this attribute while working on coding standards test regression when replacing Guards by IRGuards.
This commit is contained in:
@@ -52,12 +52,13 @@ class Options extends string {
|
||||
/**
|
||||
* Holds if a call to this function will never return.
|
||||
*
|
||||
* By default, this holds for `exit`, `_exit`, `abort`, `__assert_fail`,
|
||||
* `longjmp`, `__builtin_unreachable` and any function with a
|
||||
* `noreturn` attribute or specifier.
|
||||
* By default, this holds for `exit`, `_exit`, `_Exit`, `abort`,
|
||||
* `__assert_fail`, `longjmp`, `__builtin_unreachable` and any
|
||||
* function with a `noreturn` or `__noreturn__` attribute or
|
||||
* `noreturn` specifier.
|
||||
*/
|
||||
predicate exits(Function f) {
|
||||
f.getAnAttribute().hasName("noreturn")
|
||||
f.getAnAttribute().hasName(["noreturn", "__noreturn__"])
|
||||
or
|
||||
f.getASpecifier().hasName("noreturn")
|
||||
or
|
||||
|
||||
Reference in New Issue
Block a user