Skip to content

Commit 90266da

Browse files
committed
Make Atomic.deinit @_transparent
1 parent aa3836f commit 90266da

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

include/swift/AST/DeclAttr.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ DECL_ATTR(_semantics, Semantics,
102102
OnAbstractFunction | OnSubscript | OnNominalType | OnVar | AllowMultipleAttributes | UserInaccessible | ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIStableToRemove,
103103
21)
104104
SIMPLE_DECL_ATTR(_transparent, Transparent,
105-
OnFunc | OnAccessor | OnConstructor | OnVar | UserInaccessible | ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIStableToRemove,
105+
OnFunc | OnAccessor | OnConstructor | OnVar | OnDestructor | UserInaccessible | ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIStableToRemove,
106106
26)
107107
SIMPLE_DECL_ATTR(requires_stored_property_inits, RequiresStoredPropertyInits,
108108
OnClass | ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIStableToRemove,

lib/SILOptimizer/Mandatory/PredictableMemOpt.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,9 @@ void AvailableValueAggregationFixup::addHandOffCopyDestroysForPhis(
10371037
// TODO: use standard lifetime completion
10381038
void AvailableValueAggregationFixup::addMissingDestroysForCopiedValues(
10391039
SILInstruction *load, SILValue newVal) {
1040+
if (!load->getFunction()->hasOwnership()) {
1041+
load->getFunction()->dump();
1042+
}
10401043
assert(load->getFunction()->hasOwnership() &&
10411044
"We assume this is only called if we have ownership");
10421045

stdlib/public/Synchronization/Atomics/Atomic.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,10 @@ public struct Atomic<Value: AtomicRepresentable>: ~Copyable {
4242
_address.initialize(to: Value.encodeAtomicRepresentation(initialValue))
4343
}
4444

45-
// Deinit's can't be marked @_transparent. Do these things need all of these
46-
// attributes..?
4745
@available(SwiftStdlib 6.0, *)
4846
@_alwaysEmitIntoClient
4947
@inlinable
48+
@_transparent
5049
deinit {
5150
let oldValue = Value.decodeAtomicRepresentation(_address.pointee)
5251
_ = consume oldValue

test/attr/attributes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protocol ProtoWithTransparent {
6868
class TestTranspClass : ProtoWithTransparent {
6969
@_transparent // expected-error{{'@_transparent' attribute is not supported on declarations within classes}} {{3-17=}}
7070
init () {}
71-
@_transparent // expected-error{{'@_transparent' attribute cannot be applied to this declaration}} {{3-17=}}
71+
@_transparent // expected-error{{'@_transparent' attribute is not supported on declarations within classes}} {{3-17=}}
7272
deinit {}
7373
@_transparent // expected-error{{'@_transparent' attribute is not supported on declarations within classes}} {{3-17=}}
7474
class func transStatic() {}

0 commit comments

Comments
 (0)