Skip to content

Commit 78430f4

Browse files
authored
Merge pull request #61009 from eeckstein/fix-builtins
stdlib: fix compilation error when compiling with an old compiler
2 parents 29f745a + 9c1e7ca commit 78430f4

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

stdlib/public/core/StringSwitch.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ func _findStringSwitchCaseWithCache(
6868
string: String,
6969
cache: inout _OpaqueStringSwitchCache) -> Int {
7070

71+
#if $BuiltinUnprotectedAddressOf
7172
let ptr = UnsafeMutableRawPointer(Builtin.unprotectedAddressOf(&cache))
73+
#else
74+
let ptr = UnsafeMutableRawPointer(Builtin.addressof(&cache))
75+
#endif
7276
let oncePtr = ptr
7377
let cacheRawPtr = oncePtr + MemoryLayout<Builtin.Word>.stride
7478
let cachePtr = cacheRawPtr.bindMemory(to: _StringSwitchCache.self, capacity: 1)

stdlib/public/core/UnsafeRawBufferPointer.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ public func _withUnprotectedUnsafeBytes<T, Result>(
10951095
#if $BuiltinUnprotectedAddressOf
10961096
let addr = UnsafeRawPointer(Builtin.unprotectedAddressOfBorrow(value))
10971097
#else
1098-
let addr = UnsafeRawPointer(Builtin.addressof(value))
1098+
let addr = UnsafeRawPointer(Builtin.addressOfBorrow(value))
10991099
#endif
11001100
let buffer = UnsafeRawBufferPointer(start: addr, count: MemoryLayout<T>.size)
11011101
return try body(buffer)

0 commit comments

Comments
 (0)