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