Skip to content

Commit 3700a63

Browse files
committed
C++: Performance fix for existsCompleteWithName
1 parent 45a3dcd commit 3700a63

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cpp/ql/src/semmle/code/cpp/internal/ResolveClass.qll

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ pragma[noinline]
1414
private predicate existsCompleteWithName(string name, @usertype d) {
1515
is_complete(d) and
1616
name = getTopLevelClassName(d) and
17-
strictcount(@usertype other | is_complete(other) and getTopLevelClassName(other) = name) = 1
17+
onlyOneCompleteClassExistsWithName(name)
18+
}
19+
20+
pragma[noinline]
21+
private predicate onlyOneCompleteClassExistsWithName(string name) {
22+
strictcount(@usertype c | is_complete(c) and getTopLevelClassName(c) = name) = 1
1823
}
1924

2025
/** Holds if `c` is an incomplete class named `name`. */

0 commit comments

Comments
 (0)