Skip to content

Commit ec16b0b

Browse files
committed
C++: Add predicates for lambda parameter list
1 parent fcd0e67 commit ec16b0b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

cpp/ql/lib/semmle/code/cpp/exprs/Lambda.qll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,19 @@ class LambdaExpression extends Expr, @lambdaexpr {
4848
*/
4949
predicate returnTypeIsExplicit() { lambdas(underlyingElement(this), _, true, _) }
5050

51+
/**
52+
* Holds if the lambda has an explicitly specified parameter list, even when empty.
53+
*/
54+
predicate hasParameterList() { lambdas(underlyingElement(this), _, _, true) }
55+
56+
/**
57+
* Holds if the lambda has an empty parameter list
58+
*/
59+
predicate emptyParameterListIsExplicit() {
60+
this.hasParameterList() and
61+
this.getLambdaFunction().getNumberOfParameters() = 0
62+
}
63+
5164
/**
5265
* Gets the function which will be invoked when the resulting object is called.
5366
*

0 commit comments

Comments
 (0)