================
@@ -364,59 +301,43 @@ Error BitstreamRemarkParser::parseMeta() {
 
 Error BitstreamRemarkParser::processCommonMeta(
     BitstreamMetaParserHelper &Helper) {
-  if (std::optional<uint64_t> Version = Helper.ContainerVersion)
-    ContainerVersion = *Version;
-  else
-    return createStringError(
-        std::make_error_code(std::errc::illegal_byte_sequence),
-        "Error while parsing BLOCK_META: missing container version.");
-
-  if (std::optional<uint8_t> Type = Helper.ContainerType) {
+  if (auto Container = Helper.Container) {
+    ContainerVersion = Container->Version;
     // Always >= BitstreamRemarkContainerType::First since it's unsigned.
-    if (*Type > static_cast<uint8_t>(BitstreamRemarkContainerType::Last))
-      return createStringError(
-          std::make_error_code(std::errc::illegal_byte_sequence),
-          "Error while parsing BLOCK_META: invalid container type.");
-
-    ContainerType = static_cast<BitstreamRemarkContainerType>(*Type);
-  } else
-    return createStringError(
-        std::make_error_code(std::errc::illegal_byte_sequence),
-        "Error while parsing BLOCK_META: missing container type.");
-
+    if (Container->Type >
+        static_cast<uint8_t>(BitstreamRemarkContainerType::Last))
+      return Helper.error("Invalid container type.");
+    ContainerType = static_cast<BitstreamRemarkContainerType>(Container->Type);
+  } else {
+    return Helper.error("Missing container info.");
+  }
----------------
jroelofs wrote:

```suggestion
  } else
    return Helper.error("Missing container info.");
```

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

Reply via email to