- Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathcoverage_guard.swift
23 lines (18 loc) · 815 Bytes
/
coverage_guard.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_guard %s | %FileCheck %s
// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -emit-ir %s
// CHECK-LABEL: sil_coverage_map {{.*}}// coverage_guard.foo
func foo(_ x :Int32){ // CHECK: [[@LINE]]:23 -> [[END:[0-9]+:2]] : 0
guard x >1else{ // CHECK: [[@LINE]]:20 -> [[@LINE+2]]:4 : 1
return
} // CHECK: [[@LINE]]:4 -> [[END]] : (0 - 1)
guardlet y :Bool?= x ==3?true:nilelse{ // CHECK: [[@LINE]]:50 ->
return
} // CHECK: [[@LINE]]:4 -> [[END]] : ((0 - 1) - 2)
guard y! else{ // CHECK: [[@LINE]]:17 ->
return
} // CHECK: [[@LINE]]:4 -> [[END]] : (((0 - 1) - 2) - 4)
letz= x
}
foo(1);
foo(2);
foo(3);