SILFunction *SILGenModule:: getOrCreateReabstractionThunk(CanSILFunctionType thunkType, CanSILFunctionType fromType, CanSILFunctionType toType, IsSerialized_t Serialized) { // The reference to the thunk is likely @noescape, but declarations are always // escaping. auto thunkDeclType = thunkType->getWithExtInfo(thunkType->getExtInfo().withNoEscape(false)); // Mangle the reabstraction thunk. // Substitute context parameters out of the "from" and "to" types. auto fromInterfaceType = fromType->mapTypeOutOfContext() ->getCanonicalType(); auto toInterfaceType = toType->mapTypeOutOfContext() ->getCanonicalType(); Mangle::ASTMangler NewMangler; std::string name = NewMangler.mangleReabstractionThunkHelper(thunkType, fromInterfaceType, toInterfaceType, M.getSwiftModule()); auto loc = RegularLocation::getAutoGeneratedLocation(); return M.getOrCreateSharedFunction(loc, name, thunkDeclType, IsBare, IsTransparent, IsSerializable, ProfileCounter(), IsReabstractionThunk); }