1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s -fexceptions -std=c++11 -g | FileCheck %s
2f4a2713aSLionel Sambuc
__anon509b95d20102(int i) 3f4a2713aSLionel Sambuc auto var = [](int i) { return i+1; };
4f4a2713aSLionel Sambuc void *use = &var;
5f4a2713aSLionel Sambuc
__anon509b95d20202null6f4a2713aSLionel Sambuc extern "C" auto cvar = []{};
7f4a2713aSLionel Sambuc
a()8f4a2713aSLionel Sambuc int a() { return []{ return 1; }(); }
9f4a2713aSLionel Sambuc
b(int x)10f4a2713aSLionel Sambuc int b(int x) { return [x]{return x;}(); }
11f4a2713aSLionel Sambuc
c(int x)12f4a2713aSLionel Sambuc int c(int x) { return [&x]{return x;}(); }
13f4a2713aSLionel Sambuc
14f4a2713aSLionel Sambuc struct D { D(); D(const D&); int x; };
d(int x)15f4a2713aSLionel Sambuc int d(int x) { D y[10]; return [x,y] { return y[x].x; }(); }
16f4a2713aSLionel Sambuc
17f4a2713aSLionel Sambuc // Randomness for file. -- 6
18f4a2713aSLionel Sambuc // CHECK: [[FILE:.*]] = {{.*}} [ DW_TAG_file_type ] [{{.*}}debug-lambda-expressions.cpp]
19f4a2713aSLionel Sambuc
20f4a2713aSLionel Sambuc // A: 10
21f4a2713aSLionel Sambuc // CHECK: [[A_FUNC:.*]] = {{.*}} [ DW_TAG_subprogram ] [line [[A_LINE:.*]]] [def] [a]
22f4a2713aSLionel Sambuc
23f4a2713aSLionel Sambuc // B: 14
24f4a2713aSLionel Sambuc // CHECK: [[B_FUNC:.*]] = {{.*}} [ DW_TAG_subprogram ] [line [[B_LINE:.*]]] [def] [b]
25f4a2713aSLionel Sambuc
26f4a2713aSLionel Sambuc // C: 17
27f4a2713aSLionel Sambuc // CHECK: [[C_FUNC:.*]] = {{.*}} [ DW_TAG_subprogram ] [line [[C_LINE:.*]]] [def] [c]
28f4a2713aSLionel Sambuc
29f4a2713aSLionel Sambuc // D: 18
30f4a2713aSLionel Sambuc // CHECK: [[D_FUNC:.*]] = {{.*}} [ DW_TAG_subprogram ] [line [[D_LINE:.*]]] [def] [d]
31f4a2713aSLionel Sambuc
32f4a2713aSLionel Sambuc // Back to D. -- 24
33*0a6a1f1dSLionel Sambuc // CHECK: [[LAM_D:.*]] = {{.*}}, [[D_FUNC]], {{.*}}, [[LAM_D_ARGS:.*]], null, null, null} ; [ DW_TAG_class_type ] [line [[D_LINE]],
34*0a6a1f1dSLionel Sambuc // CHECK: [[LAM_D_ARGS]] = !{[[CAP_D_X:.*]], [[CAP_D_Y:.*]], [[CON_LAM_D:.*]]}
35*0a6a1f1dSLionel Sambuc // CHECK: [[CAP_D_X]] = {{.*}}, [[LAM_D]], {{.*}} [ DW_TAG_member ] [x] [line [[D_LINE]],
36*0a6a1f1dSLionel Sambuc // CHECK: [[CAP_D_Y]] = {{.*}}, [[LAM_D]], {{.*}} [ DW_TAG_member ] [y] [line [[D_LINE]],
37*0a6a1f1dSLionel Sambuc // CHECK: [[CON_LAM_D]] = {{.*}}, [[LAM_D]], {{.*}} [ DW_TAG_subprogram ] [line [[D_LINE]]] [public] [operator()]
38f4a2713aSLionel Sambuc
39f4a2713aSLionel Sambuc
40f4a2713aSLionel Sambuc // Back to C. -- 55
41*0a6a1f1dSLionel Sambuc // CHECK: [[LAM_C:.*]] = {{.*}}, [[C_FUNC]], {{.*}}, [[LAM_C_ARGS:.*]], null, null, null} ; [ DW_TAG_class_type ] [line [[C_LINE]],
42*0a6a1f1dSLionel Sambuc // CHECK: [[LAM_C_ARGS]] = !{[[CAP_C:.*]], [[CON_LAM_C:.*]]}
43f4a2713aSLionel Sambuc // Ignoring the member type for now.
44*0a6a1f1dSLionel Sambuc // CHECK: [[CAP_C]] = {{.*}}, [[LAM_C]], {{.*}}} ; [ DW_TAG_member ] [x] [line [[C_LINE]],
45*0a6a1f1dSLionel Sambuc // CHECK: [[CON_LAM_C]] = {{.*}}, [[LAM_C]], {{.*}} [ DW_TAG_subprogram ] [line [[C_LINE]]] [public] [operator()]
46f4a2713aSLionel Sambuc
47f4a2713aSLionel Sambuc
48f4a2713aSLionel Sambuc // Back to B. -- 67
49*0a6a1f1dSLionel Sambuc // CHECK: [[LAM_B:.*]] = {{.*}}, [[B_FUNC]], {{.*}}, [[LAM_B_ARGS:.*]], null, null, null} ; [ DW_TAG_class_type ] [line [[B_LINE]],
50*0a6a1f1dSLionel Sambuc // CHECK: [[LAM_B_ARGS]] = !{[[CAP_B:.*]], [[CON_LAM_B:.*]]}
51*0a6a1f1dSLionel Sambuc // CHECK: [[CAP_B]] = {{.*}}, [[LAM_B]], {{.*}}} ; [ DW_TAG_member ] [x] [line [[B_LINE]],
52*0a6a1f1dSLionel Sambuc // CHECK: [[CON_LAM_B]] = {{.*}}, [[LAM_B]], {{.*}} [ DW_TAG_subprogram ] [line [[B_LINE]]] [public] [operator()]
53f4a2713aSLionel Sambuc
54f4a2713aSLionel Sambuc // Back to A. -- 78
55*0a6a1f1dSLionel Sambuc // CHECK: [[LAM_A:.*]] = {{.*}}, [[A_FUNC]], {{.*}}, [[LAM_A_ARGS:.*]], null, null, null} ; [ DW_TAG_class_type ] [line [[A_LINE]],
56*0a6a1f1dSLionel Sambuc // CHECK: [[LAM_A_ARGS]] = !{[[CON_LAM_A:.*]]}
57*0a6a1f1dSLionel Sambuc // CHECK: [[CON_LAM_A]] = {{.*}}, [[LAM_A]], {{.*}} [ DW_TAG_subprogram ] [line [[A_LINE]]] [public] [operator()]
58f4a2713aSLionel Sambuc
59f4a2713aSLionel Sambuc // CVAR:
60*0a6a1f1dSLionel Sambuc // CHECK: {{.*}} [[CVAR_T:![0-9]*]], {{.*}} ; [ DW_TAG_variable ] [cvar] [line [[CVAR_LINE:[0-9]*]]]
61*0a6a1f1dSLionel Sambuc // CHECK: [[CVAR_T]] = {{.*}}, ![[CVAR_ARGS:.*]], null, null, null} ; [ DW_TAG_class_type ] [line [[CVAR_LINE]],
62*0a6a1f1dSLionel Sambuc // CHECK: [[CVAR_ARGS]] = !{!{{.*}}}
63f4a2713aSLionel Sambuc
64f4a2713aSLionel Sambuc // VAR:
65*0a6a1f1dSLionel Sambuc // CHECK: {{.*}} [[VAR_T:![0-9]*]], {{.*}} ; [ DW_TAG_variable ] [var] [line [[VAR_LINE:[0-9]*]]]
66*0a6a1f1dSLionel Sambuc // CHECK: [[VAR_T]] = {{.*}}, [[VAR_ARGS:![0-9]*]], null, null, null} ; [ DW_TAG_class_type ] [line [[VAR_LINE]],
67*0a6a1f1dSLionel Sambuc // CHECK: [[VAR_ARGS]] = !{!{{.*}}}
68