mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
36 lines
1.2 KiB
Swift
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)
|
|
}
|
|
}
|