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:
Doug Gregor
2018-03-01 15:39:11 -08:00
parent 62ee3a1e39
commit 719533b3f9
4 changed files with 5 additions and 17 deletions

View File

@@ -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;
}