|
26 | 26 | #include "swift/Basic/Platform.h" |
27 | 27 | #include "swift/Basic/SourceManager.h" |
28 | 28 | #include "swift/IRGen/Linking.h" |
29 | | -#include "swift/SIL/GenericSpecializationMangler.h" |
30 | 29 | #include "swift/SIL/SILModule.h" |
31 | 30 | #include "llvm/IR/DerivedTypes.h" |
32 | 31 | #include "llvm/ADT/SmallString.h" |
@@ -2938,34 +2937,20 @@ static bool tryEmitDeinitCall(IRGenFunction &IGF, |
2938 | 2937 | return true; |
2939 | 2938 | } |
2940 | 2939 |
|
2941 | | - auto deinitSILFn = deinitTable->getImplementation(); |
2942 | | - |
2943 | | - // Look for a specialization of deinit that we can call. |
2944 | | - auto substitutions = ty->getContextSubstitutionMap(); |
2945 | | - if (!substitutions.empty() && |
2946 | | - !substitutions.getRecursiveProperties().hasArchetype()) { |
2947 | | - Mangle::GenericSpecializationMangler mangler( |
2948 | | - deinitSILFn->getASTContext(), deinitSILFn, |
2949 | | - deinitSILFn->getSerializedKind()); |
2950 | | - |
2951 | | - auto specializedName = mangler.mangleReabstracted( |
2952 | | - substitutions, /*needAlternativeMangling=*/false); |
2953 | | - auto specializedFn = IGF.IGM.getSILModule().lookUpFunction(specializedName); |
2954 | | - if (specializedFn) |
2955 | | - deinitSILFn = specializedFn; |
2956 | | - } |
2957 | | - |
2958 | 2940 | // The deinit should take a single value parameter of the nominal type, either |
2959 | 2941 | // by @owned or indirect @in convention. |
2960 | | - auto deinitFn = IGF.IGM.getAddrOfSILFunction(deinitSILFn, NotForDefinition); |
2961 | | - auto deinitTy = deinitSILFn->getLoweredFunctionType(); |
| 2942 | + auto deinitFn = IGF.IGM.getAddrOfSILFunction(deinitTable->getImplementation(), |
| 2943 | + NotForDefinition); |
| 2944 | + auto deinitTy = deinitTable->getImplementation()->getLoweredFunctionType(); |
2962 | 2945 | auto deinitFP = FunctionPointer::forDirect(IGF.IGM, deinitFn, |
2963 | 2946 | nullptr, deinitTy); |
2964 | 2947 | assert(deinitTy->getNumParameters() == 1 |
2965 | 2948 | && deinitTy->getNumResults() == 0 |
2966 | 2949 | && !deinitTy->hasError() |
2967 | 2950 | && "deinit should have only one parameter"); |
2968 | 2951 |
|
| 2952 | + auto substitutions = ty->getContextSubstitutionMap(); |
| 2953 | + |
2969 | 2954 | CalleeInfo info(deinitTy, |
2970 | 2955 | deinitTy->substGenericArgs(IGF.getSILModule(), |
2971 | 2956 | substitutions, |
|
0 commit comments