[Mlir-commits] [mlir] 4a6d78e - [MLIR][ODS] Improve diagnostic for using a property as an anchor

Mehdi Amini llvmlistbot at llvm.org
Fri Jul 4 04:32:20 PDT 2025


Author: Mehdi Amini
Date: 2025-07-04T04:31:46-07:00
New Revision: 4a6d78e66c5689493019bacbc1351a3518f14b72

URL: https://github.com/llvm/llvm-project/commit/4a6d78e66c5689493019bacbc1351a3518f14b72
DIFF: https://github.com/llvm/llvm-project/commit/4a6d78e66c5689493019bacbc1351a3518f14b72.diff

LOG: [MLIR][ODS] Improve diagnostic for using a property as an anchor

The diagnostic make it more clear that it does not have an optionalParser
field defined.

Fix #147020

Added: 
    

Modified: 
    mlir/tools/mlir-tblgen/OpFormatGen.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/tools/mlir-tblgen/OpFormatGen.cpp b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
index 14af7787a833e..67fc7636af60f 100644
--- a/mlir/tools/mlir-tblgen/OpFormatGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
@@ -3779,7 +3779,8 @@ LogicalResult OpFormatParser::verifyOptionalGroupElement(SMLoc loc,
         Property prop = propEle->getVar()->prop;
         if (isAnchor && !(prop.hasDefaultValue() && prop.hasOptionalParser()))
           return emitError(loc, "only properties with default values "
-                                "that can be optionally parsed "
+                                "that can be optionally parsed (have the `let "
+                                "optionalParser = ...` field defined) "
                                 "can be used to anchor an optional group");
         return success();
       })


        


More information about the Mlir-commits mailing list