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.
34 lines
1.1 KiB
Swift
34 lines
1.1 KiB
Swift
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_ternary %s | %FileCheck %s
|
|
|
|
// CHECK-LABEL: sil hidden @$S16coverage_ternary3barCACycfc
|
|
// CHECK-NOT: return
|
|
// CHECK: builtin "int_instrprof_increment"
|
|
|
|
// CHECK-LABEL: sil hidden @$S16coverage_ternary3barCfD
|
|
// CHECK-NOT: return
|
|
// CHECK: builtin "int_instrprof_increment"
|
|
|
|
var flag: Int = 0
|
|
|
|
// CHECK-LABEL: sil_coverage_map {{.*}}// coverage_ternary.foo
|
|
func foo(_ x : Int32) -> Int32 {
|
|
return x == 3
|
|
? 9000 // CHECK: [[@LINE]]:16 -> [[@LINE]]:20 : 1
|
|
: 1234 // CHECK: [[@LINE]]:16 -> [[@LINE]]:20 : (0 - 1)
|
|
}
|
|
|
|
foo(1)
|
|
foo(2)
|
|
foo(3)
|
|
|
|
// rdar://problem/23256795 - Avoid crash if an if_expr has no parent
|
|
// CHECK: sil_coverage_map {{.*}}// __ntd_bar_line:[[@LINE+1]]
|
|
class bar {
|
|
var m1 = flag == 0
|
|
? "false" // CHECK: [[@LINE]]:16 -> [[@LINE]]:23 : 0
|
|
: "true"; // CHECK: [[@LINE]]:16 -> [[@LINE]]:22 : (1 - 0)
|
|
}
|
|
|
|
// Note: We didn't instantiate bar, but we still expect to see instrumentation
|
|
// for its *structors, and coverage mapping information for it.
|