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

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 22 20:47:23 PDT 2021


shchenz added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h:85
+    // DWARF version.
+    if (Attribute != 0 && Asm->TM.Options.DebugStrictDwarf &&
+        DD->getDwarfVersion() < dwarf::AttributeVersion(Attribute))
----------------
dblaikie wrote:
> When is the Attribute 0?
one example:
```
/// Add a Dwarf expression attribute data and value.
void DwarfCompileUnit::addExpr(DIELoc &Die, dwarf::Form Form,
                               const MCExpr *Expr) {
  Die.addValue(DIEValueAllocator, (dwarf::Attribute)0, Form, DIEExpr(Expr));
}
```

This is not for adding an attribute but for adding an expression for an attribute. Even `dwarf::AttributeVersion(0)` returns 0 and we will still go to `return` branch, but I think it is meaningless to get a attribute version for attribute 0?


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