[PATCH] D84008: [DWARFYAML] Refactor emitDebugInfo() to make the length be inferred.

Xing GUO via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 23 07:42:55 PDT 2020


Higuoxing added inline comments.


================
Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:207-215
+static unsigned getOffsetSize(const DWARFYAML::Unit &Unit) {
+  return Unit.Format == dwarf::DWARF64 ? 8 : 4;
+}
 
-  void onValue(const uint16_t U) override {
-    writeInteger(U, OS, DebugInfo.IsLittleEndian);
-  }
+static unsigned getRefSize(const DWARFYAML::Unit &Unit) {
+  if (Unit.Version == 2)
+    return Unit.AddrSize;
----------------
labath wrote:
> Maybe this is for a separate patch, since you're just moving these, but this code already exists in BinaryFormat/Dwarf.h. It would be nice if DWARFYaml::Unit had a dwarf::FormParams field or a getter, and then these things could be retrieved by querying that object...
Thanks! I'll do it in a separate patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84008





More information about the llvm-commits mailing list