================
@@ -93,8 +93,12 @@ Expected<std::unique_ptr<Binary>> 
object::createBinary(MemoryBufferRef Buffer,
   case file_magic::spirv_object:
     // Unrecognized object file format.
     return errorCodeToError(object_error::invalid_file_type);
-  case file_magic::offload_binary:
-    return OffloadBinary::create(Buffer);
+  case file_magic::offload_binary: {
+    auto OffloadBinaryOrErr = OffloadBinary::create(Buffer);
+    if (!OffloadBinaryOrErr)
+      return OffloadBinaryOrErr.takeError();
+    return std::unique_ptr<Binary>(std::move(OffloadBinaryOrErr.get()[0]));
+  }
----------------
YuriPlyakhin wrote:

`create` returns Expected<SmallVector<std::unique_ptr<OffloadBinary>>> now, so 
I need to handle error, then access the first element of array. Though I don't 
need to construct new unique_ptr, I guess I can just do:
`return std::move(OffloadBinaryOrErr.get()[0]);`

https://github.com/llvm/llvm-project/pull/169425
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to