[PATCH] D81915: [ObjectYAML][DWARF] Let writeVariableSizedInteger() return Error.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 16 02:43:39 PDT 2020


jhenderson added inline comments.


================
Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:57
   else
-    assert(false && "Invalid integer write size.");
+    return createStringError(errc::invalid_argument,
+                             "invalid integer write size");
----------------
This probably wants to be `not_supported` because strictly, there's nothing stopping us writing a 3/5/7 etc byte value.


================
Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:133
+              Descriptor.Address, Range.AddrSize, OS, DI.IsLittleEndian))
+        return Err;
+      cantFail(writeVariableSizedInteger(Descriptor.Length, Range.AddrSize, OS,
----------------
Perhaps here and at similar points, it might be worth adding additional context to the message, to address your problem. There are examples of this in various places, such as llvm-readobj, I believe.


================
Comment at: llvm/test/tools/yaml2obj/ELF/DWARF/debug-addr.yaml:597
+## l) Test that yaml2obj still generates a .debug_addr section if we assign an invalid value
+## to 'AddressSize' or 'SegmentSelectorSize' when the 'Entries' entry is empty.
+
----------------
perhaps `entry` -> `list`


================
Comment at: llvm/test/tools/yaml2obj/ELF/DWARF/debug-aranges.yaml:411
+## h) Test that yaml2obj still generates a .debug_aranges section if we assign an invalid value
+## to 'AddrSize' when the 'Descriptors' entry is empty.
+
----------------
Similarly, entry -> list here and below.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81915





More information about the llvm-commits mailing list