mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[sil-devirtualizer] Rename isClassWithUnboundGenericParameters and extend it to work with any nominal types
This commit is contained in:
@@ -102,11 +102,11 @@ static CanType bindSuperclass(CanType Superclass,
|
||||
|
||||
// Returns true if any generic types parameters of the class are
|
||||
// unbound.
|
||||
bool swift::isClassWithUnboundGenericParameters(SILType C, SILModule &M) {
|
||||
auto *CD = C.getClassOrBoundGenericClass();
|
||||
if (CD && CD->getGenericSignature()) {
|
||||
bool swift::isNominalTypeWithUnboundGenericParameters(SILType Ty, SILModule &M) {
|
||||
auto *ND = Ty.getNominalOrBoundGenericNominal();
|
||||
if (ND && ND->getGenericSignature()) {
|
||||
auto InstanceTypeSubsts =
|
||||
C.gatherAllSubstitutions(M);
|
||||
Ty.gatherAllSubstitutions(M);
|
||||
|
||||
if (!InstanceTypeSubsts.empty()) {
|
||||
if (hasUnboundGenericTypes(InstanceTypeSubsts))
|
||||
@@ -114,7 +114,7 @@ bool swift::isClassWithUnboundGenericParameters(SILType C, SILModule &M) {
|
||||
}
|
||||
}
|
||||
|
||||
if (C.hasArchetype())
|
||||
if (Ty.hasArchetype())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user