Clang Project

clang_source_code/test/CodeGenCXX/debug-info-codeview-var-templates.cpp
1// RUN: %clang_cc1 %s -std=c++14 -triple=i686-pc-windows-msvc -debug-info-kind=limited -gcodeview -emit-llvm -o - | FileCheck %s
2
3// Don't emit static data member debug info for variable templates.
4// PR38004
5
6struct TestImplicit {
7  template <typename T>
8  static const __SIZE_TYPE__ size_var = sizeof(T);
9};
10int instantiate_test1() { return TestImplicit::size_var<int> + TestImplicit::size_var<TestImplicit>; }
11TestImplicit gv1;
12
13// CHECK: ![[empty:[0-9]+]] = !{}
14
15// CHECK: ![[A:[^ ]*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "TestImplicit",
16// CHECK-SAME: elements: ![[empty]]
17
18template <typename T> bool vtpl;
19struct TestSpecialization {
20  template <typename T, typename U> static const auto sdm = vtpl<T>;
21  template <> static const auto sdm<int, int> = false;
22} gv2;
23
24// CHECK: ![[A:[^ ]*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "TestSpecialization",
25// CHECK-SAME: elements: ![[empty]]
26
27template <class> bool a;
28template <typename> struct b;
29struct TestPartial {
30  template <typename... e> static auto d = a<e...>;
31  template <typename... e> static auto d<b<e...>> = d<e...>;
32} c;
33
34// CHECK: ![[A:[^ ]*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "TestPartial",
35// CHECK-SAME: elements: ![[empty]]
36