mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge remote-tracking branch 'origin/main' into rebranch
This commit is contained in:
@@ -405,11 +405,20 @@ llvm::Constant *IRGenModule::getAddrOfStringForTypeRef(
|
||||
switch (referent.getKind()) {
|
||||
case SymbolicReferent::NominalType: {
|
||||
auto type = const_cast<NominalTypeDecl*>(referent.getNominalType());
|
||||
bool isObjCProtocol = false;
|
||||
if (auto proto = dyn_cast<ProtocolDecl>(type)) {
|
||||
// The symbolic reference is to the protocol descriptor of the
|
||||
// referenced protocol.
|
||||
ref = getAddrOfLLVMVariableOrGOTEquivalent(
|
||||
LinkEntity::forProtocolDescriptor(proto));
|
||||
if (proto->isObjC()) {
|
||||
assert(canUseObjCSymbolicReferences());
|
||||
ref = ConstantReference(
|
||||
cast<llvm::Constant>(getObjCProtocolRefSymRefDescriptor(proto)),
|
||||
ConstantReference::Direct);
|
||||
isObjCProtocol = true;
|
||||
} else {
|
||||
// The symbolic reference is to the protocol descriptor of the
|
||||
// referenced protocol.
|
||||
ref = getAddrOfLLVMVariableOrGOTEquivalent(
|
||||
LinkEntity::forProtocolDescriptor(proto));
|
||||
}
|
||||
} else {
|
||||
// The symbolic reference is to the type context descriptor of the
|
||||
// referenced type.
|
||||
@@ -418,7 +427,7 @@ llvm::Constant *IRGenModule::getAddrOfStringForTypeRef(
|
||||
LinkEntity::forNominalTypeDescriptor(type));
|
||||
}
|
||||
// \1 - direct reference, \2 - indirect reference
|
||||
kind = (ref.isIndirect() ? 0x02 : 0x01);
|
||||
kind = (ref.isIndirect() ? 0x02 : (isObjCProtocol ? 0x0c : 0x01));
|
||||
break;
|
||||
}
|
||||
case SymbolicReferent::OpaqueType: {
|
||||
|
||||
Reference in New Issue
Block a user