Further perf improvements

This commit is contained in:
Tony Torralba
2023-05-29 09:58:52 +02:00
parent 4dfc9b13cd
commit 6386ef3b96

View File

@@ -287,18 +287,23 @@ private string stubQualifier(RefType t) {
pragma[nomagic]
private predicate needsPackageNameHelper(RefType t, GeneratedTopLevel top, string name) {
t.getSourceDeclaration() = [getAReferencedType(top), top].getSourceDeclaration() and
t.getSourceDeclaration() =
pragma[only_bind_out]([getAReferencedType(top), top].getSourceDeclaration()) and
name = t.getName()
}
pragma[nomagic]
private predicate describesMultipleTypes(GeneratedTopLevel top, string name) {
2 <= strictcount(RefType t | needsPackageNameHelper(t, top, name))
}
/**
* Holds if `t` may clash with another type of the same name, so should be referred to using the fully qualified name
*/
private predicate needsPackageName(RefType t) {
exists(GeneratedTopLevel top, RefType other, string name |
exists(GeneratedTopLevel top, string name |
needsPackageNameHelper(t, top, name) and
needsPackageNameHelper(other, top, name) and
t != other
describesMultipleTypes(top, name)
)
}