-
Notifications
You must be signed in to change notification settings - Fork 10.4k
/
Copy patharc_36509461.swift
57 lines (45 loc) · 1.38 KB
/
arc_36509461.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// RUN: %empty-directory(%t)
// RUN: %target-clang -x objective-c -c %S/Inputs/arc_36509461.m -o %t/arc_36509461.m.o
// RUN: %target-swift-frontend -c -O -import-objc-header %S/Inputs/arc_36509461.h -sanitize=address %s -o %t/arc_36509461.swift.o
// RUN: %target-build-swift %t/arc_36509461.m.o %t/arc_36509461.swift.o -sanitize=address -o %t/arc_36509461
// RUN: %target-codesign %t/arc_36509461
// RUN: %target-run %t/arc_36509461
// REQUIRES: executable_test
// REQUIRES: asan_runtime
// REQUIRES: objc_interop
// REQUIRES: OS=macosx
import Foundation
struct FakeUUID {
var bigTuple: (UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8)
init() {
bigTuple = (0, 0, 0, 0, 0, 0, 0, 0)
}
}
struct Record {
let name: String
let uuid: FakeUUID
let storage: NSObject
init(storage: NSObject, name: String, uuid: FakeUUID) {
self.name = name
self.uuid = uuid
self.storage = storage
}
func copy() -> Record {
let copiedNSObject = NSObject()
fake_apply(self.storage) { (key, value) -> Bool in
let x = copiedNSObject
return true
}
var record = Record(storage: copiedNSObject, name: self.name, uuid: self.uuid)
return record
}
}
@inline(never)
func foo(record: Record) -> Record {
return record.copy()
}
func main() {
let record = Record(storage: NSObject(), name: "", uuid: FakeUUID())
_ = foo(record: record)
}
main()