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
3 auto var
= [](int i
) { return i
+1; };
6 extern "C" auto cvar
= []{};
8 int a() { return []{ return 1; }(); }
10 int b(int x
) { return [x
]{return x
;}(); }
12 int c(int x
) { return [&x
]{return x
;}(); }
14 struct D
{ D(); D(const D
&); int x
; };
15 int d(int x
) { D y
[10]; return [x
,y
] { return y
[x
].x
; }(); }
17 // Randomness for file. -- 6
20 // CHECK: !DIGlobalVariable(name: "var"
21 // CHECK-SAME: line: [[VAR_LINE:[0-9]+]]
22 // CHECK-SAME: type: ![[VAR_T:[0-9]+]]
24 // CHECK: [[FILE:.*]] = !DIFile(filename: "{{.*}}debug-lambda-expressions.cpp",
27 // CHECK: !DIGlobalVariable(name: "cvar"
28 // CHECK-SAME: line: [[CVAR_LINE:[0-9]+]]
29 // CHECK-SAME: type: ![[CVAR_T:[0-9]+]]
30 // CHECK: ![[CVAR_T]] = distinct !DICompositeType(tag: DW_TAG_class_type
31 // CHECK-SAME: line: [[CVAR_LINE]],
32 // CHECK-SAME: elements: ![[CVAR_ARGS:[0-9]+]]
33 // CHECK: ![[CVAR_ARGS]] = !{!{{[0-9]+}}}
35 // CHECK: ![[VAR_T]] = distinct !DICompositeType(tag: DW_TAG_class_type
36 // CHECK-SAME: line: [[VAR_LINE]],
37 // CHECK-SAME: elements: ![[VAR_ARGS:[0-9]+]]
38 // CHECK: ![[VAR_ARGS]] = !{!{{[0-9]+}}}
40 // CHECK: ![[INT:[0-9]+]] = !DIBasicType(name: "int"
43 // CHECK: ![[A_FUNC:.*]] = distinct !DISubprogram(name: "a"{{.*}}, line: [[A_LINE:[0-9]+]]{{.*}} DISPFlagDefinition
46 // CHECK: ![[LAM_A:.*]] = distinct !DICompositeType(tag: DW_TAG_class_type{{.*}}, scope: ![[A_FUNC]]{{.*}}, line: [[A_LINE]],
47 // CHECK-SAME: elements: ![[LAM_A_ARGS:[0-9]+]]
48 // CHECK: ![[LAM_A_ARGS]] = !{![[CON_LAM_A:[0-9]+]]}
49 // CHECK: ![[CON_LAM_A]] = !DISubprogram(name: "operator()"
50 // CHECK-SAME: scope: ![[LAM_A]]
51 // CHECK-SAME: line: [[A_LINE]]
52 // CHECK-SAME: DIFlagPublic
55 // CHECK: ![[B_FUNC:.*]] = distinct !DISubprogram(name: "b"{{.*}}, line: [[B_LINE:[0-9]+]]{{.*}} DISPFlagDefinition
58 // CHECK: ![[LAM_B:.*]] = distinct !DICompositeType(tag: DW_TAG_class_type{{.*}}, scope: ![[B_FUNC]]{{.*}}, line: [[B_LINE]],
59 // CHECK-SAME: elements: ![[LAM_B_ARGS:[0-9]+]]
60 // CHECK: ![[LAM_B_ARGS]] = !{![[CAP_B:[0-9]+]], ![[CON_LAM_B:[0-9]+]]}
61 // CHECK: ![[CAP_B]] = !DIDerivedType(tag: DW_TAG_member, name: "x"
62 // CHECK-SAME: scope: ![[LAM_B]]
63 // CHECK-SAME: line: [[B_LINE]],
64 // CHECK-SAME: baseType: ![[INT]]
65 // CHECK: ![[CON_LAM_B]] = !DISubprogram(name: "operator()"
66 // CHECK-SAME: scope: ![[LAM_B]]
67 // CHECK-SAME: line: [[B_LINE]]
68 // CHECK-SAME: DIFlagPublic
71 // CHECK: ![[C_FUNC:.*]] = distinct !DISubprogram(name: "c"{{.*}}, line: [[C_LINE:[0-9]+]]{{.*}} DISPFlagDefinition
74 // CHECK: ![[LAM_C:.*]] = distinct !DICompositeType(tag: DW_TAG_class_type{{.*}}, scope: ![[C_FUNC]]{{.*}}, line: [[C_LINE]],
75 // CHECK-SAME: elements: ![[LAM_C_ARGS:[0-9]+]]
76 // CHECK: ![[LAM_C_ARGS]] = !{![[CAP_C:[0-9]+]], ![[CON_LAM_C:[0-9]+]]}
77 // CHECK: ![[CAP_C]] = !DIDerivedType(tag: DW_TAG_member, name: "x"
78 // CHECK-SAME: scope: ![[LAM_C]]
79 // CHECK-SAME: line: [[C_LINE]],
80 // CHECK-SAME: baseType: ![[TYPE_C_x:[0-9]+]]
81 // CHECK: ![[TYPE_C_x]] = !DIDerivedType(tag: DW_TAG_reference_type, baseType: ![[INT]]
82 // CHECK: ![[CON_LAM_C]] = !DISubprogram(name: "operator()"
83 // CHECK-SAME: scope: ![[LAM_C]]
84 // CHECK-SAME: line: [[C_LINE]]
85 // CHECK-SAME: DIFlagPublic
88 // CHECK: ![[D_FUNC:.*]] = distinct !DISubprogram(name: "d"{{.*}}, line: [[D_LINE:[0-9]+]]{{.*}} DISPFlagDefinition
91 // CHECK: ![[LAM_D:.*]] = distinct !DICompositeType(tag: DW_TAG_class_type{{.*}}, scope: ![[D_FUNC]]{{.*}}, line: [[D_LINE]],
92 // CHECK-SAME: elements: ![[LAM_D_ARGS:[0-9]+]]
93 // CHECK: ![[LAM_D_ARGS]] = !{![[CAP_D_X:[0-9]+]], ![[CAP_D_Y:[0-9]+]], ![[CON_LAM_D:[0-9]+]]}
94 // CHECK: ![[CAP_D_X]] = !DIDerivedType(tag: DW_TAG_member, name: "x"
95 // CHECK-SAME: scope: ![[LAM_D]]
96 // CHECK-SAME: line: [[D_LINE]],
97 // CHECK: ![[CAP_D_Y]] = !DIDerivedType(tag: DW_TAG_member, name: "y"
98 // CHECK-SAME: scope: ![[LAM_D]]
99 // CHECK-SAME: line: [[D_LINE]],
100 // CHECK: ![[CON_LAM_D]] = !DISubprogram(name: "operator()"
101 // CHECK-SAME: scope: ![[LAM_D]]
102 // CHECK-SAME: line: [[D_LINE]]
103 // CHECK-SAME: DIFlagPublic