Skip to content

Commit 3cec742

Browse files
authored
Merge pull request swiftlang#29187 from slavapestov/realize-objc-classes-the-old-way-5.2
IRGen: Don't use the demangler to realize imported Objective-C class metadata for now [5.2]
2 parents af52ddb + 650f931 commit 3cec742

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

lib/IRGen/MetadataRequest.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,10 +2008,7 @@ static bool shouldAccessByMangledName(IRGenModule &IGM, CanType type) {
20082008
if (auto nom = dyn_cast<NominalType>(type)) {
20092009
if (!isa<ProtocolDecl>(nom->getDecl())
20102010
&& (!nom->getDecl()->isGenericContext()
2011-
|| nom->getDecl()->getGenericSignature()->areAllParamsConcrete())
2012-
&& (!nom->getClassOrBoundGenericClass()
2013-
|| !nom->getClassOrBoundGenericClass()->hasClangNode()
2014-
|| nom->getClassOrBoundGenericClass()->isForeign())) {
2011+
|| nom->getDecl()->getGenericSignature()->areAllParamsConcrete())) {
20152012
return false;
20162013
}
20172014
}

test/IRGen/access_type_metadata_by_mangled_name_objc.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ public func test() {
1212
var x: Any.Type
1313

1414
// Access ObjC classes by mangled name.
15-
// CHECK: @"$sSo8NSObjectCMD"
15+
// FIXME: Disabled for now.
16+
// CHECK: @"$sSo8NSObjectCMa"
1617
x = NSObject.self
1718

1819
// Use the metadata accessor for CF classes that already has to exist.

test/IRGen/objc_types_as_member.sil

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ import gizmo
99
sil @use_metatype : $@convention(thin) <T> (@thin T.Type) -> ()
1010

1111
// CHECK-LABEL: define swiftcc void @test(%TSo014OuterTypeInnerB0C* swiftself, %swift.type* %Self, i8** %SelfWitnessTable)
12-
// CHECK: [[TMP:%.*]] = call {{.*}}@"$sSo9OuterTypeCMD"
13-
// CHECK: call swiftcc void @use_metatype(%swift.type* [[TMP]])
12+
// FIXME: Metadata realization via demangling is disabled for now
13+
// CHECK: [[TMP:%.*]] = call swiftcc %swift.metadata_response @"$sSo9OuterTypeCMa"
14+
// CHECK: [[METADATA:%.*]] = extractvalue %swift.metadata_response %1, 0
15+
// CHECK: call swiftcc void @use_metatype(%swift.type* [[METADATA]])
1416
// CHECK: ret void
1517

1618
sil @test : $@convention(witness_method: NSRuncing) (@guaranteed OuterType.InnerType) -> () {

0 commit comments

Comments
 (0)