Skip to content

Commit 1bd0c69

Browse files
authored
Merge pull request github#1831 from jbj/existsCompleteWithName-perf
C++: Performance fix for existsCompleteWithName
2 parents 45a3dcd + 3700a63 commit 1bd0c69

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)