mirror of
https://github.com/github/codeql.git
synced 2025-12-16 08:43:11 +01:00
C++: address review comments
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
description: add predicates `hasParameterList` and `emptyParameterListIsExplicit` to capture whether a lambda has an explicitly specified parameter list and whether that list is empty, respectively.Add commentMore actionsAdd commentMore actions
|
||||
compatibility: backwards
|
||||
description: capture whether a lambda has an explicitly specified parameter list.
|
||||
compatibility: full
|
||||
lambdas.rel: run lambdas.qlo
|
||||
|
||||
@@ -53,14 +53,6 @@ class LambdaExpression extends Expr, @lambdaexpr {
|
||||
*/
|
||||
predicate hasParameterList() { lambdas(underlyingElement(this), _, _, true) }
|
||||
|
||||
/**
|
||||
* Holds if the lambda has an empty parameter list
|
||||
*/
|
||||
predicate emptyParameterListIsExplicit() {
|
||||
this.hasParameterList() and
|
||||
this.getLambdaFunction().getNumberOfParameters() = 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the function which will be invoked when the resulting object is called.
|
||||
*
|
||||
|
||||
@@ -4,4 +4,4 @@ class LambdaExpr extends @lambdaexpr {
|
||||
|
||||
from LambdaExpr lambda, string default_capture, boolean has_explicit_return_type
|
||||
where lambdas(lambda, default_capture, has_explicit_return_type)
|
||||
select lambda, default_capture, has_explicit_return_type, false
|
||||
select lambda, default_capture, has_explicit_return_type, true
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
description: add predicates `hasParameterList` and `emptyParameterListIsExplicit` to capture whether a lambda has an explicitly specified parameter list and whether that list is empty, respectively.Add commentMore actionsAdd commentMore actions
|
||||
description: capture whether a lambda has an explicitly specified parameter list.
|
||||
compatibility: backwards
|
||||
lambdas.rel: run lambdas.qlo
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
| parameters.cpp:8:5:8:20 | [...](...){...} |
|
||||
| parameters.cpp:10:5:10:26 | [...](...){...} |
|
||||
| parameters.cpp:13:5:13:20 | [...](...){...} |
|
||||
| parameters.cpp:16:5:18:5 | [...](...){...} |
|
||||
| parameters.cpp:25:5:25:14 | [...](...){...} |
|
||||
| parameters.cpp:2:5:2:23 | [...](...){...} | with list | 2 |
|
||||
| parameters.cpp:4:5:4:22 | [...](...){...} | with list | 1 |
|
||||
| parameters.cpp:6:5:6:17 | [...](...){...} | with list | 1 |
|
||||
| parameters.cpp:8:5:8:20 | [...](...){...} | with list | 0 |
|
||||
| parameters.cpp:10:5:10:26 | [...](...){...} | with list | 0 |
|
||||
| parameters.cpp:11:5:11:24 | [...](...){...} | without list | 0 |
|
||||
| parameters.cpp:13:5:13:20 | [...](...){...} | with list | 0 |
|
||||
| parameters.cpp:16:5:18:5 | [...](...){...} | with list | 0 |
|
||||
| parameters.cpp:20:5:22:5 | [...](...){...} | without list | 0 |
|
||||
| parameters.cpp:24:5:24:10 | [...](...){...} | without list | 0 |
|
||||
| parameters.cpp:25:5:25:14 | [...](...){...} | with list | 0 |
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import cpp
|
||||
|
||||
from LambdaExpression e
|
||||
where e.emptyParameterListIsExplicit()
|
||||
select e
|
||||
from LambdaExpression e, string parameterList
|
||||
where if e.hasParameterList() then parameterList = "with list" else parameterList = "without list"
|
||||
select e, parameterList, e.getLambdaFunction().getNumberOfParameters()
|
||||
|
||||
Reference in New Issue
Block a user