mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[embedded] Use Builtin.RawPointer as the argument type on swift_release_n
This commit is contained in:
@@ -154,12 +154,18 @@ func swift_retain_n_(object: UnsafeMutablePointer<HeapObject>, n: UInt32) -> Uns
|
|||||||
}
|
}
|
||||||
|
|
||||||
@_silgen_name("swift_release")
|
@_silgen_name("swift_release")
|
||||||
public func swift_release(object: UnsafeMutablePointer<HeapObject>?) {
|
public func swift_release(object: Builtin.RawPointer) {
|
||||||
swift_release_n(object: object, n: 1)
|
swift_release_n(object: object, n: 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@_silgen_name("swift_release_n")
|
@_silgen_name("swift_release_n")
|
||||||
public func swift_release_n(object: UnsafeMutablePointer<HeapObject>?, n: UInt32) {
|
public func swift_release_n(object: Builtin.RawPointer, n: UInt32) {
|
||||||
|
if Int(Builtin.ptrtoint_Word(object)) == 0 { return }
|
||||||
|
let o = UnsafeMutablePointer<HeapObject>(object)
|
||||||
|
swift_release_n_(object: o, n: n)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func swift_release_n_(object: UnsafeMutablePointer<HeapObject>?, n: UInt32) {
|
||||||
guard let object else {
|
guard let object else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
23
test/embedded/runtime-release.swift
Normal file
23
test/embedded/runtime-release.swift
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
// RUN: %target-run-simple-swift(%S/Inputs/print.swift -enable-experimental-feature Embedded -parse-as-library -runtime-compatibility-version none -wmo -Xfrontend -disable-objc-interop) | %FileCheck %s
|
||||||
|
// RUN: %target-run-simple-swift(%S/Inputs/print.swift -O -enable-experimental-feature Embedded -parse-as-library -runtime-compatibility-version none -wmo -Xfrontend -disable-objc-interop) | %FileCheck %s
|
||||||
|
// RUN: %target-run-simple-swift(%S/Inputs/print.swift -Osize -enable-experimental-feature Embedded -parse-as-library -runtime-compatibility-version none -wmo -Xfrontend -disable-objc-interop) | %FileCheck %s
|
||||||
|
|
||||||
|
// REQUIRES: executable_test
|
||||||
|
// REQUIRES: optimized_stdlib
|
||||||
|
// REQUIRES: VENDOR=apple
|
||||||
|
// REQUIRES: OS=macosx
|
||||||
|
|
||||||
|
@main
|
||||||
|
struct Main {
|
||||||
|
static func main() {
|
||||||
|
test()
|
||||||
|
print("Okay!")
|
||||||
|
// CHECK: Okay!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func test() -> [Int] {
|
||||||
|
var s: [Int] = []
|
||||||
|
s += []
|
||||||
|
return s
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user