mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Fill in source locations in implicit function builder expressions
to satisfy the code-coverage instrumentation. rdar://51612977
This commit is contained in:
31
test/Profiler/coverage_function_builder.swift
Normal file
31
test/Profiler/coverage_function_builder.swift
Normal file
@@ -0,0 +1,31 @@
|
||||
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sorted-sil -emit-sil -module-name coverage_functon_builder %s | %FileCheck %s
|
||||
|
||||
@_functionBuilder
|
||||
struct Summer {
|
||||
static func buildBlock(_ x: Int...) -> Int {
|
||||
return x.reduce(0, +)
|
||||
}
|
||||
static func buildIf(_ x: Int?) -> Int {
|
||||
return x ?? 0
|
||||
}
|
||||
}
|
||||
|
||||
// CHECK-LABEL: sil_coverage_map {{.*}} "$s24coverage_functon_builder5test0SiyF"
|
||||
@Summer
|
||||
func test0() -> Int {
|
||||
// CHECK: [[@LINE-1]]:21 -> [[@LINE+3]]:2 : 0
|
||||
18
|
||||
12
|
||||
}
|
||||
|
||||
// CHECK-LABEL: sil_coverage_map {{.*}} "$s24coverage_functon_builder5test1SiyF"
|
||||
@Summer
|
||||
func test1() -> Int {
|
||||
// CHECK: [[@LINE-1]]:21 -> [[@LINE+7]]:2 : 0
|
||||
18
|
||||
12
|
||||
if 7 < 23 {
|
||||
11
|
||||
8
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user