2015-10-08 12:24:12 +08:00
|
|
|
// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s -fexceptions -std=c++11 -debug-info-kind=limited | FileCheck %s
|
2012-03-02 05:36:52 +08:00
|
|
|
|
|
|
|
auto var = [](int i) { return i+1; };
|
2012-08-07 12:16:51 +08:00
|
|
|
void *use = &var;
|
2012-03-02 05:36:52 +08:00
|
|
|
|
|
|
|
extern "C" auto cvar = []{};
|
|
|
|
|
|
|
|
int a() { return []{ return 1; }(); }
|
|
|
|
|
|
|
|
int b(int x) { return [x]{return x;}(); }
|
|
|
|
|
|
|
|
int c(int x) { return [&x]{return x;}(); }
|
|
|
|
|
|
|
|
struct D { D(); D(const D&); int x; };
|
2013-08-10 01:20:05 +08:00
|
|
|
int d(int x) { D y[10]; return [x,y] { return y[x].x; }(); }
|
2012-03-02 05:36:52 +08:00
|
|
|
|
|
|
|
// Randomness for file. -- 6
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: [[FILE:.*]] = !DIFile(filename: "{{.*}}debug-lambda-expressions.cpp",
|
2015-03-04 01:25:55 +08:00
|
|
|
|
2016-04-15 23:55:45 +08:00
|
|
|
// CVAR:
|
|
|
|
// CHECK: !DIGlobalVariable(name: "cvar"
|
|
|
|
// CHECK-SAME: line: [[CVAR_LINE:[0-9]+]]
|
|
|
|
// CHECK-SAME: type: ![[CVAR_T:[0-9]+]]
|
2016-04-17 15:45:08 +08:00
|
|
|
// CHECK: ![[CVAR_T]] = distinct !DICompositeType(tag: DW_TAG_class_type
|
2016-04-15 23:55:45 +08:00
|
|
|
// CHECK-SAME: line: [[CVAR_LINE]],
|
|
|
|
// CHECK-SAME: elements: ![[CVAR_ARGS:[0-9]+]]
|
|
|
|
// CHECK: ![[CVAR_ARGS]] = !{!{{[0-9]+}}}
|
2012-03-02 05:36:52 +08:00
|
|
|
|
2016-04-15 23:55:45 +08:00
|
|
|
// VAR:
|
|
|
|
// CHECK: !DIGlobalVariable(name: "var"
|
|
|
|
// CHECK-SAME: line: [[VAR_LINE:[0-9]+]]
|
|
|
|
// CHECK-SAME: type: ![[VAR_T:[0-9]+]]
|
2016-04-17 15:45:08 +08:00
|
|
|
// CHECK: ![[VAR_T]] = distinct !DICompositeType(tag: DW_TAG_class_type
|
2016-04-15 23:55:45 +08:00
|
|
|
// CHECK-SAME: line: [[VAR_LINE]],
|
|
|
|
// CHECK-SAME: elements: ![[VAR_ARGS:[0-9]+]]
|
|
|
|
// CHECK: ![[VAR_ARGS]] = !{!{{[0-9]+}}}
|
2012-03-02 05:36:52 +08:00
|
|
|
|
2016-04-24 05:08:27 +08:00
|
|
|
// CHECK: ![[INT:[0-9]+]] = !DIBasicType(name: "int"
|
|
|
|
|
2016-04-15 23:55:45 +08:00
|
|
|
// A: 10
|
|
|
|
// CHECK: ![[A_FUNC:.*]] = distinct !DISubprogram(name: "a"{{.*}}, line: [[A_LINE:[0-9]+]]{{.*}}, isDefinition: true
|
2012-03-02 05:36:52 +08:00
|
|
|
|
2015-01-22 08:24:57 +08:00
|
|
|
// Back to A. -- 78
|
2016-04-17 15:45:08 +08:00
|
|
|
// CHECK: ![[LAM_A:.*]] = distinct !DICompositeType(tag: DW_TAG_class_type{{.*}}, scope: ![[A_FUNC]]{{.*}}, line: [[A_LINE]],
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK-SAME: elements: ![[LAM_A_ARGS:[0-9]+]]
|
|
|
|
// CHECK: ![[LAM_A_ARGS]] = !{![[CON_LAM_A:[0-9]+]]}
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: ![[CON_LAM_A]] = !DISubprogram(name: "operator()"
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK-SAME: scope: ![[LAM_A]]
|
|
|
|
// CHECK-SAME: line: [[A_LINE]]
|
|
|
|
// CHECK-SAME: DIFlagPublic
|
2015-01-22 08:24:57 +08:00
|
|
|
|
2016-04-15 23:55:45 +08:00
|
|
|
// B: 14
|
|
|
|
// CHECK: ![[B_FUNC:.*]] = distinct !DISubprogram(name: "b"{{.*}}, line: [[B_LINE:[0-9]+]]{{.*}}, isDefinition: true
|
|
|
|
|
2015-01-22 08:24:57 +08:00
|
|
|
// Back to B. -- 67
|
2016-04-17 15:45:08 +08:00
|
|
|
// CHECK: ![[LAM_B:.*]] = distinct !DICompositeType(tag: DW_TAG_class_type{{.*}}, scope: ![[B_FUNC]]{{.*}}, line: [[B_LINE]],
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK-SAME: elements: ![[LAM_B_ARGS:[0-9]+]]
|
|
|
|
// CHECK: ![[LAM_B_ARGS]] = !{![[CAP_B:[0-9]+]], ![[CON_LAM_B:[0-9]+]]}
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: ![[CAP_B]] = !DIDerivedType(tag: DW_TAG_member, name: "x"
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK-SAME: scope: ![[LAM_B]]
|
|
|
|
// CHECK-SAME: line: [[B_LINE]],
|
|
|
|
// CHECK-SAME: baseType: ![[INT]]
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: ![[CON_LAM_B]] = !DISubprogram(name: "operator()"
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK-SAME: scope: ![[LAM_B]]
|
|
|
|
// CHECK-SAME: line: [[B_LINE]]
|
|
|
|
// CHECK-SAME: DIFlagPublic
|
2012-03-02 05:36:52 +08:00
|
|
|
|
2016-04-15 23:55:45 +08:00
|
|
|
// C: 17
|
|
|
|
// CHECK: ![[C_FUNC:.*]] = distinct !DISubprogram(name: "c"{{.*}}, line: [[C_LINE:[0-9]+]]{{.*}}, isDefinition: true
|
|
|
|
|
2012-07-24 09:40:49 +08:00
|
|
|
// Back to C. -- 55
|
2016-04-17 15:45:08 +08:00
|
|
|
// CHECK: ![[LAM_C:.*]] = distinct !DICompositeType(tag: DW_TAG_class_type{{.*}}, scope: ![[C_FUNC]]{{.*}}, line: [[C_LINE]],
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK-SAME: elements: ![[LAM_C_ARGS:[0-9]+]]
|
|
|
|
// CHECK: ![[LAM_C_ARGS]] = !{![[CAP_C:[0-9]+]], ![[CON_LAM_C:[0-9]+]]}
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: ![[CAP_C]] = !DIDerivedType(tag: DW_TAG_member, name: "x"
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK-SAME: scope: ![[LAM_C]]
|
|
|
|
// CHECK-SAME: line: [[C_LINE]],
|
|
|
|
// CHECK-SAME: baseType: ![[TYPE_C_x:[0-9]+]]
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: ![[TYPE_C_x]] = !DIDerivedType(tag: DW_TAG_reference_type, baseType: ![[INT]]
|
|
|
|
// CHECK: ![[CON_LAM_C]] = !DISubprogram(name: "operator()"
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK-SAME: scope: ![[LAM_C]]
|
|
|
|
// CHECK-SAME: line: [[C_LINE]]
|
|
|
|
// CHECK-SAME: DIFlagPublic
|
2012-03-02 05:36:52 +08:00
|
|
|
|
2016-04-15 23:55:45 +08:00
|
|
|
// D: 18
|
|
|
|
// CHECK: ![[D_FUNC:.*]] = distinct !DISubprogram(name: "d"{{.*}}, line: [[D_LINE:[0-9]+]]{{.*}}, isDefinition: true
|
|
|
|
|
2015-01-22 08:24:57 +08:00
|
|
|
// Back to D. -- 24
|
2016-04-17 15:45:08 +08:00
|
|
|
// CHECK: ![[LAM_D:.*]] = distinct !DICompositeType(tag: DW_TAG_class_type{{.*}}, scope: ![[D_FUNC]]{{.*}}, line: [[D_LINE]],
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK-SAME: elements: ![[LAM_D_ARGS:[0-9]+]]
|
|
|
|
// CHECK: ![[LAM_D_ARGS]] = !{![[CAP_D_X:[0-9]+]], ![[CAP_D_Y:[0-9]+]], ![[CON_LAM_D:[0-9]+]]}
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: ![[CAP_D_X]] = !DIDerivedType(tag: DW_TAG_member, name: "x"
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK-SAME: scope: ![[LAM_D]]
|
|
|
|
// CHECK-SAME: line: [[D_LINE]],
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: ![[CAP_D_Y]] = !DIDerivedType(tag: DW_TAG_member, name: "y"
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK-SAME: scope: ![[LAM_D]]
|
|
|
|
// CHECK-SAME: line: [[D_LINE]],
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: ![[CON_LAM_D]] = !DISubprogram(name: "operator()"
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK-SAME: scope: ![[LAM_D]]
|
|
|
|
// CHECK-SAME: line: [[D_LINE]]
|
|
|
|
// CHECK-SAME: DIFlagPublic
|