mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: Remove AbstractionPattern::transformType()
This commit is contained in:
@@ -499,91 +499,6 @@ AbstractionPattern::getObjCMethodFormalParamPattern(CanType inputType) const {
|
||||
method->parameters()[paramIndex]->getType().getTypePtr());
|
||||
}
|
||||
|
||||
AbstractionPattern AbstractionPattern::transformType(
|
||||
llvm::function_ref<CanType(CanType)> transform) const {
|
||||
switch (getKind()) {
|
||||
case Kind::Invalid:
|
||||
llvm_unreachable("querying invalid abstraction pattern!");
|
||||
case Kind::Tuple:
|
||||
return *this;
|
||||
case Kind::Opaque:
|
||||
return getOpaque();
|
||||
case Kind::PartialCurriedObjCMethodType:
|
||||
return getPartialCurriedObjCMethod(getGenericSignature(),
|
||||
transform(getType()), getObjCMethod(),
|
||||
getEncodedForeignErrorInfo());
|
||||
case Kind::CurriedObjCMethodType:
|
||||
return getCurriedObjCMethod(transform(getType()), getObjCMethod(),
|
||||
getEncodedForeignErrorInfo());
|
||||
case Kind::PartialCurriedCFunctionAsMethodType:
|
||||
return getPartialCurriedCFunctionAsMethod(getGenericSignature(),
|
||||
transform(getType()),
|
||||
getClangType(),
|
||||
getImportAsMemberStatus());
|
||||
case Kind::CurriedCFunctionAsMethodType:
|
||||
return getCurriedCFunctionAsMethod(transform(getType()), getClangType(),
|
||||
getImportAsMemberStatus());
|
||||
case Kind::CFunctionAsMethodType:
|
||||
return getCFunctionAsMethod(transform(getType()), getClangType(),
|
||||
getImportAsMemberStatus());
|
||||
case Kind::CFunctionAsMethodParamTupleType:
|
||||
return getCFunctionAsMethodParamTuple(getGenericSignature(),
|
||||
transform(getType()),
|
||||
getClangType(),
|
||||
getImportAsMemberStatus());
|
||||
case Kind::ObjCMethodType:
|
||||
return getObjCMethod(transform(getType()), getObjCMethod(),
|
||||
getEncodedForeignErrorInfo());
|
||||
case Kind::ClangType:
|
||||
return AbstractionPattern(getGenericSignature(),
|
||||
transform(getType()), getClangType());
|
||||
case Kind::Type:
|
||||
return AbstractionPattern(getGenericSignature(), transform(getType()));
|
||||
case Kind::Discard:
|
||||
return AbstractionPattern::getDiscard(getGenericSignature(),
|
||||
transform(getType()));
|
||||
case Kind::ObjCMethodParamTupleType:
|
||||
return getObjCMethodParamTuple(getGenericSignature(),
|
||||
transform(getType()), getObjCMethod(),
|
||||
getEncodedForeignErrorInfo());
|
||||
|
||||
// In both of the following cases, if the transform makes it no
|
||||
// longer a tuple type, we need to change kinds.
|
||||
case Kind::ClangFunctionParamTupleType: {
|
||||
auto newType = transform(getType());
|
||||
if (isa<TupleType>(newType)) {
|
||||
return getClangFunctionParamTuple(getGenericSignature(),
|
||||
newType, getClangType());
|
||||
} else {
|
||||
assert(getNumTupleElements() == 1);
|
||||
return AbstractionPattern(getGenericSignature(), newType,
|
||||
getClangFunctionParameterType(getClangType(), 0));
|
||||
}
|
||||
}
|
||||
case Kind::ObjCMethodFormalParamTupleType: {
|
||||
auto newType = transform(getType());
|
||||
if (isa<TupleType>(newType)) {
|
||||
return getObjCMethodFormalParamTuple(getGenericSignature(),
|
||||
newType, getObjCMethod(),
|
||||
getEncodedForeignErrorInfo());
|
||||
} else {
|
||||
assert(getNumTupleElements() == 1);
|
||||
return AbstractionPattern(getGenericSignature(), newType,
|
||||
getObjCMethod()->parameters()[0]->getType().getTypePtr());
|
||||
}
|
||||
}
|
||||
case Kind::CFunctionAsMethodFormalParamTupleType: {
|
||||
auto newType = transform(getType());
|
||||
if (isa<TupleType>(newType)) {
|
||||
return getCFunctionAsMethodFormalParamTuple(getGenericSignature(),
|
||||
newType, getClangType(),
|
||||
getImportAsMemberStatus());
|
||||
}
|
||||
}
|
||||
}
|
||||
llvm_unreachable("bad kind");
|
||||
}
|
||||
|
||||
AbstractionPattern AbstractionPattern::getWithoutSpecifierType() const {
|
||||
switch (getKind()) {
|
||||
case Kind::Invalid:
|
||||
|
||||
Reference in New Issue
Block a user