@@ -63,7 +63,11 @@ public class RawSyntaxArena {
63
63
///
64
64
/// - Important: This is only intended to be used for assertions to catch
65
65
/// retain cycles in syntax arenas.
66
- fileprivate let hasParent : UnsafeMutablePointer < AtomicBool >
66
+ /// - Note: `UnsafeMutableRawPointer` + casting accessor is a workaround to silence the warning 'cannot bypass resilience'.
67
+ private let _hasParent : UnsafeMutableRawPointer
68
+ fileprivate func hasParent( ) -> UnsafeMutablePointer < AtomicBool > {
69
+ _hasParent. assumingMemoryBound ( to: AtomicBool . self)
70
+ }
67
71
#endif
68
72
69
73
/// Construct a new ``RawSyntaxArena`` in which syntax nodes can be allocated.
@@ -75,7 +79,7 @@ public class RawSyntaxArena {
75
79
self . allocator = BumpPtrAllocator ( initialSlabSize: slabSize)
76
80
self . childRefs = [ ]
77
81
#if DEBUG || SWIFTSYNTAX_ENABLE_ASSERTIONS
78
- self . hasParent = swiftsyntax_atomic_bool_create ( false )
82
+ self . _hasParent = UnsafeMutableRawPointer ( swiftsyntax_atomic_bool_create ( false ) )
79
83
#endif
80
84
}
81
85
@@ -84,7 +88,7 @@ public class RawSyntaxArena {
84
88
child. release ( )
85
89
}
86
90
#if DEBUG || SWIFTSYNTAX_ENABLE_ASSERTIONS
87
- swiftsyntax_atomic_bool_destroy ( self . hasParent)
91
+ swiftsyntax_atomic_bool_destroy ( self . hasParent ( ) )
88
92
#endif
89
93
}
90
94
@@ -153,7 +157,7 @@ public class RawSyntaxArena {
153
157
154
158
#if DEBUG || SWIFTSYNTAX_ENABLE_ASSERTIONS
155
159
precondition (
156
- !swiftsyntax_atomic_bool_get( self . hasParent) ,
160
+ !swiftsyntax_atomic_bool_get( self . hasParent ( ) ) ,
157
161
" an arena can't have a new child once it's owned by other arenas "
158
162
)
159
163
#endif
@@ -299,12 +303,12 @@ struct RawSyntaxArenaRef: Hashable, @unchecked Sendable {
299
303
#if DEBUG || SWIFTSYNTAX_ENABLE_ASSERTIONS
300
304
/// Accessor for the underlying's `RawSyntaxArena.hasParent`
301
305
var hasParent : Bool {
302
- swiftsyntax_atomic_bool_get ( value. hasParent)
306
+ swiftsyntax_atomic_bool_get ( value. hasParent ( ) )
303
307
}
304
308
305
309
/// Sets the `RawSyntaxArena.hasParent` on the referenced arena.
306
310
func setHasParent( _ newValue: Bool ) {
307
- swiftsyntax_atomic_bool_set ( value. hasParent, newValue)
311
+ swiftsyntax_atomic_bool_set ( value. hasParent ( ) , newValue)
308
312
}
309
313
#endif
310
314
0 commit comments