[Mlir-commits] [mlir] [NFC] Parser: Include the unrecognized dialect in errors. (PR #96676)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Jun 25 11:29:54 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: None (pizzud)

<details>
<summary>Changes</summary>

Listing the dialect shortens the journey needed to add it and resolve the error.

---
Full diff: https://github.com/llvm/llvm-project/pull/96676.diff


1 Files Affected:

- (modified) mlir/lib/AsmParser/Parser.cpp (+7-3) 


``````````diff
diff --git a/mlir/lib/AsmParser/Parser.cpp b/mlir/lib/AsmParser/Parser.cpp
index 1b8b4bac1821e..6322a77a1c231 100644
--- a/mlir/lib/AsmParser/Parser.cpp
+++ b/mlir/lib/AsmParser/Parser.cpp
@@ -1416,9 +1416,13 @@ Operation *OperationParser::parseGenericOperation() {
       if (!getContext()->allowsUnregisteredDialects()) {
         // Emit an error if the dialect couldn't be loaded (i.e., it was not
         // registered) and unregistered dialects aren't allowed.
-        emitError("operation being parsed with an unregistered dialect. If "
-                  "this is intended, please use -allow-unregistered-dialect "
-                  "with the MLIR tool used");
+        std::string message;
+        llvm::raw_string_ostream os(message);
+        os << "operation being parsed with an unregistered dialect "
+           << dialectName
+           << "If this is intended, please use -allow-unregistered-dialect "
+              "with the MLIR tool used";
+        emitError(message);
         return nullptr;
       }
     } else {

``````````

</details>


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


More information about the Mlir-commits mailing list