[llvm] [MsgPack] Handle Expected<T> errors in document reader (PR #73183)

Emma Pilkington via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 28 06:42:11 PST 2023


================
@@ -143,7 +143,13 @@ bool Document::readFromBlob(
     // On to next element (or key if doing a map key next).
     // Read the value.
     Object Obj;
-    if (!MPReader.read(Obj)) {
+    Expected<bool> ReadObj = MPReader.read(Obj);
+    if (!ReadObj) {
+      // FIXME: Propagate the Error to the caller.
----------------
epilk wrote:

I wasn't planning on it to be honest, it seems like the callers of this function aren't particularly interested in the failure case (e.g. https://github.com/llvm/llvm-project/blob/main/llvm/tools/llvm-readobj/ELFDumper.cpp#L5527). But now that you mention it, maybe they should be. I'll write up a patch to report these errors later this week.

https://github.com/llvm/llvm-project/pull/73183


More information about the llvm-commits mailing list