Skip to content

Commit 0d65205

Browse files
committed
Pre-commit debug_scope_distinct.swift LIT test
1 parent 46e98c1 commit 0d65205

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

test/IRGen/debug_scope_distinct.swift

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swiftc_driver -DM -emit-module -emit-module-path %t/M.swiftmodule %s -module-name M
3+
// RUN: %target-swiftc_driver -O -g -I %t -c %s -emit-ir -o - | %FileCheck %s
4+
5+
// CHECK: define {{.*}} void @"$s4main1TV13TangentVectorV1poiyA2E_AEtFZTm"
6+
// CHECK: entry:
7+
// CHECK-NEXT: call void @llvm.dbg.declare(metadata %TSb* undef, metadata ![[VAR1:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 192, 8)), !dbg ![[LOC1:[0-9]+]]
8+
// CHECK-NEXT: call void @llvm.dbg.declare(metadata %TSb* undef, metadata ![[VAR2:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 192, 8)), !dbg ![[LOC1]]
9+
// CHECK-NEXT: call void @llvm.dbg.declare(metadata %TSb* undef, metadata ![[VAR1]], metadata !DIExpression(DW_OP_LLVM_fragment, 192, 8)), !dbg ![[LOC1]]
10+
// CHECK-NEXT: call void @llvm.dbg.declare(metadata %TSb* undef, metadata ![[VAR2]], metadata !DIExpression(DW_OP_LLVM_fragment, 192, 8)), !dbg ![[LOC1]]
11+
12+
// CHECK: ![[VAR1]] = !DILocalVariable(name: "lhs", arg: 1, scope: ![[SCOPE:[0-9]+]]
13+
// CHECK: ![[VAR2]] = !DILocalVariable(name: "rhs", arg: 2, scope: ![[SCOPE:[0-9]+]]
14+
15+
// CHECK: ![[LOC1]] = !DILocation(line: 0, scope: ![[SCOPE]], inlinedAt: ![[LOCINL1:[0-9]+]])
16+
// CHECK: ![[LOCINL1]] = !DILocation(line: 0, scope: ![[SUBPROG:[0-9]+]])
17+
// CHECK: ![[SUBPROG]] = distinct !DISubprogram(name: "+", linkageName: "$s4main1TV13TangentVectorV1poiyA2E_AEtFZ"
18+
19+
#if M
20+
import _Differentiation
21+
22+
public struct S<T> {
23+
class C {}
24+
let c: C
25+
internal var b: Bool
26+
}
27+
28+
extension S: AdditiveArithmetic {
29+
public static var zero: S { fatalError() }
30+
31+
public static func == (_ lhs: S, _ rhs: S) -> Bool { fatalError() }
32+
public static func + (_ lhs: S, _ rhs: S) -> S { fatalError() }
33+
public static func - (_ lhs: S, _ rhs: S) -> S { fatalError() }
34+
}
35+
36+
extension S: Differentiable {
37+
public typealias TangentVector = S
38+
}
39+
40+
#else
41+
import _Differentiation
42+
import M
43+
44+
struct T: Differentiable {
45+
var u1: U
46+
var u2: U
47+
}
48+
49+
struct U: Differentiable {
50+
var s: S<Float>
51+
var v: V
52+
}
53+
54+
struct V: Differentiable {
55+
var s: S<Float>
56+
}
57+
#endif

0 commit comments

Comments
 (0)