@@ -375,35 +375,37 @@ Runtime.test("demangleName") {
375
375
expectEqual("Foobar", _stdlib_demangleName("$s13__lldb_expr_46FoobarCD"))
376
376
}
377
377
378
- Runtime.test("demangleTruncate") {
379
- // Swift.Int requires 10 bytes to be fully demangled.
380
- let buffer = UnsafeMutableBufferPointer<Int8>.allocate(capacity: 10)
381
-
382
- defer { buffer.deallocate() }
383
-
384
- // Set last byte to a custom number, that way when we call swift_demangle
385
- // the last byte should be unchanged rather than it being set to 0.
386
- buffer[buffer.count - 1] = 16
387
-
388
- // Only give 9 bytes though to exercise that swift_demangle doesn't write past
389
- // the buffer.
390
- var bufferSize = UInt(buffer.count - 1)
391
-
392
- let mangled = "$sSi"
393
-
394
- mangled.utf8CString.withUnsafeBufferPointer {
395
- _ = _stdlib_demangleImpl(
396
- mangledName: $0.baseAddress,
397
- mangledNameLength: UInt($0.count - 1),
398
- outputBuffer: buffer.baseAddress,
399
- outputBufferSize: &bufferSize,
400
- flags: 0
401
- )
402
- }
378
+ if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) {
379
+ Runtime.test("demangleTruncate") {
380
+ // Swift.Int requires 10 bytes to be fully demangled.
381
+ let buffer = UnsafeMutableBufferPointer<Int8>.allocate(capacity: 10)
382
+
383
+ defer { buffer.deallocate() }
384
+
385
+ // Set last byte to a custom number, that way when we call swift_demangle
386
+ // the last byte should be unchanged rather than it being set to 0.
387
+ buffer[buffer.count - 1] = 16
388
+
389
+ // Only give 9 bytes though to exercise that swift_demangle doesn't write past
390
+ // the buffer.
391
+ var bufferSize = UInt(buffer.count - 1)
392
+
393
+ let mangled = "$sSi"
394
+
395
+ mangled.utf8CString.withUnsafeBufferPointer {
396
+ _ = _stdlib_demangleImpl(
397
+ mangledName: $0.baseAddress,
398
+ mangledNameLength: UInt($0.count - 1),
399
+ outputBuffer: buffer.baseAddress,
400
+ outputBufferSize: &bufferSize,
401
+ flags: 0
402
+ )
403
+ }
403
404
404
- expectEqual(String(cString: buffer.baseAddress!), "Swift.In")
405
- expectEqual(bufferSize, 10)
406
- expectEqual(buffer[buffer.count - 1], 16)
405
+ expectEqual(String(cString: buffer.baseAddress!), "Swift.In")
406
+ expectEqual(bufferSize, 10)
407
+ expectEqual(buffer[buffer.count - 1], 16)
408
+ }
407
409
}
408
410
409
411
% for optionality in ['', '?']:
0 commit comments