mirror of
https://github.com/apple/swift.git
synced 2026-02-27 18:26:24 +01:00
Add some test cases that were uncovered when doing source compatibility testing for the for loop rework.
16 lines
665 B
Swift
16 lines
665 B
Swift
// RUN: %target-swift-frontend -emit-irgen -module-name for_each -g %s | %FileCheck %s
|
|
|
|
// Make sure we have debug info locations for the header and end of the loop
|
|
// for the corresponding branches.
|
|
// CHECK-LABEL: define hidden swiftcc void @"$s8for_each3fooyySaySiGF"(ptr %0)
|
|
func foo(_ xs: [Int]) {
|
|
for _ in xs {
|
|
// CHECK: [[LOOP_HEADER:[0-9]+]]:
|
|
// CHECK: br i1 {{.*}}, label {{.*}}, label {{.*}}, !dbg [[HEADER_LOC:![0-9]+]]
|
|
//
|
|
// CHECK: br label %[[LOOP_HEADER]], !dbg [[END_LOC:![0-9]+]]
|
|
}
|
|
}
|
|
// CHECK-DAG: [[HEADER_LOC]] = !DILocation(line: [[@LINE-7]], column: 3
|
|
// CHECK-DAG: [[END_LOC]] = !DILocation(line: [[@LINE-3]], column: 3
|