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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 06:48:24 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)));
----------------
nikic wrote:

I think it would be okay to just directly return the error. Nobody uses error codes, only the message matters...

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


More information about the llvm-commits mailing list