[Mlir-commits] [mlir] [NFC] Parser: Include the unrecognized	dialect in errors. (PR #96676)
    Mehdi Amini 
    llvmlistbot at llvm.org
       
    Tue Jun 25 12:34:51 PDT 2024
    
    
  
================
@@ -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);
----------------
joker-eph wrote:
Why use an intermediate string here?
```suggestion
        emitError("operation being parsed with an unregistered dialect '")
           << dialectName
           << "'. If this is intended, please use -allow-unregistered-dialect "
              "with the MLIR tool used";
```
https://github.com/llvm/llvm-project/pull/96676
    
    
More information about the Mlir-commits
mailing list