[all-commits] [llvm/llvm-project] 5996ce: [clang][DebugInfo] Attach DW_AT_default_value to t...

Michael137 via All-commits all-commits at lists.llvm.org
Wed Dec 14 14:32:11 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5996ce17fb265e461b5d580c1873cb8e3ff8d62d
      https://github.com/llvm/llvm-project/commit/5996ce17fb265e461b5d580c1873cb8e3ff8d62d
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2022-12-14 (Wed, 14 Dec 2022)

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

  Log Message:
  -----------
  [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).


  Commit: c9861e5718f6352bb1ee9fe6b5c3e16a0e649360
      https://github.com/llvm/llvm-project/commit/c9861e5718f6352bb1ee9fe6b5c3e16a0e649360
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2022-12-14 (Wed, 14 Dec 2022)

  Changed paths:
    M clang/test/CodeGenCXX/debug-info-template-parameter.cpp
    M llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
    M llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h

  Log Message:
  -----------
  [llvm][DebugInfo] Backport DW_AT_default_value for template args

**Summary**

Starting with DWARFv5, DW_AT_default_value can be used to indicate
that a template argument has a default value. With this patch LLVM
will emit the this attribute earlier versions of DWARF, unless
compiling with -gstrict-dwarf.

Differential Revision: https://reviews.llvm.org/D139953


Compare: https://github.com/llvm/llvm-project/compare/62896428a766...c9861e5718f6


More information about the All-commits mailing list