From 85fdd63cb75ed719aaabb5dd3ff1e7a25a35a51e Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Tue, 30 Jun 2020 09:22:55 -0700 Subject: [PATCH] [Clang importer] Remove the OS_object objc_runtime_visible hack. The Clang importer has an old hack that makes OS_object and its subclasses implicitly "objc_runtime_visible" (which maps to the "runtime" foreign class kind in Swift). Now that the headers in the SDK all use the appropriate annotation, remove the hack. Fixes rdar://problem/64778416. (cherry picked from commit 1867e0d6dee08b04a240e0baf4b76d5c71bebb12) --- lib/ClangImporter/ImportDecl.cpp | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/lib/ClangImporter/ImportDecl.cpp b/lib/ClangImporter/ImportDecl.cpp index ffdf8b00618ce..9efee131c4915 100644 --- a/lib/ClangImporter/ImportDecl.cpp +++ b/lib/ClangImporter/ImportDecl.cpp @@ -4993,27 +4993,6 @@ namespace { } result->setSuperclass(superclassType); - // Mark the class as runtime-only if it is named 'OS_object', even - // if it doesn't have the runtime-only Clang attribute. This is a - // targeted fix allowing IRGen to emit convenience initializers - // correctly. - // - // FIXME: Remove this once SILGen gets proper support for factory - // initializers. - if (decl->getName() == "OS_object" || - decl->getName() == "OS_os_log") { - result->setForeignClassKind(ClassDecl::ForeignKind::RuntimeOnly); - } - - // If the superclass is runtime-only, our class is also. This only - // matters in the case above. - if (superclassType) { - auto superclassDecl = cast(superclassType->getAnyNominal()); - auto kind = superclassDecl->getForeignClassKind(); - if (kind != ClassDecl::ForeignKind::Normal) - result->setForeignClassKind(kind); - } - // Import protocols this class conforms to. importObjCProtocols(result, decl->getReferencedProtocols(), inheritedTypes);