mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add mangling support for partial specializations.
This commit is contained in:
@@ -55,7 +55,7 @@ static void mangleSubstitution(Mangler &M, Substitution Sub) {
|
||||
|
||||
void GenericSpecializationMangler::mangleSpecialization() {
|
||||
Mangler &M = getMangler();
|
||||
|
||||
// This is a full specialization.
|
||||
SILFunctionType *FTy = Function->getLoweredFunctionType();
|
||||
CanGenericSignature Sig = FTy->getGenericSignature();
|
||||
|
||||
@@ -73,6 +73,25 @@ void GenericSpecializationMangler::mangleSpecialization() {
|
||||
assert(idx == Subs.size() && "subs not parallel to dependent types");
|
||||
}
|
||||
|
||||
void PartialSpecializationMangler::mangleSpecialization() {
|
||||
Mangler &M = getMangler();
|
||||
// If the only change to the generic signature during specialization is
|
||||
// addition of new same-type requirements, which happens in case of a
|
||||
// full specialization, it would be enough to mangle only the substitutions.
|
||||
//
|
||||
// If the types of function arguments have not changed, but some new
|
||||
// conformances were added to the generic parameters, e.g. in case of
|
||||
// a pre-specialization, then it would be enough to mangle only the new
|
||||
// generic signature.
|
||||
//
|
||||
// If the types of function arguments have changed as a result of a partial
|
||||
// specialization, we need to mangle the entire new function type.
|
||||
|
||||
// This is a partial specialization.
|
||||
M.mangleType(SpecializedFnTy, 0);
|
||||
M.append("_");
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Function Signature Optimizations
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
Reference in New Issue
Block a user