mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This moves the swift-lang library out of the tools/SourceKit directory and into the stdlib directory. As it stands, the library required that the standard library and the SDK overlay was being built. This is implicitly done when building the stdlib subdirectory. Furthermore, it had an odd tie between the flags for Swift and SourceKit which now have the logic separated. This clearly delineates the host and target components in the repository.
40 lines
1.2 KiB
Swift
40 lines
1.2 KiB
Swift
//===------------------------ SourceKitdUID.swift -------------------------===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2018 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
// This file provides SourceKitd UIDs.
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
import sourcekitd
|
|
|
|
public struct SourceKitdUID: Equatable, Hashable, CustomStringConvertible {
|
|
public let uid: sourcekitd_uid_t
|
|
|
|
init(uid: sourcekitd_uid_t) {
|
|
self.uid = uid
|
|
}
|
|
|
|
public init(string: String) {
|
|
self.uid = sourcekitd_uid_get_from_cstr(string)
|
|
}
|
|
|
|
public var description: String {
|
|
return String(cString: sourcekitd_uid_get_string_ptr(uid))
|
|
}
|
|
|
|
public var asString: String {
|
|
return String(cString: sourcekitd_uid_get_string_ptr(uid))
|
|
}
|
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
hasher.combine(uid)
|
|
}
|
|
}
|