SwiftCompilerSources: add a few utility APIs

This commit is contained in:
Erik Eckstein
2024-01-22 20:20:16 +01:00
parent f9015e0e11
commit 3c368575b4
3 changed files with 19 additions and 0 deletions

View File

@@ -150,6 +150,10 @@ extension Sequence where Element == Operand {
self.lazy.filter { !($0.instruction is I) }
}
public func ignore(user: Instruction) -> LazyFilterSequence<Self> {
self.lazy.filter { !($0.instruction == user) }
}
public func getSingleUser<I: Instruction>(ofType: I.Type) -> I? {
filterUsers(ofType: I.self).singleUse?.instruction as? I
}