[PATCH] D73086: [DWARF5] Added support for debug_macro section parsing and dumping in llvm-dwarfdump.

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 26 05:23:16 PDT 2020


ikudrin added inline comments.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFContext.cpp:484
+                 DObj->getMacroSection().Data)) {
+    parseMacroOrMacinfo(Macro, OS, DumpOpts, /*IsLittleEndian=*/true,
+                        dwarf::Macro);
----------------
I am not sure that `Macro` as an in-out parameter of a void method is the perfect design. It would be better if `parseMacroOrMacinfo()` would just return `std::unique_ptr<DWARFDebugMacro>`. The code here, in that case, will look like:

```
if (!Macro)
  Macro = parseMacroOrMacinfo(...);
if (Macro)
  Macro->dump(OS);
```

Much more clear, no?


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFContext.cpp:492
                  DObj->getMacinfoSection())) {
-    getDebugMacinfo()->dump(OS);
+    parseMacroOrMacinfo(Macinfo, OS, DumpOpts, /*IsLittleEndian=*/true,
+                        dwarf::Macinfo);
----------------
Before the patch, `isLittleEndian()` was used, but now you always pass the constant `true`. Could you please elaborate, why the behavior has been changed?


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

https://reviews.llvm.org/D73086





More information about the llvm-commits mailing list