mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Swift SIL: add some APIs to Location
* `var description` * `func ==` * `func hasSameSourceLocation(as:)`
This commit is contained in:
@@ -12,11 +12,24 @@
|
||||
|
||||
import SILBridging
|
||||
|
||||
public struct Location {
|
||||
public struct Location: Equatable, CustomStringConvertible {
|
||||
let bridged: swift.SILDebugLocation
|
||||
|
||||
|
||||
public var description: String {
|
||||
let stdString = SILLocation_debugDescription(bridged)
|
||||
return String(_cxxString: stdString)
|
||||
}
|
||||
|
||||
/// Keeps the debug scope but marks it as auto-generated.
|
||||
public var autoGenerated: Location {
|
||||
Location(bridged: SILLocation_getAutogeneratedLocation(bridged))
|
||||
}
|
||||
|
||||
public static func ==(lhs: Location, rhs: Location) -> Bool {
|
||||
SILLocation_equal(lhs.bridged, rhs.bridged)
|
||||
}
|
||||
|
||||
public func hasSameSourceLocation(as other: Location) -> Bool {
|
||||
SILLocation_hasSameSourceLocation(bridged, other.bridged)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user