File: closure-multivalue.swift

package info (click to toggle)
swiftlang 6.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,532 kB
  • sloc: cpp: 9,901,743; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (43 lines) | stat: -rw-r--r-- 1,842 bytes parent folder | download
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
38
39
40
41
42
43

// rdar://problem/23727705:
// RUN-DISABLED: %target-swift-frontend -O %s -disable-llvm-optzns -emit-ir -g -o - | %FileCheck %s
import StdlibUnittest

// CHECK: define {{.*}}i1 {{.*}}4main4sort
// CHECK: #dbg_value(i8*{{.*}}, ![[A:.*]], ![[P1:.*]]
// CHECK: #dbg_value(i{{[0-9]+}} {{.*}}, ![[A]], ![[P2:.*]]
// CHECK: #dbg_value(i{{[0-9]+}} {{.*}}, ![[A]], ![[P3:.*]]
// CHECK: #dbg_value(i8*{{.*}}, ![[B:.*]], ![[P1]]
// CHECK: #dbg_value(i{{[0-9]+}} {{.*}}, ![[B]], ![[P2]]
// CHECK: #dbg_value(i{{[0-9]+}} {{.*}}, ![[B]], ![[P3]]
// CHECK-DAG: ![[A]] = !DILocalVariable(name: "a",{{.*}} line: 17
// CHECK-DAG: ![[B]] = !DILocalVariable(name: "b",{{.*}} line: 17
// CHECK-DAG: ![[P1]] = !DIExpression(DW_OP_bit_piece, 0, {{(32|64)}})
// CHECK-DAG: ![[P2]] = !DIExpression(DW_OP_bit_piece, {{(32, 32|64, 64)}})
// CHECK-DAG: ![[P3]] = !DIExpression(DW_OP_bit_piece, {{(64, 32|128, 64)}})
public func sort(_ a: String, b: String) -> Bool {
  _blackHole("Sorting..\(a) & \(b)")
  return (a < b)
}

public func demo() {
    let names = ["Sean", "Barry", "Kate"]
    let sortedNames = names.sorted(by: sort)
    var sortedNamesAsString : String = String()
    for name in sortedNames {
        sortedNamesAsString += ("\(name), ")
    }
    _blackHole(sortedNamesAsString)
}
demo()

// At -O0, we should have a single aggregate argument.
// RUN: %target-swift-frontend %s -emit-ir -g -o - | %FileCheck %s --check-prefix=CHECK-O0
// Verify that a reabstraction thunk does not have a line number.
// CHECK-O0-NOT: DW_OP_bit_piece
// CHECK-O0-NOT: DW_OP_bit_piece
// CHECK-O0: !DILocalVariable(name: "a", arg: 1{{.*}} line: 18,
// CHECK-O0-NOT: DW_OP_bit_piece
// CHECK-O0: !DILocalVariable(name: "b", arg: 2{{.*}} line: 18,
// CHECK-O0-NOT: DW_OP_bit_piece
// CHECK-O0: !DISubprogram(linkageName: "$sS2SSbs5Error_pIgggdzo_S2SSbsAA_pIegnndzo_TR",