Skip to content

Commit 031f235

Browse files
committed
SILType: remove the now obsolete aggregateContainsRecord function
1 parent f9b524b commit 031f235

File tree

2 files changed

+0
-54
lines changed

2 files changed

+0
-54
lines changed

include/swift/SIL/SILType.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -786,10 +786,6 @@ class SILType {
786786
/// representation. Class existentials do not always qualify.
787787
bool isHeapObjectReferenceType() const;
788788

789-
/// Returns true if this SILType is an aggregate that contains \p Ty
790-
bool aggregateContainsRecord(SILType Ty, SILModule &SILMod,
791-
TypeExpansionContext context) const;
792-
793789
/// Returns true if this SILType is an aggregate with unreferenceable storage,
794790
/// meaning it cannot be fully destructured in SIL.
795791
bool aggregateHasUnreferenceableStorage() const;

lib/SIL/IR/SILType.cpp

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -477,56 +477,6 @@ bool SILType::isHeapObjectReferenceType() const {
477477
return false;
478478
}
479479

480-
bool SILType::aggregateContainsRecord(SILType Record, SILModule &Mod,
481-
TypeExpansionContext context) const {
482-
assert(!hasArchetype() && "Agg should be proven to not be generic "
483-
"before passed to this function.");
484-
assert(!Record.hasArchetype() && "Record should be proven to not be generic "
485-
"before passed to this function.");
486-
487-
llvm::SmallVector<SILType, 8> Worklist;
488-
Worklist.push_back(*this);
489-
490-
// For each "subrecord" of agg in the worklist...
491-
while (!Worklist.empty()) {
492-
SILType Ty = Worklist.pop_back_val();
493-
494-
// If it is record, we succeeded. Return true.
495-
if (Ty == Record)
496-
return true;
497-
498-
// Otherwise, we gather up sub-records that need to be checked for
499-
// checking... First handle the tuple case.
500-
if (CanTupleType TT = Ty.getAs<TupleType>()) {
501-
for (unsigned i = 0, e = TT->getNumElements(); i != e; ++i)
502-
Worklist.push_back(Ty.getTupleElementType(i));
503-
continue;
504-
}
505-
506-
// Then if we have an enum...
507-
if (EnumDecl *E = Ty.getEnumOrBoundGenericEnum()) {
508-
for (auto Elt : E->getAllElements())
509-
if (Elt->hasAssociatedValues())
510-
Worklist.push_back(Ty.getEnumElementType(Elt, Mod, context));
511-
continue;
512-
}
513-
514-
// Then if we have a struct address...
515-
if (StructDecl *S = Ty.getStructOrBoundGenericStruct())
516-
for (VarDecl *Var : S->getStoredProperties())
517-
Worklist.push_back(Ty.getFieldType(Var, Mod, context));
518-
519-
// If we have a class address, it is a pointer so it cannot contain other
520-
// types.
521-
522-
// If we reached this point, then this type has no subrecords. Since it does
523-
// not equal our record, we can skip it.
524-
}
525-
526-
// Could not find the record in the aggregate.
527-
return false;
528-
}
529-
530480
bool SILType::aggregateHasUnreferenceableStorage() const {
531481
if (auto s = getStructOrBoundGenericStruct()) {
532482
return s->hasUnreferenceableStorage();

0 commit comments

Comments
 (0)