mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[sil-linker] Improve the implementation of the hasSILFunction API
It it now possible to check if a function with a given name and a given linkage exists in one of the modules, even if the current module contains a function with this name but a difference linkage. This is useful e.g. for performing a lookup of pre-specializations.
This commit is contained in:
@@ -104,6 +104,18 @@ SILFunction *SerializedSILLoader::lookupSILFunction(StringRef Name,
|
||||
return retVal;
|
||||
}
|
||||
|
||||
bool SerializedSILLoader::hasSILFunction(StringRef Name, SILLinkage Linkage) {
|
||||
// It is possible that one module has a declaration of a SILFunction, while
|
||||
// another has the full definition.
|
||||
SILFunction *retVal = nullptr;
|
||||
for (auto &Des : LoadedSILSections) {
|
||||
if (Des->hasSILFunction(Name, Linkage))
|
||||
return true;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
SILVTable *SerializedSILLoader::lookupVTable(Identifier Name) {
|
||||
for (auto &Des : LoadedSILSections) {
|
||||
if (auto VT = Des->lookupVTable(Name))
|
||||
|
||||
Reference in New Issue
Block a user