Skip to content

Commit 6287624

Browse files
authored
Merge pull request #82 from lorentey/finalize-1.1
1.1 release preparations
2 parents 951d3b2 + 581634c commit 6287624

File tree

9 files changed

+148
-21
lines changed

9 files changed

+148
-21
lines changed

Sources/Atomics/AtomicLazyReference.swift.gyb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ public class ManagedAtomicLazyReference<Instance: AnyObject> {
139139
@usableFromInline
140140
internal typealias _Rep = Optional<Unmanaged<Instance>>.AtomicRepresentation
141141

142+
/// The atomic representation of the value stored inside.
143+
///
144+
/// Warning: This ivar must only ever be accessed via `_ptr` after
145+
/// its initialization.
142146
@usableFromInline
143147
internal let _storage: _Rep
144148

@@ -149,7 +153,7 @@ public class ManagedAtomicLazyReference<Instance: AnyObject> {
149153
}
150154

151155
deinit {
152-
if let unmanaged = _storage.dispose() {
156+
if let unmanaged = _ptr.pointee.dispose() {
153157
unmanaged.release()
154158
}
155159
}

Sources/Atomics/HighLevelTypes.swift.gyb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ where Value.AtomicRepresentation.Value == Value {
9797
@usableFromInline
9898
internal typealias _Storage = Value.AtomicRepresentation
9999

100+
/// The atomic representation of the value stored inside.
101+
///
102+
/// Warning: This ivar must only ever be accessed via `_ptr` after
103+
/// its initialization.
100104
@usableFromInline
101105
internal var _storage: _Storage
102106

@@ -108,7 +112,7 @@ where Value.AtomicRepresentation.Value == Value {
108112
}
109113

110114
deinit {
111-
_ = _storage.dispose()
115+
_ = _ptr.pointee.dispose()
112116
}
113117

114118
@_alwaysEmitIntoClient @inline(__always)

Sources/Atomics/autogenerated/AtomicLazyReference.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ public class ManagedAtomicLazyReference<Instance: AnyObject> {
142142
@usableFromInline
143143
internal typealias _Rep = Optional<Unmanaged<Instance>>.AtomicRepresentation
144144

145+
/// The atomic representation of the value stored inside.
146+
///
147+
/// Warning: This ivar must only ever be accessed via `_ptr` after
148+
/// its initialization.
145149
@usableFromInline
146150
internal let _storage: _Rep
147151

@@ -152,7 +156,7 @@ public class ManagedAtomicLazyReference<Instance: AnyObject> {
152156
}
153157

154158
deinit {
155-
if let unmanaged = _storage.dispose() {
159+
if let unmanaged = _ptr.pointee.dispose() {
156160
unmanaged.release()
157161
}
158162
}

Sources/Atomics/autogenerated/HighLevelTypes.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ where Value.AtomicRepresentation.Value == Value {
9999
@usableFromInline
100100
internal typealias _Storage = Value.AtomicRepresentation
101101

102+
/// The atomic representation of the value stored inside.
103+
///
104+
/// Warning: This ivar must only ever be accessed via `_ptr` after
105+
/// its initialization.
102106
@usableFromInline
103107
internal var _storage: _Storage
104108

@@ -110,7 +114,7 @@ where Value.AtomicRepresentation.Value == Value {
110114
}
111115

112116
deinit {
113-
_ = _storage.dispose()
117+
_ = _ptr.pointee.dispose()
114118
}
115119

116120
@_alwaysEmitIntoClient @inline(__always)

Tests/AtomicsTests/AtomicLazyReference.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,17 @@ import Atomics
1515

1616
class AtomicLazyReferenceTests: XCTestCase {
1717
func test_unsafe_create_destroy() {
18+
XCTAssertEqual(LifetimeTracked.instances, 0)
1819
let v = UnsafeAtomicLazyReference<LifetimeTracked>.create()
19-
defer { v.destroy() }
20+
defer {
21+
v.destroy()
22+
XCTAssertEqual(LifetimeTracked.instances, 0)
23+
}
2024
XCTAssertNil(v.load())
2125
}
2226

2327
func test_unsafe_storeIfNilThenLoad() {
28+
XCTAssertEqual(LifetimeTracked.instances, 0)
2429
do {
2530
let v = UnsafeAtomicLazyReference<LifetimeTracked>.create()
2631
XCTAssertNil(v.load())
@@ -39,6 +44,7 @@ class AtomicLazyReferenceTests: XCTestCase {
3944
}
4045

4146
func test_managed_storeIfNilThenLoad() {
47+
XCTAssertEqual(LifetimeTracked.instances, 0)
4248
do {
4349
let v = ManagedAtomicLazyReference<LifetimeTracked>()
4450
XCTAssertNil(v.load())

Tests/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) # FIXME Hook this up on Darwin
1414

1515
add_executable(AtomicsTestBundle
1616
AtomicsTests/main.swift
17+
AtomicsTests/AtomicLazyReference.swift
1718
AtomicsTests/Basics/BasicTestSupport.swift
1819
AtomicsTests/Basics/autogenerated/BasicAtomicBoolTests.swift
1920
AtomicsTests/Basics/autogenerated/BasicAtomicDoubleWordTests.swift
@@ -46,7 +47,8 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) # FIXME Hook this up on Darwin
4647
AtomicsTests/LockFreeQueue.swift
4748
AtomicsTests/LockFreeSingleConsumerStack.swift
4849
AtomicsTests/StrongReferenceRace.swift
49-
AtomicsTests/StrongReferenceShuffle.swift)
50+
AtomicsTests/StrongReferenceShuffle.swift
51+
AtomicsTests/StrongReferenceSubclass.swift)
5052

5153
target_compile_options(AtomicsTestBundle PRIVATE "-DMANUAL_TEST_DISCOVERY")
5254

Xcode/Atomics.xcodeproj/project.pbxproj

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,15 @@
182182
7D489ECD29CE96DA00499B21 /* gyb_utils.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = gyb_utils.py; sourceTree = "<group>"; };
183183
7D489ECE29CE96DA00499B21 /* gyb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = gyb; sourceTree = "<group>"; };
184184
7D489ECF29CE96DA00499B21 /* generate-sources.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "generate-sources.sh"; sourceTree = "<group>"; };
185-
7D489ED029CE96DA00499B21 /* generate-docs.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "generate-docs.sh"; sourceTree = "<group>"; };
186185
7D489ED129CE96DA00499B21 /* LICENSE.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LICENSE.txt; path = ../LICENSE.txt; sourceTree = "<group>"; };
187-
7D489ED329CE96DA00499B21 /* Atomics.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = Atomics.xcodeproj; sourceTree = "<group>"; };
188186
7D489ED629CE96DA00499B21 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
189187
7D489ED729CE96DA00499B21 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
190188
7D489ED829CE96DA00499B21 /* CONTRIBUTING.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = CONTRIBUTING.md; path = ../CONTRIBUTING.md; sourceTree = "<group>"; };
191189
7D489ED929CE96DA00499B21 /* CODE_OF_CONDUCT.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = CODE_OF_CONDUCT.md; path = ../CODE_OF_CONDUCT.md; sourceTree = "<group>"; };
192190
7D489F6F29CE986A00499B21 /* Shared.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Shared.xcconfig; sourceTree = "<group>"; };
193191
7D489F7029CE986A00499B21 /* Atomics.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Atomics.xcconfig; sourceTree = "<group>"; };
194192
7D489F7129CE986A00499B21 /* AtomicsTests.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AtomicsTests.xcconfig; sourceTree = "<group>"; };
193+
BB63DC6A29D782010054E9C2 /* Atomics.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = Atomics.xctestplan; sourceTree = "<group>"; };
195194
/* End PBXFileReference section */
196195

197196
/* Begin PBXFrameworksBuildPhase section */
@@ -441,7 +440,6 @@
441440
7D489ECD29CE96DA00499B21 /* gyb_utils.py */,
442441
7D489ECE29CE96DA00499B21 /* gyb */,
443442
7D489ECF29CE96DA00499B21 /* generate-sources.sh */,
444-
7D489ED029CE96DA00499B21 /* generate-docs.sh */,
445443
);
446444
name = Utilities;
447445
path = ../Utilities;
@@ -450,20 +448,15 @@
450448
7D489ED229CE96DA00499B21 /* Xcode */ = {
451449
isa = PBXGroup;
452450
children = (
451+
BB63DC6A29D782010054E9C2 /* Atomics.xctestplan */,
453452
7D489F6F29CE986A00499B21 /* Shared.xcconfig */,
454453
7D489F7029CE986A00499B21 /* Atomics.xcconfig */,
455454
7D489F7129CE986A00499B21 /* AtomicsTests.xcconfig */,
456-
7D489ED329CE96DA00499B21 /* Atomics.xcodeproj */,
457455
7D489ED629CE96DA00499B21 /* README.md */,
458456
);
459457
name = Xcode;
460458
sourceTree = "<group>";
461459
};
462-
7D489ED429CE96DA00499B21 /* Products */ = {
463-
isa = PBXGroup;
464-
name = Products;
465-
sourceTree = "<group>";
466-
};
467460
/* End PBXGroup section */
468461

469462
/* Begin PBXHeadersBuildPhase section */
@@ -544,12 +537,6 @@
544537
mainGroup = 7D489E3529CE969D00499B21;
545538
productRefGroup = 7D489E4029CE969D00499B21 /* Products */;
546539
projectDirPath = "";
547-
projectReferences = (
548-
{
549-
ProductGroup = 7D489ED429CE96DA00499B21 /* Products */;
550-
ProjectRef = 7D489ED329CE96DA00499B21 /* Atomics.xcodeproj */;
551-
},
552-
);
553540
projectRoot = "";
554541
targets = (
555542
7D489E3E29CE969D00499B21 /* Atomics */,
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1420"
4+
version = "1.7">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "7D489E3E29CE969D00499B21"
18+
BuildableName = "Atomics.framework"
19+
BlueprintName = "Atomics"
20+
ReferencedContainer = "container:Atomics.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<TestPlans>
31+
<TestPlanReference
32+
reference = "container:Atomics.xctestplan"
33+
default = "YES">
34+
</TestPlanReference>
35+
</TestPlans>
36+
<Testables>
37+
<TestableReference
38+
skipped = "NO"
39+
parallelizable = "YES">
40+
<BuildableReference
41+
BuildableIdentifier = "primary"
42+
BlueprintIdentifier = "7D489E4629CE969D00499B21"
43+
BuildableName = "AtomicsTests.xctest"
44+
BlueprintName = "AtomicsTests"
45+
ReferencedContainer = "container:Atomics.xcodeproj">
46+
</BuildableReference>
47+
</TestableReference>
48+
</Testables>
49+
</TestAction>
50+
<LaunchAction
51+
buildConfiguration = "Debug"
52+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
53+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
54+
launchStyle = "0"
55+
useCustomWorkingDirectory = "NO"
56+
ignoresPersistentStateOnLaunch = "NO"
57+
debugDocumentVersioning = "YES"
58+
debugServiceExtension = "internal"
59+
allowLocationSimulation = "YES">
60+
</LaunchAction>
61+
<ProfileAction
62+
buildConfiguration = "Release"
63+
shouldUseLaunchSchemeArgsEnv = "YES"
64+
savedToolIdentifier = ""
65+
useCustomWorkingDirectory = "NO"
66+
debugDocumentVersioning = "YES">
67+
<MacroExpansion>
68+
<BuildableReference
69+
BuildableIdentifier = "primary"
70+
BlueprintIdentifier = "7D489E3E29CE969D00499B21"
71+
BuildableName = "Atomics.framework"
72+
BlueprintName = "Atomics"
73+
ReferencedContainer = "container:Atomics.xcodeproj">
74+
</BuildableReference>
75+
</MacroExpansion>
76+
</ProfileAction>
77+
<AnalyzeAction
78+
buildConfiguration = "Debug">
79+
</AnalyzeAction>
80+
<ArchiveAction
81+
buildConfiguration = "Release"
82+
revealArchiveInOrganizer = "YES">
83+
</ArchiveAction>
84+
</Scheme>

Xcode/Atomics.xctestplan

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"configurations" : [
3+
{
4+
"id" : "CF37E70B-D810-4CF2-AB41-571BAFF72572",
5+
"name" : "Default",
6+
"options" : {
7+
8+
}
9+
},
10+
{
11+
"id" : "33436295-E24E-439B-9B8E-4602E0A6C8BB",
12+
"name" : "TSan",
13+
"options" : {
14+
"threadSanitizerEnabled" : true
15+
}
16+
}
17+
],
18+
"defaultOptions" : {
19+
"codeCoverage" : false
20+
},
21+
"testTargets" : [
22+
{
23+
"parallelizable" : true,
24+
"target" : {
25+
"containerPath" : "container:Atomics.xcodeproj",
26+
"identifier" : "7D489E4629CE969D00499B21",
27+
"name" : "AtomicsTests"
28+
}
29+
}
30+
],
31+
"version" : 1
32+
}

0 commit comments

Comments
 (0)