Skip to content

Fix performance regression from Compatible.qll #890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add changes to join order and prevent cartesian product through rewrite
  • Loading branch information
MichaelRFairhurst committed Apr 25, 2025
commit 472c93a89b47f0b7c8492c6ea12edd7fe70e616a
18 changes: 14 additions & 4 deletions cpp/common/src/codingstandards/cpp/types/Compatible.qll
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ module TypesCompatibleConfig implements TypeEquivalenceSig {
or
// Enum types are compatible with one of char, int, or signed int, but the implementation
// decides.
[t1, t2] instanceof Enum and
([t1, t2] instanceof CharType or [t1, t2] instanceof IntType)
t1 instanceof Enum and
(t2 instanceof CharType or t2 instanceof IntType)
or
t2 instanceof Enum and
(t1 instanceof CharType or t1 instanceof IntType)
}

bindingset[t1, t2]
Expand Down Expand Up @@ -348,8 +351,15 @@ module FunctionDeclarationTypeEquivalence<TypeEquivalenceSig Config> {
predicate equalParameterTypes(FunctionDeclarationEntry f1, FunctionDeclarationEntry f2) {
f1.getDeclaration() = f2.getDeclaration() and
forall(int i | exists([f1, f2].getParameterDeclarationEntry(i)) |
TypeEquivalence<Config, FunctionSignatureType>::equalTypes(f1.getParameterDeclarationEntry(i)
.getType(), f2.getParameterDeclarationEntry(i).getType())
equalParameterTypesAt(f1, f2, pragma[only_bind_into](i))
)
}

predicate equalParameterTypesAt(FunctionDeclarationEntry f1, FunctionDeclarationEntry f2, int i) {
pragma[only_bind_out](f1.getDeclaration()) = pragma[only_bind_out](f2.getDeclaration()) and
TypeEquivalence<Config, FunctionSignatureType>::equalTypes(
f1.getParameterDeclarationEntry(i).getType(),
f2.getParameterDeclarationEntry(i).getType()
)
}
}
Expand Down
Loading