[Mlir-commits] [mlir] [mlir][python] Improve sanitization of python names (PR #68801)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Oct 11 09:45:52 PDT 2023


================
@@ -616,6 +616,15 @@ def VariadicRegionOp : TestOp<"variadic_region"> {
 // CHECK: def variadic_region(num_variadic, *, loc=None, ip=None)
 // CHECK:   return _get_op_result_or_op_results(VariadicRegionOp(num_variadic=num_variadic, loc=loc, ip=ip))
 
+// CHECK: @_ods_cext.register_operation(_Dialect)
+// CHECK: class WithSpecialCharactersOp(_ods_ir.OpView):
+// CHECK-LABEL: OPERATION_NAME = "test.123with- special.characters"
+def WithSpecialCharactersOp : TestOp<"123with- special.characters"> {
+}
+
+// CHECK: def _123with__special_characters(*, loc=None, ip=None)
----------------
JoelWee wrote:


> I think we shouldn't have whitespace in the operation names.

I'll change the space to something else. Out of curiosity, is there a specification somewhere of what's allowed in an op name? I've just assumed it's whatever's allowed as a string literal https://llvm.org/docs/TableGen/ProgRef.html#literals

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


More information about the Mlir-commits mailing list