Skip to content

Commit cbd1c8d

Browse files
committed
[IRGen] Don't assume Objective-C classes won't be generic.
This showed up as a test failure under swift_test_mode=optimized. We probably have more of these we should be worrying about.
1 parent 388dee5 commit cbd1c8d

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

lib/IRGen/GenMeta.cpp

+1-8
Original file line numberDiff line numberDiff line change
@@ -1764,21 +1764,14 @@ llvm::Value *irgen::emitClassHeapMetadataRef(IRGenFunction &IGF, CanType type,
17641764
return classPtr;
17651765
}
17661766

1767-
// ObjC-defined classes will always be top-level non-generic classes.
1768-
1769-
if (auto classType = dyn_cast<ClassType>(type)) {
1770-
auto theClass = classType->getDecl();
1767+
if (ClassDecl *theClass = type->getClassOrBoundGenericClass()) {
17711768
if (!hasKnownSwiftMetadata(IGF.IGM, theClass)) {
17721769
llvm::Value *result =
17731770
emitObjCHeapMetadataRef(IGF, theClass, allowUninitialized);
17741771
if (desiredType == MetadataValueType::TypeMetadata)
17751772
result = IGF.Builder.CreateBitCast(result, IGF.IGM.TypeMetadataPtrTy);
17761773
return result;
17771774
}
1778-
} else {
1779-
auto genericType = cast<BoundGenericClassType>(type);
1780-
assert(hasKnownSwiftMetadata(IGF.IGM, genericType->getDecl()));
1781-
(void) genericType;
17821775
}
17831776

17841777
llvm::Value *result = IGF.emitTypeMetadataRef(type);

0 commit comments

Comments
 (0)