@@ -1228,7 +1228,7 @@ namespace {
1228
1228
const ClassLayout &fieldLayout)
1229
1229
: IGM(IGM), TheEntity(theUnion), TheExtension(nullptr ),
1230
1230
FieldLayout (&fieldLayout) {
1231
- visitConformances (getClass ()-> getImplementationContext () );
1231
+ visitConformances (getClass ());
1232
1232
1233
1233
if (getClass ()->isRootDefaultActor ()) {
1234
1234
Ivars.push_back (Field::DefaultActorStorage);
@@ -1249,7 +1249,7 @@ namespace {
1249
1249
FieldLayout(nullptr ) {
1250
1250
buildCategoryName (CategoryName);
1251
1251
1252
- visitConformances (theExtension-> getImplementationContext () );
1252
+ visitConformances (theExtension);
1253
1253
1254
1254
for (Decl *member : TheExtension->getImplementationContext ()->getMembers ())
1255
1255
visit (member);
@@ -1295,6 +1295,15 @@ namespace {
1295
1295
// / Gather protocol records for all of the explicitly-specified Objective-C
1296
1296
// / protocol conformances.
1297
1297
void visitConformances (const IterableDeclContext *idc) {
1298
+ auto dc = idc->getAsGenericContext ();
1299
+ if (dc->getImplementedObjCContext () != dc) {
1300
+ // We want to use the conformance list imported from the ObjC header.
1301
+ auto importedIDC = cast<IterableDeclContext>(
1302
+ dc->getImplementedObjCContext ()->getAsDecl ());
1303
+ visitConformances (importedIDC);
1304
+ return ;
1305
+ }
1306
+
1298
1307
llvm::SmallSetVector<ProtocolDecl *, 2 > protocols;
1299
1308
for (auto conformance : idc->getLocalConformances (
1300
1309
ConformanceLookupKind::OnlyExplicit)) {
0 commit comments