mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Revert "[Runtime] Reference ObjC class objects indirectly in conformance records."
This reverts commit 65b4c9a25a. It broke
the stdlib/ErrorBridged.swift test at -Onone. Fixes rdar://problem/37925234.
This commit is contained in:
@@ -2442,15 +2442,6 @@ IRGenModule::getAddrOfLLVMVariableOrGOTEquivalent(LinkEntity entity,
|
||||
Alignment alignment,
|
||||
llvm::Type *defaultType,
|
||||
ConstantReference::Directness forceIndirectness) {
|
||||
// ObjC class references can always be directly referenced, even in
|
||||
// the weird cases where we don't see a definition.
|
||||
if (entity.isObjCClassRef()) {
|
||||
auto value = getAddrOfObjCClassRef(
|
||||
const_cast<ClassDecl *>(cast<ClassDecl>(entity.getDecl())));
|
||||
return { cast<llvm::Constant>(value.getAddress()),
|
||||
ConstantReference::Direct };
|
||||
}
|
||||
|
||||
// Ensure the variable is at least forward-declared.
|
||||
if (entity.isForeignTypeMetadataCandidate()) {
|
||||
auto foreignCandidate
|
||||
@@ -2528,7 +2519,7 @@ IRGenModule::getTypeEntityReference(NominalTypeDecl *decl) {
|
||||
|
||||
kind = TypeMetadataRecordKind::IndirectObjCClass;
|
||||
defaultTy = TypeMetadataPtrTy;
|
||||
entity = LinkEntity::forObjCClassRef(clas);
|
||||
entity = LinkEntity::forObjCClass(clas);
|
||||
} else {
|
||||
// A reference to a concrete type.
|
||||
// TODO: consider using a symbolic reference (i.e. a symbol string
|
||||
@@ -2543,8 +2534,8 @@ IRGenModule::getTypeEntityReference(NominalTypeDecl *decl) {
|
||||
|
||||
// Adjust the flags now that we know whether the reference to this
|
||||
// entity will be indirect.
|
||||
if (ref.isIndirect()) {
|
||||
assert(kind == TypeMetadataRecordKind::DirectNominalTypeDescriptor);
|
||||
if (ref.isIndirect() &&
|
||||
kind == TypeMetadataRecordKind::DirectNominalTypeDescriptor) {
|
||||
kind = TypeMetadataRecordKind::IndirectNominalTypeDescriptor;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user