mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[IRGen] Erase nonoverride descriptor on emission.
Previously, emitting the descriptor for a nonoverride method always simply emitted, even if it had previously been emitted. That was not a problem before, but is now that class type context descriptors can be reemitted upon encountering metadata prespecializations. Here, the behavior is changed to delete the old definition before emitting the new definition.
This commit is contained in:
@@ -300,6 +300,10 @@ static void buildMethodDescriptorFields(IRGenModule &IGM,
|
||||
|
||||
void IRGenModule::emitNonoverriddenMethodDescriptor(const SILVTable *VTable,
|
||||
SILDeclRef declRef) {
|
||||
auto entity = LinkEntity::forMethodDescriptor(declRef);
|
||||
|
||||
auto *var = cast<llvm::GlobalVariable>(getAddrOfLLVMVariable(entity, ConstantInit(), DebugTypeInfo()));
|
||||
var->setInitializer(nullptr);
|
||||
|
||||
ConstantInitBuilder ib(*this);
|
||||
ConstantStructBuilder sb(ib.beginStruct(MethodDescriptorStructTy));
|
||||
@@ -308,7 +312,6 @@ void IRGenModule::emitNonoverriddenMethodDescriptor(const SILVTable *VTable,
|
||||
|
||||
auto init = sb.finishAndCreateFuture();
|
||||
|
||||
auto entity = LinkEntity::forMethodDescriptor(declRef);
|
||||
getAddrOfLLVMVariable(entity, init, DebugTypeInfo());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user