forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiteration.swift
37 lines (32 loc) · 947 Bytes
/
iteration.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// RUN: %target-swift-frontend %s -emit-ir -g -o %t.ll
// RUN: FileCheck %s < %t.ll
func markUsed<T>(t: T) {}
var puzzleOutput: [String] = []
// CHECK-NOT: !DILocalVariable(name: "$letter$generator"
// CHECK: !DILocalVariable(name: "letter",
// CHECK-SAME: line: [[@LINE+1]]
for letter in [ "g", "r", "e", "a", "t" ] {
switch letter {
case "a", "e", "i", "o", "u", " ":
continue
default:
puzzleOutput.append(letter)
}
}
markUsed(puzzleOutput)
func count() {
// CHECK-NOT: !DILocalVariable(name: "$i$generator"
// CHECK: !DILocalVariable(name: "i",
// CHECK-SAME: line: [[@LINE+1]]
for i in 0...100 {
markUsed(i)
}
}
count()
// End-to-end test:
// RUN: llc %t.ll -filetype=obj -o - | llvm-dwarfdump - | FileCheck %s --check-prefix DWARF-CHECK
// DWARF-CHECK: DW_TAG_variable
// DWARF-CHECK: DW_AT_name {{.*}} "letter"
//
// DWARF-CHECK: DW_TAG_variable
// DWARF-CHECK: DW_AT_name {{.*}} "i"