60 lines · cpp
1// RUN: %clang_cc1 %s -triple x86_64-windows-msvc -gcodeview \2// RUN: -debug-info-kind=line-tables-only -emit-llvm -o - | FileCheck %s3// Checks that clang with "-gline-tables-only" with CodeView emits some debug4// info for variables and types when they appear in function scopes.5 6namespace NS {7struct C {8 void m() {}9 // Test externally visible lambda.10 void lambda2() { []() {}(); }11 12 // Test naming for function parameters.13 void lambda_params(int x = [](){ return 0; }(), int y = [](){ return 1; }()) {}14};15void f() {}16}17 18// Test non- externally visible lambda.19auto lambda1 = []() { return 1; };20 21NS::C c;22 23 24void test() {25 // CHECK: !DISubprogram(name: "f", scope: ![[NS:[0-9]+]],26 // CHECK-SAME: type: ![[F:[0-9]+]]27 // CHECK: ![[NS]] = !DINamespace(name: "NS", scope: null)28 // CHECK: ![[F]] = !DISubroutineType(types: ![[FTYPE:[0-9]+]])29 // CHECK: ![[FTYPE]] = !{null}30 NS::f();31 32 // CHECK: ![[M:[0-9]+]] = distinct !DISubprogram(name: "m", scope: ![[C:[0-9]+]],33 // CHECK-SAME: type: ![[MTYPE:[0-9]+]],34 // CHECK: ![[C]] = !DICompositeType(tag: DW_TAG_structure_type, name: "C",35 // CHECK-SAME: flags: DIFlagFwdDecl36 // CHECK-NOT: identifier37 // CHECK: ![[MTYPE]] = !DISubroutineType({{.*}}types: !{{.*}})38 c.m();39 40 // CHECK: !DISubprogram(name: "operator()", scope: ![[LAMBDA0:[0-9]+]],41 // CHECK: ![[LAMBDA0]] = !DICompositeType(tag: DW_TAG_class_type,42 // CHECK-SAME: name: "<lambda_0>",43 // CHECK-SAME: flags: DIFlagFwdDecl44 lambda1();45 46 // CHECK: !DISubprogram(name: "operator()", scope: ![[LAMBDA1_1:[0-9]+]],47 // CHECK: ![[LAMBDA1_1]] = !DICompositeType(tag: DW_TAG_class_type,48 // CHECK-SAME: name: "<lambda_1_1>",49 // CHECK: !DISubprogram(name: "operator()", scope: ![[LAMBDA2_1:[0-9]+]],50 // CHECK: ![[LAMBDA2_1]] = !DICompositeType(tag: DW_TAG_class_type,51 // CHECK-SAME: name: "<lambda_2_1>",52 c.lambda_params();53 54 // CHECK: !DISubprogram(name: "operator()", scope: ![[LAMBDA1:[0-9]+]],55 // CHECK: ![[LAMBDA1]] = !DICompositeType(tag: DW_TAG_class_type,56 // CHECK-SAME: name: "<lambda_1>",57 // CHECK-SAME: flags: DIFlagFwdDecl58 c.lambda2();59}60