[PATCH] D101024: [Debug-Info] make DIE attributes generating under control of strict dwarf

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 22 08:18:58 PDT 2021


probinson added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp:1801-1805
+  // For strict DWARF mode, only generate attributes available to current DWARF
+  // version.
+  if (Asm->TM.Options.DebugStrictDwarf &&
+      DD->getDwarfVersion() < dwarf::AttributeVersion(Attribute))
+    return;
----------------
dblaikie wrote:
> This patch is adding this boilerplate in several places.
> 
> Perhaps it'd be cleaner to refactor the underlying "Die.addValue" call to a helper in DwarfUnit in a preparatory patch, then the boilerplate can be added to that one place?
That was my first thought too, but it looks like class DIE does not know the DwarfUnit (only the DIEUnit) so it doesn't know the version or have access to the strictness flag.
But, there could be a predicate in DwarfUnit that takes the Attribute and hides the details, instead of repeating them in each of these places.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101024



More information about the llvm-commits mailing list