mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
DeadFunctionElimination: don’t eliminate public methods which are called via a thunk.
For this we need to store the linkage of the “original” method implementation in the vtable. Otherwise DeadFunctionElimination thinks that the method implementation is not public but private (which is the linkage of the thunk). The big part of this change is to extend SILVTable to store the linkage (+ serialization, printing, etc.). fixes rdar://problem/29841635
This commit is contained in:
@@ -1746,13 +1746,14 @@ void SILSerializer::writeSILVTable(const SILVTable &vt) {
|
||||
|
||||
for (auto &entry : vt.getEntries()) {
|
||||
SmallVector<ValueID, 4> ListOfValues;
|
||||
handleSILDeclRef(S, entry.first, ListOfValues);
|
||||
addReferencedSILFunction(entry.second, true);
|
||||
handleSILDeclRef(S, entry.Method, ListOfValues);
|
||||
addReferencedSILFunction(entry.Implementation, true);
|
||||
// Each entry is a pair of SILDeclRef and SILFunction.
|
||||
VTableEntryLayout::emitRecord(Out, ScratchRecord,
|
||||
SILAbbrCodes[VTableEntryLayout::Code],
|
||||
// SILFunction name
|
||||
S.addIdentifierRef(Ctx.getIdentifier(entry.second->getName())),
|
||||
S.addIdentifierRef(Ctx.getIdentifier(entry.Implementation->getName())),
|
||||
toStableSILLinkage(entry.Linkage),
|
||||
ListOfValues);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user