Skip to content

Commit b89c564

Browse files
committed
Remove lambda checks on UnusedParameters.qll
This is because the first disjunct (`Function`) already includes the `Operator` created along `LambdaExpression`.
1 parent 058ccb4 commit b89c564

File tree

1 file changed

+8
-23
lines changed

1 file changed

+8
-23
lines changed

cpp/common/src/codingstandards/cpp/deadcode/UnusedParameters.qll

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,14 @@ import cpp
1212
*/
1313
class UsableParameter extends Parameter {
1414
UsableParameter() {
15-
(
16-
/* Regular Function */
17-
// Find the function associated with the parameter
18-
exists(Function f | this = f.getAParameter() |
19-
// Must have the definition of the function, not just the declaration
20-
f.hasDefinition() and
21-
// There must be a body block associated with the function, otherwise the parameter cannot
22-
// possibly be used
23-
exists(f.getBlock())
24-
)
25-
or
26-
/* Lambda Expression */
27-
// Find the function associated with the parameter
28-
exists(LambdaExpression lambda, Function f |
29-
this = lambda.getLambdaFunction().getParameter(_)
30-
|
31-
// Must have the definition of the function, not just the declaration
32-
lambda.getLambdaFunction() = f and
33-
f.hasDefinition() and
34-
// There must be a body block associated with the function, otherwise the parameter cannot
35-
// possibly be used
36-
exists(f.getBlock())
37-
)
15+
/* Regular Function */
16+
// Find the function associated with the parameter
17+
exists(Function f | this = f.getAParameter() |
18+
// Must have the definition of the function, not just the declaration
19+
f.hasDefinition() and
20+
// There must be a body block associated with the function, otherwise the parameter cannot
21+
// possibly be used
22+
exists(f.getBlock())
3823
) and
3924
// Must be a named parameter, because unnamed parameters cannot be referenced
4025
isNamed()

0 commit comments

Comments
 (0)