Skip to content

Merge main into release/6.0 #1217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 3, 2024
Merged
7 changes: 7 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ let package = Package(
swiftSettings: [.enableExperimentalFeature("StrictConcurrency")]
),

// MARK: CAtomics
.target(
name: "CAtomics",
dependencies: []
),

// MARK: CSKTestSupport
.target(
name: "CSKTestSupport",
Expand Down Expand Up @@ -170,6 +176,7 @@ let package = Package(
name: "SKCore",
dependencies: [
"BuildServerProtocol",
"CAtomics",
"LanguageServerProtocol",
"LanguageServerProtocolJSONRPC",
"LSPLogging",
Expand Down
Empty file added Sources/CAtomics/CAtomics.c
Empty file.
2 changes: 2 additions & 0 deletions Sources/CAtomics/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
add_library(CAtomics INTERFACE)
target_include_directories(CAtomics INTERFACE "include")
66 changes: 66 additions & 0 deletions Sources/CAtomics/include/CAtomics.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2024 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
//
//===----------------------------------------------------------------------===//

#ifndef SOURCEKITLSP_CATOMICS_H
#define SOURCEKITLSP_CATOMICS_H

#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>

// MARK: - AtomicBool

typedef struct {
_Atomic(bool) value;
} AtomicBool;

__attribute__((swift_name("AtomicBool.init(initialValue:)")))
static inline AtomicBool atomic_bool_create(bool initialValue) {
AtomicBool atomic;
atomic.value = initialValue;
return atomic;
}

__attribute__((swift_name("getter:AtomicBool.value(self:)")))
static inline bool atomic_bool_get(AtomicBool *atomic) {
return atomic->value;
}

__attribute__((swift_name("setter:AtomicBool.value(self:_:)")))
static inline void atomic_bool_set(AtomicBool *atomic, bool newValue) {
atomic->value = newValue;
}

// MARK: - AtomicUInt8

typedef struct {
_Atomic(uint8_t) value;
} AtomicUInt8;

__attribute__((swift_name("AtomicUInt8.init(initialValue:)")))
static inline AtomicUInt8 atomic_uint8_create(uint8_t initialValue) {
AtomicUInt8 atomic;
atomic.value = initialValue;
return atomic;
}

__attribute__((swift_name("getter:AtomicUInt8.value(self:)")))
static inline uint8_t atomic_uint8_get(AtomicUInt8 *atomic) {
return atomic->value;
}

__attribute__((swift_name("setter:AtomicUInt8.value(self:_:)")))
static inline void atomic_uint8_set(AtomicUInt8 *atomic, uint8_t newValue) {
atomic->value = newValue;
}

#endif // SOURCEKITLSP_CATOMICS_H
4 changes: 4 additions & 0 deletions Sources/CAtomics/include/module.modulemap
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module CAtomics {
header "CAtomics.h"
export *
}
1 change: 1 addition & 0 deletions Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
add_subdirectory(BuildServerProtocol)
add_subdirectory(CAtomics)
add_subdirectory(Csourcekitd)
add_subdirectory(Diagnose)
add_subdirectory(LanguageServerProtocol)
Expand Down
20 changes: 10 additions & 10 deletions Sources/LanguageServerProtocol/SupportTypes/TestItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

public struct TestTag: Codable, Equatable, Sendable {
/// ID of the test tag. `TestTag` instances with the same ID are considered to be identical.
public let id: String
public var id: String

public init(id: String) {
self.id = id
Expand All @@ -26,35 +26,35 @@ public struct TestItem: ResponseType, Equatable {
/// Identifier for the `TestItem`.
///
/// This identifier uniquely identifies the test case or test suite. It can be used to run an individual test (suite).
public let id: String
public var id: String

/// Display name describing the test.
public let label: String
public var label: String

/// Optional description that appears next to the label.
public let description: String?
public var description: String?

/// A string that should be used when comparing this item with other items.
///
/// When `nil` the `label` is used.
public let sortText: String?
public var sortText: String?

/// Whether the test is disabled.
public let disabled: Bool
public var disabled: Bool

/// The type of test, eg. the testing framework that was used to declare the test.
public let style: String
public var style: String

/// The location of the test item in the source code.
public let location: Location
public var location: Location

/// The children of this test item.
///
/// For a test suite, this may contain the individual test cases or nested suites.
public let children: [TestItem]
public var children: [TestItem]

/// Tags associated with this test item.
public let tags: [TestTag]
public var tags: [TestTag]

public init(
id: String,
Expand Down
2 changes: 2 additions & 0 deletions Sources/SKCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ add_library(SKCore STATIC
MainFilesProvider.swift
PathPrefixMapping.swift
SplitShellCommand.swift
TaskScheduler.swift
Toolchain.swift
ToolchainRegistry.swift
XCToolchainPlist.swift)
set_target_properties(SKCore PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
target_link_libraries(SKCore PUBLIC
BuildServerProtocol
CAtomics
LanguageServerProtocol
LanguageServerProtocolJSONRPC
LSPLogging
Expand Down
2 changes: 1 addition & 1 deletion Sources/SKCore/MainFilesProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import LanguageServerProtocol

/// A type that can provide the set of main files that include a particular file.
public protocol MainFilesProvider: AnyObject, Sendable {
public protocol MainFilesProvider: Sendable {

/// Returns the set of main files that contain the given file.
///
Expand Down
Loading