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:
@@ -139,7 +139,7 @@ SILVTable *SILLinkerVisitor::processClassDecl(const ClassDecl *C) {
|
||||
// Otherwise, add all the vtable functions in Vtbl to the function
|
||||
// processing list...
|
||||
for (auto &E : Vtbl->getEntries())
|
||||
Worklist.push_back(E.second);
|
||||
Worklist.push_back(E.Implementation);
|
||||
|
||||
// And then transitively deserialize all SIL referenced by those functions.
|
||||
process();
|
||||
@@ -162,9 +162,9 @@ bool SILLinkerVisitor::linkInVTable(ClassDecl *D) {
|
||||
// for processing.
|
||||
bool Result = false;
|
||||
for (auto P : Vtbl->getEntries()) {
|
||||
if (P.second->isExternalDeclaration()) {
|
||||
if (P.Implementation->isExternalDeclaration()) {
|
||||
Result = true;
|
||||
addFunctionToWorklist(P.second);
|
||||
addFunctionToWorklist(P.Implementation);
|
||||
}
|
||||
}
|
||||
return Result;
|
||||
|
||||
Reference in New Issue
Block a user