mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Swift SIL: add some APIs
This commit is contained in:
@@ -107,6 +107,19 @@ public struct UseList : CollectionLikeSequence {
|
||||
return nil
|
||||
}
|
||||
|
||||
public func getSingleUser<I: Instruction>(ofType: I.Type) -> I? {
|
||||
var result: I? = nil
|
||||
for use in self {
|
||||
if let user = use.instruction as? I {
|
||||
if result != nil {
|
||||
return nil
|
||||
}
|
||||
result = user
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
public var isSingleUse: Bool { singleUse != nil }
|
||||
|
||||
public func makeIterator() -> Iterator {
|
||||
|
||||
Reference in New Issue
Block a user