Skip to content

Commit 7a36639

Browse files
committed
C++: inline arithTypesMatch predicate
This predicate is effectively a Cartesian product between all enum types. It's infeasible to compute it in full, so luckily the optimizer has been able to apply enough magic to make it feasible. That's not a robust solution, and it has indeed broken on at least one version of the 1.24 release candidate. On a Chromium snapshot where I ran the LGTM suite overnight, the `m#MistypedFunctionArguments::arithTypesMatch#bb` predicate (magic for `arithTypesMatch`) took 170m5s. That was commit b69fdf5 from the internal repo. I tried to reproduce it in VSCode, this time with commit 646646, but it wasn't quite as bad: the predicate took only 38 seconds. In any case, making the problematic predicate `pragma[inline]` removes the slow magic and makes the `MistypedFunctionArguments.ql` query faster.
1 parent 9fae953 commit 7a36639

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

cpp/ql/src/Likely Bugs/Underspecified Functions/MistypedFunctionArguments.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import cpp
88

9+
pragma[inline]
910
private predicate arithTypesMatch(Type arg, Type parm) {
1011
arg = parm
1112
or

0 commit comments

Comments
 (0)