[llvm-dev] [DWARF] using simplified template names
via llvm-dev
llvm-dev at lists.llvm.org
Wed Jun 16 11:34:54 PDT 2021
> (out of curiosity, any idea what the Sony debugger does for
> pointer template parameters? At least GCC doesn't seem to be
> able to reconstruct those back into strings (you'd basically
> have to symbolize the address value of the parameter (GCC
> doesn't even encode this value, so it's not surprising GDB
> doesn't try to do anything when it's present)) - so I'll
> probably implement this under a flag but not include (ie: use
> the current full textual encoding) any template with a pointer
> template parameter)
>
> eg: extern int i; template<int *> void f1() { } int main() { f1<&i>(); }
Nice catch, we don't do anything clever here either. This would
appear to be a special case of non-type template params that can
be arbitrary compile-time expressions; for non-pointer params we
provide the computed value of the compile-time expression, which
is arguably sufficient for cases like
constexpr int a = 1; constexpr int b = 2;
template <int> void f2() { }
void int_expr() { f2<a + b>(); }
but it would be nice to do something useful for
extern int j[4];
void ptr_expr() { f1<&j[a+b]>(); }
We can't repurpose DW_AT_name for this because that's the
template parameter's formal name; nothing else comes to mind,
maybe we need a new attribute for this.
--paulr
More information about the llvm-dev
mailing list