[PATCH] D92318: [llvm-readobj, libSupport] - Refine the implementation of the code that dumps build attributes.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 2 00:26:56 PST 2020


jhenderson added inline comments.


================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:2907
+      if (Contents.empty()) {
+        reportUniqueWarning("the content of the " + describe(Sec) +
+                            " is empty");
----------------
I'm not sure you need the "the content of" bit of this message. The section itself is the thing that is empty/not empty.


================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:2919-2920
 
-    // TODO: Delete the redundant FormatVersion check above.
-    if (Machine == EM_ARM) {
-      if (Error E = ARMAttributeParser(&W).parse(Contents, support::little))
-        reportWarning(std::move(E), ObjF.getFileName());
-    } else if (Machine == EM_RISCV) {
-      if (Error E = RISCVAttributeParser(&W).parse(Contents, support::little))
-        reportWarning(std::move(E), ObjF.getFileName());
-    }
+    Error E = Error::success();
+    consumeError(std::move(E));
+    if (Machine == EM_ARM)
----------------
I think you can avoid this dance using the Error as output parameter idiom. See `ErrorAsOutParameter`.


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

https://reviews.llvm.org/D92318



More information about the llvm-commits mailing list