mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
* Group tests for profiling instrumentation together, NFC This will make it easier to test changes to the code coverage logic. There are a handful of tests which relate to profiling which I have not moved. These include tests for the driver and for the SIL optimizer. It makes more sense to keep those tests where they are. * Rename a test file, NFC This file tests code coverage of primary files, so I've changed the name of the file to reflect that. * Simplify the check lines in a test, NFC This file tests code coverage of closures. It had several check lines which obscured the meaning of the test, and its check lines were in a strange order. Remove the extra checks and disable -emit-sorted-sil.
42 lines
1.2 KiB
Swift
42 lines
1.2 KiB
Swift
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sil -module-name coverage_class %s | %FileCheck %s
|
|
|
|
class C {
|
|
// CHECK-LABEL: sil_coverage_map {{.*}}// coverage_class.C.foo
|
|
func foo() {}
|
|
// CHECK: sil_coverage_map {{.*}}// __ntd_C_line:[[@LINE-3]]:1
|
|
// CHECK-NEXT: [[@LINE+1]]:10 -> [[@LINE+1]]:12
|
|
init() {}
|
|
// CHECK-LABEL: sil_coverage_map {{.*}}// coverage_class.C.__deallocating_deinit
|
|
deinit {}
|
|
}
|
|
|
|
extension C {
|
|
// CHECK-LABEL: sil_coverage_map {{.*}}// coverage_class.C.bar
|
|
func bar() {}
|
|
}
|
|
|
|
struct S {
|
|
// CHECK-LABEL: sil_coverage_map {{.*}}// coverage_class.S.foo
|
|
func foo() {}
|
|
// CHECK: sil_coverage_map {{.*}}// __ntd_S_line:[[@LINE-3]]:1
|
|
init() {}
|
|
}
|
|
|
|
enum E {
|
|
case X, Y, Z
|
|
// CHECK-LABEL: sil_coverage_map {{.*}}// coverage_class.E.foo
|
|
func foo() {}
|
|
// CHECK: sil_coverage_map {{.*}}// __ntd_E_line:[[@LINE-4]]:1
|
|
// CHECK-NEXT: [[@LINE+1]]:10 -> [[@LINE+1]]:23
|
|
init() { self = .Y }
|
|
}
|
|
|
|
var g1: Bool = true
|
|
|
|
struct S2 {
|
|
// CHECK: sil_coverage_map {{.*}}// __ntd_S2_line:[[@LINE-1]]:1
|
|
// CHECK-NEXT: [[@LINE+2]]:22 -> [[@LINE+2]]:23 : 0
|
|
// CHECK-NEXT: [[@LINE+1]]:26 -> [[@LINE+1]]:27 : (1 - 0)
|
|
var m1: Int = g1 ? 0 : 1
|
|
}
|