Files
swift-mirror/stdlib/tools/swift-lang/SourceKitdUID.swift
Saleem Abdulrasool 200b96df81 Revert "Revert "swift-lang: shuffle the source directory structure (NFC)""
This reverts commit beb8ecd8cc.  Add a
workaround for the dependency issue.

It is unclear why `sourcekitd` is getting added improperly as a
dependency on `lib/sourcekitd.framework/sourcekitd`.  This workaround
adjusts the dependency such that we end up with a dependency on
`lib/sourcekitd.framework/Versions/A/sourcekitd` as an order-only
dependency.  This should fix the compile issue.  I am unable to
reproduce this issue with the `add_library` usage for adding a Swift
library.  This allows us to cleave the host and target libraries, and so
the workaround is sufficient to make progress and the problem will be
resolved with the migration towards CMake for handling the dependencies.
2020-02-19 16:09:37 -08:00

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)
}
}