@@ -1492,7 +1492,7 @@ namespace {
1492
1492
void addMethod (SILDeclRef fn) {
1493
1493
if (!VTable || methodRequiresReifiedVTableEntry (IGM, VTable, fn)) {
1494
1494
VTableEntries.push_back (fn);
1495
- } else if ( hasPublicVisibility (fn. getLinkage (NotForDefinition))) {
1495
+ } else {
1496
1496
// Emit a stub method descriptor and lookup function for nonoverridden
1497
1497
// methods so that resilient code sequences can still use them.
1498
1498
emitNonoverriddenMethod (fn);
@@ -1609,8 +1609,9 @@ namespace {
1609
1609
}
1610
1610
1611
1611
void emitMethodDescriptor (SILDeclRef fn) {
1612
+
1612
1613
// Define the method descriptor to point to the current position in the
1613
- // nominal type descriptor.
1614
+ // nominal type descriptor, if it has a well-defined symbol name .
1614
1615
IGM.defineMethodDescriptor (fn, Type,
1615
1616
B.getAddrOfCurrentPosition (IGM.MethodDescriptorStructTy ));
1616
1617
@@ -1628,13 +1629,21 @@ namespace {
1628
1629
}
1629
1630
1630
1631
void emitNonoverriddenMethod (SILDeclRef fn) {
1631
- HasNonoverriddenMethods = true ;
1632
+ // TODO: Derivative functions do not distinguish themselves in the mangled
1633
+ // names of method descriptor symbols yet, causing symbol name collisions.
1634
+ if (fn.derivativeFunctionIdentifier )
1635
+ return ;
1636
+
1637
+ HasNonoverriddenMethods = true ;
1632
1638
// Although this method is non-overridden and therefore left out of the
1633
1639
// vtable, we still need to maintain the ABI of a potentially-overridden
1634
1640
// method for external clients.
1635
1641
1636
1642
// Emit method dispatch thunk.
1637
- IGM.emitDispatchThunk (fn);
1643
+ if (hasPublicVisibility (fn.getLinkage (NotForDefinition))) {
1644
+ IGM.emitDispatchThunk (fn);
1645
+ }
1646
+
1638
1647
// Emit a freestanding method descriptor structure. This doesn't have to
1639
1648
// exist in the table in the class's context descriptor since it isn't
1640
1649
// in the vtable, but external clients need to be able to link against the
0 commit comments