mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
SIL: add an API to replace all entries of a VTable
* add `ModulePassContext.replaceVTableEntries()` * add `ModulePassContext.notifyFunctionTablesChanged()`
This commit is contained in:
@@ -168,6 +168,14 @@ struct ModulePassContext : Context, CustomStringConvertible {
|
||||
return VTable(bridged: bridgedVTable)
|
||||
}
|
||||
|
||||
func replaceVTableEntries(of vTable: VTable, with entries: [VTable.Entry]) {
|
||||
let bridgedEntries = entries.map { $0.bridged }
|
||||
bridgedEntries.withBridgedArrayRef {
|
||||
vTable.bridged.replaceEntries($0)
|
||||
}
|
||||
notifyFunctionTablesChanged()
|
||||
}
|
||||
|
||||
func createEmptyFunction(
|
||||
name: String,
|
||||
parameters: [ParameterInfo],
|
||||
@@ -201,6 +209,10 @@ struct ModulePassContext : Context, CustomStringConvertible {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func notifyFunctionTablesChanged() {
|
||||
_bridged.asNotificationHandler().notifyChanges(.functionTablesChanged)
|
||||
}
|
||||
}
|
||||
|
||||
extension GlobalVariable {
|
||||
|
||||
Reference in New Issue
Block a user