Skip to content

Commit dcc7a63

Browse files
committed
C++: Simplify a bit and remove two noopts that don't seem to make a difference.
1 parent 5bf7e45 commit dcc7a63

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

cpp/ql/src/Likely Bugs/Format/WrongTypeFormatArguments.ql

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,35 +19,21 @@ import cpp
1919
* Holds if the argument corresponding to the `pos` conversion specifier
2020
* of `ffc` is expected to have type `expected`.
2121
*/
22-
pragma[noopt]
2322
private predicate formattingFunctionCallExpectedType(
2423
FormattingFunctionCall ffc, int pos, Type expected
2524
) {
26-
exists(FormattingFunction f, int i, FormatLiteral fl |
27-
ffc instanceof FormattingFunctionCall and
28-
ffc.getTarget() = f and
29-
f.getFormatParameterIndex() = i and
30-
ffc.getArgument(i) = fl and
31-
fl.getConversionType(pos) = expected
32-
)
25+
ffc.getFormat().(FormatLiteral).getConversionType(pos) = expected
3326
}
3427

3528
/**
3629
* Holds if the argument corresponding to the `pos` conversion specifier
3730
* of `ffc` could alternatively have type `expected`, for example on a different
3831
* platform.
3932
*/
40-
pragma[noopt]
4133
private predicate formattingFunctionCallAlternateType(
4234
FormattingFunctionCall ffc, int pos, Type expected
4335
) {
44-
exists(FormattingFunction f, int i, FormatLiteral fl |
45-
ffc instanceof FormattingFunctionCall and
46-
ffc.getTarget() = f and
47-
f.getFormatParameterIndex() = i and
48-
ffc.getArgument(i) = fl and
49-
fl.getConversionTypeAlternate(pos) = expected
50-
)
36+
ffc.getFormat().(FormatLiteral).getConversionTypeAlternate(pos) = expected
5137
}
5238

5339
/**

0 commit comments

Comments
 (0)