Skip to content

Commit fe44f49

Browse files
authored
Merge pull request #1217 from ahoppen/6.0/merge-main-2024-05-03
Merge `main` into `release/6.0`
2 parents cec098d + 16a4340 commit fe44f49

25 files changed

+1648
-235
lines changed

Package.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ let package = Package(
4949
swiftSettings: [.enableExperimentalFeature("StrictConcurrency")]
5050
),
5151

52+
// MARK: CAtomics
53+
.target(
54+
name: "CAtomics",
55+
dependencies: []
56+
),
57+
5258
// MARK: CSKTestSupport
5359
.target(
5460
name: "CSKTestSupport",
@@ -170,6 +176,7 @@ let package = Package(
170176
name: "SKCore",
171177
dependencies: [
172178
"BuildServerProtocol",
179+
"CAtomics",
173180
"LanguageServerProtocol",
174181
"LanguageServerProtocolJSONRPC",
175182
"LSPLogging",

Sources/CAtomics/CAtomics.c

Whitespace-only changes.

Sources/CAtomics/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
add_library(CAtomics INTERFACE)
2+
target_include_directories(CAtomics INTERFACE "include")

Sources/CAtomics/include/CAtomics.h

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2024 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
#ifndef SOURCEKITLSP_CATOMICS_H
14+
#define SOURCEKITLSP_CATOMICS_H
15+
16+
#include <stdbool.h>
17+
#include <stdint.h>
18+
#include <sys/types.h>
19+
20+
// MARK: - AtomicBool
21+
22+
typedef struct {
23+
_Atomic(bool) value;
24+
} AtomicBool;
25+
26+
__attribute__((swift_name("AtomicBool.init(initialValue:)")))
27+
static inline AtomicBool atomic_bool_create(bool initialValue) {
28+
AtomicBool atomic;
29+
atomic.value = initialValue;
30+
return atomic;
31+
}
32+
33+
__attribute__((swift_name("getter:AtomicBool.value(self:)")))
34+
static inline bool atomic_bool_get(AtomicBool *atomic) {
35+
return atomic->value;
36+
}
37+
38+
__attribute__((swift_name("setter:AtomicBool.value(self:_:)")))
39+
static inline void atomic_bool_set(AtomicBool *atomic, bool newValue) {
40+
atomic->value = newValue;
41+
}
42+
43+
// MARK: - AtomicUInt8
44+
45+
typedef struct {
46+
_Atomic(uint8_t) value;
47+
} AtomicUInt8;
48+
49+
__attribute__((swift_name("AtomicUInt8.init(initialValue:)")))
50+
static inline AtomicUInt8 atomic_uint8_create(uint8_t initialValue) {
51+
AtomicUInt8 atomic;
52+
atomic.value = initialValue;
53+
return atomic;
54+
}
55+
56+
__attribute__((swift_name("getter:AtomicUInt8.value(self:)")))
57+
static inline uint8_t atomic_uint8_get(AtomicUInt8 *atomic) {
58+
return atomic->value;
59+
}
60+
61+
__attribute__((swift_name("setter:AtomicUInt8.value(self:_:)")))
62+
static inline void atomic_uint8_set(AtomicUInt8 *atomic, uint8_t newValue) {
63+
atomic->value = newValue;
64+
}
65+
66+
#endif // SOURCEKITLSP_CATOMICS_H
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module CAtomics {
2+
header "CAtomics.h"
3+
export *
4+
}

Sources/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
add_subdirectory(BuildServerProtocol)
2+
add_subdirectory(CAtomics)
23
add_subdirectory(Csourcekitd)
34
add_subdirectory(Diagnose)
45
add_subdirectory(LanguageServerProtocol)

Sources/LanguageServerProtocol/SupportTypes/TestItem.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

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

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

3131
/// Display name describing the test.
32-
public let label: String
32+
public var label: String
3333

3434
/// Optional description that appears next to the label.
35-
public let description: String?
35+
public var description: String?
3636

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

4242
/// Whether the test is disabled.
43-
public let disabled: Bool
43+
public var disabled: Bool
4444

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

4848
/// The location of the test item in the source code.
49-
public let location: Location
49+
public var location: Location
5050

5151
/// The children of this test item.
5252
///
5353
/// For a test suite, this may contain the individual test cases or nested suites.
54-
public let children: [TestItem]
54+
public var children: [TestItem]
5555

5656
/// Tags associated with this test item.
57-
public let tags: [TestTag]
57+
public var tags: [TestTag]
5858

5959
public init(
6060
id: String,

Sources/SKCore/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ add_library(SKCore STATIC
1313
MainFilesProvider.swift
1414
PathPrefixMapping.swift
1515
SplitShellCommand.swift
16+
TaskScheduler.swift
1617
Toolchain.swift
1718
ToolchainRegistry.swift
1819
XCToolchainPlist.swift)
1920
set_target_properties(SKCore PROPERTIES
2021
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
2122
target_link_libraries(SKCore PUBLIC
2223
BuildServerProtocol
24+
CAtomics
2325
LanguageServerProtocol
2426
LanguageServerProtocolJSONRPC
2527
LSPLogging

Sources/SKCore/MainFilesProvider.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import LanguageServerProtocol
1414

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

1818
/// Returns the set of main files that contain the given file.
1919
///

0 commit comments

Comments
 (0)