| 1 |
// RUN: %clang_cc1 -triple x86_64-unk-unk -o - -emit-llvm -debug-info-kind=standalone -gtemplate-alias %s -gsimple-template-names=simple \ |
| 2 |
// RUN: | FileCheck %s |
| 3 |
|
| 4 |
//// Check that -gtemplate-alias causes DW_TAG_template_alias emission for |
| 5 |
//// template aliases with default parameter values. See template-alias.cpp for |
| 6 |
//// more template alias tests. |
| 7 |
//// FIXME: We currently do not emit defaulted arguments. |
| 8 |
|
| 9 |
template<typename T> |
| 10 |
struct X { |
| 11 |
char m; |
| 12 |
}; |
| 13 |
|
| 14 |
template<typename T> |
| 15 |
struct Y { |
| 16 |
char n; |
| 17 |
}; |
| 18 |
|
| 19 |
template <typename NonDefault, template <typename C> class T = Y, int I = 5, typename... Ts> |
| 20 |
using A = X<NonDefault>; |
| 21 |
|
| 22 |
//// We should be able to emit type alias metadata which describes all the |
| 23 |
//// values, including the defaulted parameters and empty parameter pack. |
| 24 |
A<int> a; |
| 25 |
|
| 26 |
// CHECK: !DIDerivedType(tag: DW_TAG_template_alias, name: "A", file: ![[#]], line: [[#]], baseType: ![[baseType:[0-9]+]], extraData: ![[extraData:[0-9]+]]) |
| 27 |
// CHECK: ![[baseType]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "X", |
| 28 |
// CHECK: ![[int:[0-9]+]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| 29 |
// CHECK: ![[extraData]] = !{![[NonDefault:[0-9]+]]} |
| 30 |
// CHECK: ![[NonDefault]] = !DITemplateTypeParameter(name: "NonDefault", type: ![[int]]) |
| 31 |
|
| 32 |
//// FIXME: Ideally, we would describe the deafulted args, like this: |
| 33 |
// : ![[extraData]] = !{![[NonDefault:[0-9]+]], ![[T:[0-9]+]], ![[I:[0-9]+]], ![[Ts:[0-9]+]]} |
| 34 |
// : ![[NonDefault]] = !DITemplateTypeParameter(name: "NonDefault", type: ![[int]]) |
| 35 |
// : ![[T]] = !DITemplateValueParameter(tag: DW_TAG_GNU_template_template_param, name: "T", defaulted: true, value: !"Y") |
| 36 |
// : ![[I]] = !DITemplateValueParameter(name: "I", type: ![[int]], defaulted: true, value: i32 5) |
| 37 |
// : ![[Ts]] = !DITemplateValueParameter(tag: DW_TAG_GNU_template_parameter_pack, name: "Ts", value: ![[types:[0-9]+]]) |
| 38 |
// : ![[types]] = !{} |