[PATCH] D80535: [ObjectYAML][MachO] Add error handling in MachOEmitter.

Alexander Shaposhnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 26 19:05:47 PDT 2020


alexshap added inline comments.


================
Comment at: llvm/lib/ObjectYAML/MachOEmitter.cpp:30
+inline Error createError(const Twine &Msg) {
+  return createStringError(inconvertibleErrorCode(), Msg);
+}
----------------
jhenderson wrote:
> Perhaps `invalid_argument` instead of `inconvertibleErrorCode()`?
nit: not sure if this function is really that necessary, it feels like createStringError is already concise enough.
p.s. https://llvm.org/docs/CodingStandards.html#anonymous-namespaces , this probably should be 'static' instead.



================
Comment at: llvm/lib/ObjectYAML/MachOEmitter.cpp:290
+              "wrote too much data somewhere, section offsets don't line up");
+        assert(OS.tell() - fileStart <= Sec.offset ||
+               Sec.offset == (uint32_t)0);
----------------
jhenderson wrote:
> Here and elsewhere, I don't think you need an assertion if you are reporting an error too.
+ 1


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80535





More information about the llvm-commits mailing list