[clang][DebugInfo] Attach DW_AT_default_value to template arg metadata regardless...
authorMichael Buch <michaelbuch12@gmail.com>
Tue, 13 Dec 2022 17:40:02 +0000 (17:40 +0000)
committerMichael Buch <michaelbuch12@gmail.com>
Wed, 14 Dec 2022 22:31:45 +0000 (22:31 +0000)
commit5996ce17fb265e461b5d580c1873cb8e3ff8d62d
tree562bc9af21d5aa9d6c3eeccd0dc5f436fc271da9
parent62896428a766ecdec28432d3bfea3155cbeafe78
[clang][DebugInfo] Attach DW_AT_default_value to template arg metadata regardless of DwarfVersion

**Summary**

Starting with DWARFv5, DW_AT_default_value can be used to indicate
that a template argument has a default value. With this patch Clang
will attach the attribute to the debug metadata regardless of version.

In a follow-up patch we will change llvm to emit this attribute in
earlier versions of DWARF, unless compiling with -gstrict-dwarf.

**Details**

* Previously the DwarfVersion check in CGDebugInfo was inconsistent:
  For non-type template arguments we attached the attribute to the debug
  metadata in DWARFv5 only. Whereas for type template arguments we didn't
  have such a version restriction. With this patch we attach the attribute
  regardless of DWARF version (and instead offload the check to the AsmPrinter
  in a future patch).
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/CodeGenCXX/debug-info-template-parameter.cpp