[all-commits] [llvm/llvm-project] dac582: DebugInfo: Name class templates with default argum...

David Blaikie via All-commits all-commits at lists.llvm.org
Sat Jul 17 23:58:34 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dac582ad3a78b18bdd2e6615f1ec105ee05adfe1
      https://github.com/llvm/llvm-project/commit/dac582ad3a78b18bdd2e6615f1ec105ee05adfe1
  Author: David Blaikie <dblaikie at gmail.com>
  Date:   2021-07-17 (Sat, 17 Jul 2021)

  Changed paths:
    M clang/lib/CodeGen/CGDebugInfo.cpp
    M clang/lib/CodeGen/CGDebugInfo.h
    M clang/test/CodeGenCXX/debug-info-template.cpp

  Log Message:
  -----------
  DebugInfo: Name class templates with default arguments consistently (both direct naming, and as a template argument for a function template)

It's noteworthy that GCC has the same bug here, which is a bit
surprising. Both Clang and GCC's bug is only for function template
arguments that are themselves templates with default template arguments
(f1<t1<int[, missing_default_here]>>). Probably because function name
matching isn't generally necessary - whereas type matching is necessary
for DWARF consumers to associate declarations and definitions across
translation units, so the bug's been addressed there already - but
continued to exist for function templates since it's fairly benign
there.

I came across this while working on a change that could reconstitute
these pretty printed names based on the rest of the DWARF, reducing the
size of the DWARF by not having to encode all the template parameters in
the name string. That reconstitution code can't tell the difference
between a defaulted argument or not, so couldn't create the current
buggy-ish output.

Making the names more consistent between direct and indirect references,
and between function and class templates seems all to the good.

(I fixed the function template version of this a few years back in
9fdd09a4ccd01feb8e00be22b17e944e46807746 - clearly I should've looked
more closely and generalized the code better so it only had to be fixed
once - well, doing that here now)




More information about the All-commits mailing list