mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
swift SIL: add some SIL type related bridging
* `Function.argumentTypes` and `Function.resultType` * `Type.isNominal`, `Type.isClass`, `Type.isTuple`, `Type.isStruct` and `Type.isEnum` * `Type.getFieldIndexOfNominal` * `Type.getFieldTypeOfNominal` * `Type.tupleElements` * `Type.description` for better debugging # Conflicts: # SwiftCompilerSources/Sources/SIL/Type.swift # SwiftCompilerSources/Sources/SIL/Utils.swift # SwiftCompilerSources/Sources/SIL/Value.swift # include/swift/SIL/SILBridging.h # lib/SIL/Utils/SILBridging.cpp
This commit is contained in:
committed by
Max Desiatov
parent
b964dba177
commit
cec4b82b39
@@ -219,3 +219,12 @@ extension Optional where Wrapped == UnsafeMutablePointer<BridgedSwiftObject> {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
extension BridgedArrayRef {
|
||||
func withElements<T, R>(ofType ty: T.Type, _ c: (UnsafeBufferPointer<T>) -> R) -> R {
|
||||
return data.withMemoryRebound(to: ty, capacity: numElements) { (ptr: UnsafePointer<T>) -> R in
|
||||
let buffer = UnsafeBufferPointer(start: ptr, count: numElements)
|
||||
return c(buffer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user