[PATCH] D88113: [llvm-objcopy][NFC] refactor error handling. part 1.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 25 03:25:56 PDT 2020


grimar added inline comments.


================
Comment at: llvm/tools/llvm-objcopy/MachO/MachOReader.cpp:93
 
-    if (Expected<ArrayRef<uint8_t>> E =
-            MachOObj.getSectionContents(SecRef->getRawDataRefImpl()))
-      S.Content =
-          StringRef(reinterpret_cast<const char *>(E->data()), E->size());
-    else
-      reportError(MachOObj.getFileName(), E.takeError());
+    Expected<ArrayRef<uint8_t>> DataOrErr =
+        MachOObj.getSectionContents(SecRef->getRawDataRefImpl());
----------------
alexshap wrote:
> DataOrErr -> Data or Content
I think `DataOrErr` was better. Searching of "OrErr" in LLVM code reveals many places (includeing llvm-objcopy code) where such suffic is used for "Expected<>".


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88113



More information about the llvm-commits mailing list