[NFC] Remove the now-dead PackExpanded accessors from AbstractionPattern

This commit is contained in:
John McCall
2023-03-16 01:21:20 -04:00
parent 4499e3d055
commit f3e7daf478
2 changed files with 7 additions and 54 deletions

View File

@@ -1543,19 +1543,15 @@ public:
AbstractionPattern getObjCMethodAsyncCompletionHandlerType( AbstractionPattern getObjCMethodAsyncCompletionHandlerType(
CanType swiftCompletionHandlerType) const; CanType swiftCompletionHandlerType) const;
/// Given that this is a pack expansion, invoke the given callback for /// Given that this is a pack expansion, return the number of components
/// each component of the substituted expansion of this pattern. The /// that it should expand to. This, and the general correctness of
/// pattern will be for a pack expansion type over a contextual type if /// traversing variadically generic tuple and function types under
/// the substituted component is still a pack expansion. If there aren't /// substitution, relies on substitutions having been set properly
/// substitutions available, this will just invoke the callback with the /// on the abstraction pattern; without that, AbstractionPattern assumes
/// component. /// that every component expands to a single pack expansion component,
void forEachPackExpandedComponent( /// which will generally only work in specific situations.
llvm::function_ref<void(AbstractionPattern pattern)> fn) const;
size_t getNumPackExpandedComponents() const; size_t getNumPackExpandedComponents() const;
SmallVector<AbstractionPattern, 4> getPackExpandedComponents() const;
/// If this pattern refers to a foreign ObjC method that was imported as /// If this pattern refers to a foreign ObjC method that was imported as
/// async, return the bridged-back-to-ObjC completion handler type. /// async, return the bridged-back-to-ObjC completion handler type.
CanType getObjCMethodAsyncCompletionHandlerForeignType( CanType getObjCMethodAsyncCompletionHandlerForeignType(

View File

@@ -675,15 +675,6 @@ AbstractionPattern AbstractionPattern::getPackExpansionPatternType() const {
llvm_unreachable("bad kind"); llvm_unreachable("bad kind");
} }
SmallVector<AbstractionPattern, 4>
AbstractionPattern::getPackExpandedComponents() const {
SmallVector<AbstractionPattern, 4> result;
forEachPackExpandedComponent([&](AbstractionPattern pattern) {
result.push_back(pattern);
});
return result;
}
size_t AbstractionPattern::getNumPackExpandedComponents() const { size_t AbstractionPattern::getNumPackExpandedComponents() const {
assert(isPackExpansion()); assert(isPackExpansion());
assert(getKind() == Kind::Type || getKind() == Kind::Discard); assert(getKind() == Kind::Type || getKind() == Kind::Discard);
@@ -699,40 +690,6 @@ size_t AbstractionPattern::getNumPackExpandedComponents() const {
return substShape->getNumElements(); return substShape->getNumElements();
} }
void AbstractionPattern::forEachPackExpandedComponent(
llvm::function_ref<void (AbstractionPattern)> fn) const {
assert(isPackExpansion());
switch (getKind()) {
case Kind::Type:
case Kind::Discard: {
// If we don't have generic substitutions, just produce this pattern.
if (!GenericSubs) return fn(*this);
auto origExpansion = cast<PackExpansionType>(getType());
// Substitute the expansion shape.
auto substShape = cast<PackType>(
origExpansion.getCountType().subst(GenericSubs)->getCanonicalType());
// Call the callback with each component of the substituted shape.
for (auto substShapeElt : substShape.getElementTypes()) {
CanType origEltType = origExpansion.getPatternType();
if (auto substShapeEltExpansion =
dyn_cast<PackExpansionType>(substShapeElt)) {
origEltType = CanPackExpansionType::get(origEltType,
substShapeEltExpansion.getCountType());
}
fn(AbstractionPattern(GenericSubs, GenericSig, origEltType));
}
return;
}
default:
llvm_unreachable("not a pack expansion");
}
llvm_unreachable("bad kind");
}
AbstractionPattern AbstractionPattern::removingMoveOnlyWrapper() const { AbstractionPattern AbstractionPattern::removingMoveOnlyWrapper() const {
switch (getKind()) { switch (getKind()) {
case Kind::Invalid: case Kind::Invalid: