Files
swift-mirror/test/DebugInfo/for_header.swift
Hamish Knight df187348bc [test] Add some extra for loop tests
Add some test cases that were uncovered when doing source compatibility
testing for the for loop rework.
2026-01-18 23:25:52 +00:00

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