1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s -fexceptions -std=c++11 -debug-info-kind=limited | FileCheck %s
2
__anonef1ec7e80102(int i) 3 auto var = [](int i) { return i+1; };
4 void *use = &var;
5
__anonef1ec7e80202null6 extern "C" auto cvar = []{};
7
a()8 int a() { return []{ return 1; }(); }
9
b(int x)10 int b(int x) { return [x]{return x;}(); }
11
c(int x)12 int c(int x) { return [&x]{return x;}(); }
13
14 struct D { D(); D(const D&); int x; };
d(int x)15 int d(int x) { D y[10]; return [x,y] { return y[x].x; }(); }
16
17 // Randomness for file. -- 6
18 // CHECK: [[FILE:.*]] = !DIFile(filename: "{{.*}}debug-lambda-expressions.cpp",
19
20 // CVAR:
21 // CHECK: !DIGlobalVariable(name: "cvar"
22 // CHECK-SAME: line: [[CVAR_LINE:[0-9]+]]
23 // CHECK-SAME: type: ![[CVAR_T:[0-9]+]]
24 // CHECK: ![[CVAR_T]] = distinct !DICompositeType(tag: DW_TAG_class_type
25 // CHECK-SAME: line: [[CVAR_LINE]],
26 // CHECK-SAME: elements: ![[CVAR_ARGS:[0-9]+]]
27 // CHECK: ![[CVAR_ARGS]] = !{!{{[0-9]+}}}
28
29 // VAR:
30 // CHECK: !DIGlobalVariable(name: "var"
31 // CHECK-SAME: line: [[VAR_LINE:[0-9]+]]
32 // CHECK-SAME: type: ![[VAR_T:[0-9]+]]
33 // CHECK: ![[VAR_T]] = distinct !DICompositeType(tag: DW_TAG_class_type
34 // CHECK-SAME: line: [[VAR_LINE]],
35 // CHECK-SAME: elements: ![[VAR_ARGS:[0-9]+]]
36 // CHECK: ![[VAR_ARGS]] = !{!{{[0-9]+}}}
37
38 // CHECK: ![[INT:[0-9]+]] = !DIBasicType(name: "int"
39
40 // A: 10
41 // CHECK: ![[A_FUNC:.*]] = distinct !DISubprogram(name: "a"{{.*}}, line: [[A_LINE:[0-9]+]]{{.*}}, isDefinition: true
42
43 // Back to A. -- 78
44 // CHECK: ![[LAM_A:.*]] = distinct !DICompositeType(tag: DW_TAG_class_type{{.*}}, scope: ![[A_FUNC]]{{.*}}, line: [[A_LINE]],
45 // CHECK-SAME: elements: ![[LAM_A_ARGS:[0-9]+]]
46 // CHECK: ![[LAM_A_ARGS]] = !{![[CON_LAM_A:[0-9]+]]}
47 // CHECK: ![[CON_LAM_A]] = !DISubprogram(name: "operator()"
48 // CHECK-SAME: scope: ![[LAM_A]]
49 // CHECK-SAME: line: [[A_LINE]]
50 // CHECK-SAME: DIFlagPublic
51
52 // B: 14
53 // CHECK: ![[B_FUNC:.*]] = distinct !DISubprogram(name: "b"{{.*}}, line: [[B_LINE:[0-9]+]]{{.*}}, isDefinition: true
54
55 // Back to B. -- 67
56 // CHECK: ![[LAM_B:.*]] = distinct !DICompositeType(tag: DW_TAG_class_type{{.*}}, scope: ![[B_FUNC]]{{.*}}, line: [[B_LINE]],
57 // CHECK-SAME: elements: ![[LAM_B_ARGS:[0-9]+]]
58 // CHECK: ![[LAM_B_ARGS]] = !{![[CAP_B:[0-9]+]], ![[CON_LAM_B:[0-9]+]]}
59 // CHECK: ![[CAP_B]] = !DIDerivedType(tag: DW_TAG_member, name: "x"
60 // CHECK-SAME: scope: ![[LAM_B]]
61 // CHECK-SAME: line: [[B_LINE]],
62 // CHECK-SAME: baseType: ![[INT]]
63 // CHECK: ![[CON_LAM_B]] = !DISubprogram(name: "operator()"
64 // CHECK-SAME: scope: ![[LAM_B]]
65 // CHECK-SAME: line: [[B_LINE]]
66 // CHECK-SAME: DIFlagPublic
67
68 // C: 17
69 // CHECK: ![[C_FUNC:.*]] = distinct !DISubprogram(name: "c"{{.*}}, line: [[C_LINE:[0-9]+]]{{.*}}, isDefinition: true
70
71 // Back to C. -- 55
72 // CHECK: ![[LAM_C:.*]] = distinct !DICompositeType(tag: DW_TAG_class_type{{.*}}, scope: ![[C_FUNC]]{{.*}}, line: [[C_LINE]],
73 // CHECK-SAME: elements: ![[LAM_C_ARGS:[0-9]+]]
74 // CHECK: ![[LAM_C_ARGS]] = !{![[CAP_C:[0-9]+]], ![[CON_LAM_C:[0-9]+]]}
75 // CHECK: ![[CAP_C]] = !DIDerivedType(tag: DW_TAG_member, name: "x"
76 // CHECK-SAME: scope: ![[LAM_C]]
77 // CHECK-SAME: line: [[C_LINE]],
78 // CHECK-SAME: baseType: ![[TYPE_C_x:[0-9]+]]
79 // CHECK: ![[TYPE_C_x]] = !DIDerivedType(tag: DW_TAG_reference_type, baseType: ![[INT]]
80 // CHECK: ![[CON_LAM_C]] = !DISubprogram(name: "operator()"
81 // CHECK-SAME: scope: ![[LAM_C]]
82 // CHECK-SAME: line: [[C_LINE]]
83 // CHECK-SAME: DIFlagPublic
84
85 // D: 18
86 // CHECK: ![[D_FUNC:.*]] = distinct !DISubprogram(name: "d"{{.*}}, line: [[D_LINE:[0-9]+]]{{.*}}, isDefinition: true
87
88 // Back to D. -- 24
89 // CHECK: ![[LAM_D:.*]] = distinct !DICompositeType(tag: DW_TAG_class_type{{.*}}, scope: ![[D_FUNC]]{{.*}}, line: [[D_LINE]],
90 // CHECK-SAME: elements: ![[LAM_D_ARGS:[0-9]+]]
91 // CHECK: ![[LAM_D_ARGS]] = !{![[CAP_D_X:[0-9]+]], ![[CAP_D_Y:[0-9]+]], ![[CON_LAM_D:[0-9]+]]}
92 // CHECK: ![[CAP_D_X]] = !DIDerivedType(tag: DW_TAG_member, name: "x"
93 // CHECK-SAME: scope: ![[LAM_D]]
94 // CHECK-SAME: line: [[D_LINE]],
95 // CHECK: ![[CAP_D_Y]] = !DIDerivedType(tag: DW_TAG_member, name: "y"
96 // CHECK-SAME: scope: ![[LAM_D]]
97 // CHECK-SAME: line: [[D_LINE]],
98 // CHECK: ![[CON_LAM_D]] = !DISubprogram(name: "operator()"
99 // CHECK-SAME: scope: ![[LAM_D]]
100 // CHECK-SAME: line: [[D_LINE]]
101 // CHECK-SAME: DIFlagPublic
102