File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -3892,6 +3892,27 @@ namespace {
3892
3892
}
3893
3893
result->setSuperclass (superclassType);
3894
3894
3895
+ // Mark the class as runtime-only if it is named 'OS_object', even
3896
+ // if it doesn't have the runtime-only Clang attribute. This is a
3897
+ // targeted fix allowing IRGen to emit convenience initializers
3898
+ // correctly.
3899
+ //
3900
+ // FIXME: Remove this once SILGen gets proper support for factory
3901
+ // initializers.
3902
+ if (result->getName () ==
3903
+ result->getASTContext ().getIdentifier (" OS_object" )) {
3904
+ result->setForeignClassKind (ClassDecl::ForeignKind::RuntimeOnly);
3905
+ }
3906
+
3907
+ // If the superclass is runtime-only, our class is also. This only
3908
+ // matters in the case above.
3909
+ if (superclassType) {
3910
+ auto superclassDecl = cast<ClassDecl>(superclassType->getAnyNominal ());
3911
+ auto kind = superclassDecl->getForeignClassKind ();
3912
+ if (kind != ClassDecl::ForeignKind::Normal)
3913
+ result->setForeignClassKind (kind);
3914
+ }
3915
+
3895
3916
// Import protocols this class conforms to.
3896
3917
importObjCProtocols (result, decl->getReferencedProtocols (),
3897
3918
inheritedTypes);
You can’t perform that action at this time.
0 commit comments