mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This adds the -profile-coverage-mapping option to swift, and teaches SILGenProfiling to generate mappings from source ranges to counters. Swift SVN r25266
18 lines
544 B
Swift
18 lines
544 B
Swift
// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_if %s | FileCheck %s
|
|
|
|
// CHECK-LABEL: sil_coverage_map {{.*}}// coverage_if.foo
|
|
func foo(x : Bool) { // CHECK: [[@LINE]]:20 -> {{[0-9]+}}:2 : 0
|
|
if (x) { // CHECK: [[@LINE]]:10 -> [[@LINE+1]]:4 : 1
|
|
}
|
|
|
|
if (!x) { // CHECK: [[@LINE]]:11 -> [[@LINE+2]]:4 : 2
|
|
// ...
|
|
}
|
|
|
|
if (x) { } // CHECK: [[@LINE]]:10 -> [[@LINE]]:13 : 3
|
|
else { } // CHECK: [[@LINE]]:10 -> [[@LINE]]:13 : (0 - 3)
|
|
}
|
|
|
|
foo(true);
|
|
foo(false);
|