[PATCH] D139928: [clang][DebugInfo] Backport emitting DW_AT_default_value for default template arguments

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 08:53:35 PST 2022


dblaikie added a comment.

(This should be committed in two parts - the LLVM part first, then the Clang part - since they can be separated, they should be - but happy to review it altogether)



================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp:1856
+
+bool DwarfUnit::shouldEmitTemplateDefaultAttr() const {
+  assert(Asm != nullptr);
----------------
Maybe this could be a more general function? It could take a version and then have a general name "isCompatibleWithVersion(X)" and be used for other strict DWARF+version checks?


================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp:1857-1858
+bool DwarfUnit::shouldEmitTemplateDefaultAttr() const {
+  assert(Asm != nullptr);
+  assert(DD != nullptr);
+  return !Asm->TM.Options.DebugStrictDwarf || DD->getDwarfVersion() >= 5;
----------------
You can drop these - there's tons of non-null assumptions throughout the codebase, most aren't asserted.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139928/new/

https://reviews.llvm.org/D139928



More information about the llvm-commits mailing list