This patch adds support for template arguments of `clang::TemplateArgument::ArgKind::StructuralValue` kind (added in https://github.com/llvm/llvm-project/pull/78041). These are used for non-type template parameters such as floating point constants. When LLDB created `clang::NonTypeTemplateParmDecl`s, it previously assumed integral values, this patch accounts for structural values too. Anywhere LLDB assumed a `DW_TAG_template_value_parameter` was `Integral`, it will now also check for `StructuralValue`, and will unpack the `TemplateArgument` value and type accordingly. We can rely on the fact that any `TemplateArgument` of `StructuralValue` kind that the `DWARFASTParserClang` creates will have a valid value, because it gets those from `DW_AT_const_value`.
22 lines
453 B
C++
22 lines
453 B
C++
template<typename T, unsigned value>
|
|
struct C {
|
|
T member = value;
|
|
};
|
|
|
|
C<int, 2> temp1;
|
|
|
|
template <typename T, T value> struct Foo {};
|
|
Foo<short, -2> temp2;
|
|
Foo<char, 'v'> temp3;
|
|
Foo<float, 2.0f> temp4;
|
|
Foo<double, -250.5> temp5;
|
|
Foo<int *, &temp1.member> temp6;
|
|
Foo<_Float16, _Float16(1.0)> temp7;
|
|
Foo<__bf16, __bf16(1.0)> temp8;
|
|
|
|
template <typename T, T... values> struct Bar {};
|
|
Bar<double, 1.2> temp9;
|
|
Bar<float, 1.0f, 2.0f> temp10;
|
|
|
|
int main() {}
|