[llvm] [IR] Check parameters of target extension types on construction (PR #107268)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 03:58:40 PDT 2024


================
@@ -2679,7 +2679,11 @@ Error BitcodeReader::parseTypeTableBody() {
           return error("Integer parameter too large");
         IntParams.push_back(Record[i]);
       }
-      ResultTy = TargetExtType::get(Context, TypeName, TypeParams, IntParams);
+      auto TTy =
+          TargetExtType::getOrError(Context, TypeName, TypeParams, IntParams);
+      if (auto E = TTy.takeError())
+        return error(toString(std::move(E)));
----------------
jayfoad wrote:

This is a bit of a faff - it unwraps the `Error` and then wraps it again, just to change the error code to `CorruptedBitcode`.

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


More information about the llvm-commits mailing list