Skip to content

Commit a5b9df2

Browse files
committed
CPP: Autoformat.
1 parent 9d15e67 commit a5b9df2

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

cpp/ql/src/Critical/LargeParameter.ql

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,32 @@
1010
* statistical
1111
* non-attributable
1212
*/
13+
1314
import cpp
1415
import semmle.code.cpp.dataflow.EscapesTree
1516

1617
from Function f, Parameter p, Type t, int size
17-
where f.getAParameter() = p
18-
and p.getType() = t
19-
and t.getSize() = size
20-
and size > 64
21-
and not t.getUnderlyingType() instanceof ArrayType
22-
and not f instanceof CopyAssignmentOperator
18+
where
19+
f.getAParameter() = p and
20+
p.getType() = t and
21+
t.getSize() = size and
22+
size > 64 and
23+
not t.getUnderlyingType() instanceof ArrayType and
24+
not f instanceof CopyAssignmentOperator and
2325
// exception: p is written to, which may mean the copy is intended
24-
and not p.getAnAccess().isAddressOfAccessNonConst()
25-
and not exists(Expr e |
26+
not p.getAnAccess().isAddressOfAccessNonConst() and
27+
not exists(Expr e |
2628
variableAccessedAsValue(p.getAnAccess(), e.getFullyConverted()) and
2729
(
28-
exists(Assignment an | an.getLValue() = e) or
29-
exists(CrementOperation co | co.getOperand() = e) or
30+
exists(Assignment an | an.getLValue() = e)
31+
or
32+
exists(CrementOperation co | co.getOperand() = e)
33+
or
3034
exists(FunctionCall fc | fc.getQualifier() = e and not fc.getTarget().hasSpecifier("const"))
3135
)
32-
)
36+
) and
3337
// if there's no block, we can't tell how the parameter is used
34-
and exists(f.getBlock())
35-
select
36-
p, "This parameter of type $@ is " + size.toString() + " bytes - consider passing a const pointer/reference instead.",
37-
t, t.toString()
38+
exists(f.getBlock())
39+
select p,
40+
"This parameter of type $@ is " + size.toString() +
41+
" bytes - consider passing a const pointer/reference instead.", t, t.toString()

0 commit comments

Comments
 (0)