mirror of
https://github.com/github/codeql.git
synced 2026-04-29 02:35:15 +02:00
Merge pull request #6464 from sashabu/sashabu/auto
C++: Expose trailing return type presence.
This commit is contained in:
2
cpp/change-notes/2021-08-10-has-trailing-return-type.md
Normal file
2
cpp/change-notes/2021-08-10-has-trailing-return-type.md
Normal file
@@ -0,0 +1,2 @@
|
||||
lgtm,codescanning
|
||||
* Added `Function.hasTrailingReturnType` predicate to check whether a function was declared with a trailing return type.
|
||||
@@ -151,6 +151,20 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
|
||||
*/
|
||||
predicate isNaked() { getAnAttribute().hasName("naked") }
|
||||
|
||||
/**
|
||||
* Holds if this function has a trailing return type.
|
||||
*
|
||||
* Note that this is true whether or not deduction took place. For example,
|
||||
* this holds for both `e` and `f`, but not `g` or `h`:
|
||||
* ```
|
||||
* auto e() -> int { return 0; }
|
||||
* auto f() -> auto { return 0; }
|
||||
* auto g() { return 0; }
|
||||
* int h() { return 0; }
|
||||
* ```
|
||||
*/
|
||||
predicate hasTrailingReturnType() { this.hasSpecifier("has_trailing_return_type") }
|
||||
|
||||
/** Gets the return type of this function. */
|
||||
Type getType() { function_return_type(underlyingElement(this), unresolveElement(result)) }
|
||||
|
||||
|
||||
@@ -97,6 +97,7 @@
|
||||
| file://:0:0:0:0 | forceinline |
|
||||
| file://:0:0:0:0 | fp_offset |
|
||||
| file://:0:0:0:0 | gp_offset |
|
||||
| file://:0:0:0:0 | has_trailing_return_type |
|
||||
| file://:0:0:0:0 | implicit_int |
|
||||
| file://:0:0:0:0 | inline |
|
||||
| file://:0:0:0:0 | int |
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
| file://:0:0:0:0 | forceinline |
|
||||
| file://:0:0:0:0 | fp_offset |
|
||||
| file://:0:0:0:0 | gp_offset |
|
||||
| file://:0:0:0:0 | has_trailing_return_type |
|
||||
| file://:0:0:0:0 | implicit_int |
|
||||
| file://:0:0:0:0 | initializer for <error> |
|
||||
| file://:0:0:0:0 | inline |
|
||||
|
||||
@@ -129,6 +129,7 @@
|
||||
| file://:0:0:0:0 | gp_offset |
|
||||
| file://:0:0:0:0 | grammar_helper_base & |
|
||||
| file://:0:0:0:0 | grammar_helper_base && |
|
||||
| file://:0:0:0:0 | has_trailing_return_type |
|
||||
| file://:0:0:0:0 | implicit_int |
|
||||
| file://:0:0:0:0 | inline |
|
||||
| file://:0:0:0:0 | int |
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
| file://:0:0:0:0 | forceinline | Other |
|
||||
| file://:0:0:0:0 | fp_offset | Other |
|
||||
| file://:0:0:0:0 | gp_offset | Other |
|
||||
| file://:0:0:0:0 | has_trailing_return_type | Other |
|
||||
| file://:0:0:0:0 | implicit_int | Other |
|
||||
| file://:0:0:0:0 | inline | Other |
|
||||
| file://:0:0:0:0 | int | Other |
|
||||
|
||||
Reference in New Issue
Block a user