Files
swift-mirror/SwiftCompilerSources/Sources/SIL/Location.swift
Erik Eckstein d96ef3bedd Swift SIL: add some APIs to Location
* `var description`
* `func ==`
* `func hasSameSourceLocation(as:)`
2023-01-16 19:00:09 +01:00

36 lines
1.2 KiB
Swift

//===--- Location.swift - Source location ---------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
import SILBridging
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)
}
}