- Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathcoverage_nested.swift
32 lines (28 loc) · 1.56 KB
/
coverage_nested.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
// RUN: %target-swift-frontend -emit-sil -profile-generate -profile-coverage-mapping -Xllvm -sil-full-demangle -emit-sorted-sil -module-name coverage_nested %s | %FileCheck %s
// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -emit-ir %s
// https://github.com/apple/swift/issues/61129 – Make sure we don't emit
// duplicate coverage for a nested type.
// CHECK-LABEL: sil_coverage_map {{.*}} "$s15coverage_nested13hasNestedTypeyyF" {{.*}} // coverage_nested.hasNestedType() -> ()
// CHECK-NEXT: [[@LINE+2]]:22 -> [[@LINE+11]]:2 : 0
// CHECK-NEXT: }
func hasNestedType(){
structS{
// CHECK-LABEL: sil_coverage_map {{.*}} "$s15coverage_nested13hasNestedTypeyyF1SL_V1iSivpfi" {{.*}} // variable initialization expression of i : Swift.Int in S #1 in coverage_nested.hasNestedType() -> ()
// CHECK-NEXT: [[@LINE+4]]:13 -> [[@LINE+4]]:30 : 0
// CHECK-NEXT: [[@LINE+3]]:25 -> [[@LINE+3]]:26 : 1
// CHECK-NEXT: [[@LINE+2]]:29 -> [[@LINE+2]]:30 : (0 - 1)
// CHECK-NEXT: }
vari=.random()?0:1
}
}
// CHECK-LABEL: sil_coverage_map {{.*}}// coverage_nested.call_auto_closure()
// CHECK-NEXT: [[@LINE+3]]:26 -> [[@LINE+10]]:2 : 0
// CHECK-NEXT: }
func call_auto_closure(){
// CHECK-LABEL: sil_coverage_map {{.*}}// use_auto_closure #1 (@autoclosure () -> Swift.Bool) -> Swift.Bool in coverage_nested.call_auto_closure()
// CHECK-NEXT: [[@LINE+1]]:63 -> [[@LINE+3]]:4 : 0
func use_auto_closure(_ x:@autoclosure()->Bool)->Bool{
returnx() // CHECK-COV: {{ *}}[[@LINE]]|{{ *}}1
}
let _ =use_auto_closure(false || true)
}