mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Clean up the linkage model and the computation of linkage.
In general, this forces SILGen and IRGen code that's grabbing a declaration to state whether it's doing so to define it. Change SIL serialization to serialize the linkage of functions and global variables, which means also serializing declarations. Change the deserializer to use this stored linkage, even when only deserializing a declaration, and to call a callback to inform the client that it has deserialized a new entity. Take advantage of that callback in the linking pass to alter the deserialized linkage as appropriate for the fact that we imported the declaration. This computation should really take advantage of the relationship between modules, but currently it does not. Swift SVN r12090
This commit is contained in:
@@ -826,7 +826,7 @@ bool tryToRemoveFunction(SILFunction *F) {
|
||||
// Remove internal functions that are not referenced by anything.
|
||||
// TODO: top_level_code is currently marked as internal so we explicitly check
|
||||
// for functions with this name and keep them around.
|
||||
if (F->getLinkage() != SILLinkage::Internal || F->getRefCount() ||
|
||||
if (isPossiblyUsedExternally(F->getLinkage()) || F->getRefCount() ||
|
||||
F->getName() == SWIFT_ENTRY_POINT_FUNCTION)
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user