Skip to content

Commit 62ddb33

Browse files
authored
Merge pull request swiftlang#14922 from DougGregor/revert-objc-class-refs-in-metadata
2 parents 204e517 + 719533b commit 62ddb33

File tree

4 files changed

+5
-17
lines changed

4 files changed

+5
-17
lines changed

include/swift/IRGen/Linking.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -756,9 +756,6 @@ class LinkEntity {
756756
bool isForeignTypeMetadataCandidate() const {
757757
return getKind() == Kind::ForeignTypeMetadataCandidate;
758758
}
759-
bool isObjCClassRef() const {
760-
return getKind() == Kind::ObjCClassRef;
761-
}
762759

763760
/// Determine whether this entity will be weak-imported.
764761
bool isWeakImported(ModuleDecl *module) const {

lib/IRGen/GenDecl.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2442,15 +2442,6 @@ IRGenModule::getAddrOfLLVMVariableOrGOTEquivalent(LinkEntity entity,
24422442
Alignment alignment,
24432443
llvm::Type *defaultType,
24442444
ConstantReference::Directness forceIndirectness) {
2445-
// ObjC class references can always be directly referenced, even in
2446-
// the weird cases where we don't see a definition.
2447-
if (entity.isObjCClassRef()) {
2448-
auto value = getAddrOfObjCClassRef(
2449-
const_cast<ClassDecl *>(cast<ClassDecl>(entity.getDecl())));
2450-
return { cast<llvm::Constant>(value.getAddress()),
2451-
ConstantReference::Direct };
2452-
}
2453-
24542445
// Ensure the variable is at least forward-declared.
24552446
if (entity.isForeignTypeMetadataCandidate()) {
24562447
auto foreignCandidate
@@ -2528,7 +2519,7 @@ IRGenModule::getTypeEntityReference(NominalTypeDecl *decl) {
25282519

25292520
kind = TypeMetadataRecordKind::IndirectObjCClass;
25302521
defaultTy = TypeMetadataPtrTy;
2531-
entity = LinkEntity::forObjCClassRef(clas);
2522+
entity = LinkEntity::forObjCClass(clas);
25322523
} else {
25332524
// A reference to a concrete type.
25342525
// TODO: consider using a symbolic reference (i.e. a symbol string
@@ -2543,8 +2534,8 @@ IRGenModule::getTypeEntityReference(NominalTypeDecl *decl) {
25432534

25442535
// Adjust the flags now that we know whether the reference to this
25452536
// entity will be indirect.
2546-
if (ref.isIndirect()) {
2547-
assert(kind == TypeMetadataRecordKind::DirectNominalTypeDescriptor);
2537+
if (ref.isIndirect() &&
2538+
kind == TypeMetadataRecordKind::DirectNominalTypeDescriptor) {
25482539
kind = TypeMetadataRecordKind::IndirectNominalTypeDescriptor;
25492540
}
25502541

test/IRGen/objc_bridged_generic_conformance.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// CHECK-NOT: _TMnCSo
55

6-
// CHECK: @"$SSo6ThingyCyxG32objc_bridged_generic_conformance1PADMc" = hidden constant %swift.protocol_conformance_descriptor {{.*}} @"OBJC_CLASS_REF_$_Thingy"
6+
// CHECK: @"$SSo6ThingyCyxG32objc_bridged_generic_conformance1PADMc" = hidden constant %swift.protocol_conformance_descriptor {{.*}} @"got.OBJC_CLASS_$_Thingy"
77

88
// CHECK-NOT: _TMnCSo
99

test/IRGen/protocol_conformance_records_objc.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extension NSRect: Runcible {
3030
// -- protocol descriptor
3131
// CHECK-SAME: [[RUNCIBLE]]
3232
// -- class object reference
33-
// CHECK-SAME: @"OBJC_CLASS_REF_$_Gizmo"
33+
// CHECK-SAME: @"got.OBJC_CLASS_$_Gizmo"
3434
// -- witness table
3535
// CHECK-SAME: @"$SSo5GizmoC33protocol_conformance_records_objc8RuncibleACWP"
3636
// -- flags

0 commit comments

Comments
 (0)