Skip to content

Commit 2bae21c

Browse files
committed
C++: address review comments
1 parent f759550 commit 2bae21c

File tree

6 files changed

+18
-20
lines changed

6 files changed

+18
-20
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
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
2-
compatibility: backwards
1+
description: capture whether a lambda has an explicitly specified parameter list.
2+
compatibility: full
33
lambdas.rel: run lambdas.qlo

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,6 @@ class LambdaExpression extends Expr, @lambdaexpr {
5353
*/
5454
predicate hasParameterList() { lambdas(underlyingElement(this), _, _, true) }
5555

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-
6456
/**
6557
* Gets the function which will be invoked when the resulting object is called.
6658
*

cpp/ql/lib/upgrades/af887e83a815a9cefe774ffa80e2493a1365b9e2/lambdas.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ class LambdaExpr extends @lambdaexpr {
44

55
from LambdaExpr lambda, string default_capture, boolean has_explicit_return_type
66
where lambdas(lambda, default_capture, has_explicit_return_type)
7-
select lambda, default_capture, has_explicit_return_type, false
7+
select lambda, default_capture, has_explicit_return_type, true
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
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
1+
description: capture whether a lambda has an explicitly specified parameter list.
22
compatibility: backwards
33
lambdas.rel: run lambdas.qlo
Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
| parameters.cpp:8:5:8:20 | [...](...){...} |
2-
| parameters.cpp:10:5:10:26 | [...](...){...} |
3-
| parameters.cpp:13:5:13:20 | [...](...){...} |
4-
| parameters.cpp:16:5:18:5 | [...](...){...} |
5-
| parameters.cpp:25:5:25:14 | [...](...){...} |
1+
| parameters.cpp:2:5:2:23 | [...](...){...} | with list | 2 |
2+
| parameters.cpp:4:5:4:22 | [...](...){...} | with list | 1 |
3+
| parameters.cpp:6:5:6:17 | [...](...){...} | with list | 1 |
4+
| parameters.cpp:8:5:8:20 | [...](...){...} | with list | 0 |
5+
| parameters.cpp:10:5:10:26 | [...](...){...} | with list | 0 |
6+
| parameters.cpp:11:5:11:24 | [...](...){...} | without list | 0 |
7+
| parameters.cpp:13:5:13:20 | [...](...){...} | with list | 0 |
8+
| parameters.cpp:16:5:18:5 | [...](...){...} | with list | 0 |
9+
| parameters.cpp:20:5:22:5 | [...](...){...} | without list | 0 |
10+
| parameters.cpp:24:5:24:10 | [...](...){...} | without list | 0 |
11+
| parameters.cpp:25:5:25:14 | [...](...){...} | with list | 0 |
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import cpp
22

3-
from LambdaExpression e
4-
where e.emptyParameterListIsExplicit()
5-
select e
3+
from LambdaExpression e, string parameterList
4+
where if e.hasParameterList() then parameterList = "with list" else parameterList = "without list"
5+
select e, parameterList, e.getLambdaFunction().getNumberOfParameters()

0 commit comments

Comments
 (0)