Skip to content

Commit e6c3ac8

Browse files
committed
IRGen: Remove usages of ArchetypeType::getParent()
1 parent 3f5ae71 commit e6c3ac8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/IRGen/GenArchetype.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ irgen::emitArchetypeTypeMetadataRef(IRGenFunction &IGF,
7979
}
8080

8181
#ifndef NDEBUG
82-
if (!archetype->getParent()) {
82+
if (archetype->isRoot()) {
8383
llvm::errs() << "Metadata for archetype not bound in function.\n"
8484
<< " The metadata could be missing entirely because it needs "
8585
"to be passed to the function.\n"
@@ -98,12 +98,12 @@ irgen::emitArchetypeTypeMetadataRef(IRGenFunction &IGF,
9898
}
9999
#endif
100100
// If there's no local or opaque metadata, it must be a nested type.
101-
assert(archetype->getParent() && "Not a nested archetype");
101+
auto *member = archetype->getInterfaceType()->castTo<DependentMemberType>();
102102

103-
CanArchetypeType parent(archetype->getParent());
104-
AssociatedType association(
105-
archetype->getInterfaceType()->castTo<DependentMemberType>()
106-
->getAssocType());
103+
auto parent = cast<ArchetypeType>(
104+
archetype->getGenericEnvironment()->mapTypeIntoContext(
105+
member->getBase())->getCanonicalType());
106+
AssociatedType association(member->getAssocType());
107107

108108
MetadataResponse response =
109109
emitAssociatedTypeMetadataRef(IGF, parent, association, request);

0 commit comments

Comments
 (0)