mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add APIs to check if a function with a given name exists and to invalidate a SIL linker entry for a function.
These APIs are useful e.g. for quickly finding pre-specialisations by their names. The existence check is very light-weight and does not try to deserialize bodies of SIL functions.
This commit is contained in:
@@ -468,6 +468,15 @@ bool SILModule::linkFunction(StringRef Name, SILModule::LinkingMode Mode) {
|
||||
return SILLinkerVisitor(*this, getSILLoader(), Mode).processFunction(Name);
|
||||
}
|
||||
|
||||
SILFunction *SILModule::hasFunction(StringRef Name, SILLinkage Linkage) {
|
||||
assert(!lookUpFunction(Name) && "hasFunction should be only called for "
|
||||
"functions that are not contained in the "
|
||||
"SILModule yet");
|
||||
return SILLinkerVisitor(*this, getSILLoader(),
|
||||
SILModule::LinkingMode::LinkNormal)
|
||||
.lookupFunction(Name, Linkage);
|
||||
}
|
||||
|
||||
void SILModule::linkAllWitnessTables() {
|
||||
getSILLoader()->getAllWitnessTables();
|
||||
}
|
||||
@@ -516,6 +525,10 @@ void SILModule::eraseFunction(SILFunction *F) {
|
||||
}
|
||||
}
|
||||
|
||||
void SILModule::invalidateFunctionInSILCache(SILFunction *F) {
|
||||
getSILLoader()->invalidateFunction(F);
|
||||
}
|
||||
|
||||
/// Erase a global SIL variable from the module.
|
||||
void SILModule::eraseGlobalVariable(SILGlobalVariable *G) {
|
||||
GlobalVariableMap.erase(G->getName());
|
||||
|
||||
Reference in New Issue
Block a user