[MLIR][ODS] default-valued strings should be in quotes
authorMogball <jeffniu22@gmail.com>
Fri, 15 Oct 2021 00:00:54 +0000 (00:00 +0000)
committerMogball <jeffniu22@gmail.com>
Fri, 15 Oct 2021 03:00:41 +0000 (03:00 +0000)
commit44610c01aeed8402da982ab59c47f45e7b3bc93b
tree2c3c672a7a2c564264fdf474e8a2262a91d4b4e2
parent7dd7078760e7219f0915610c3aa57fa6dd74be59
[MLIR][ODS] default-valued strings should be in quotes

`DefaultValuedAttr<StrAttr, "">` and `ConstantAttr<StrAttr, "">`
result in bugs in which TableGen will not recognize that the attribute
has a default value, because `""` is an empty TableGen string.

Strings no longer have special treatment. Instead, string values must be
wrapped in quotes: "\"foo\"". Two helpers, `DefaultValuedStrAttr` and
`ConstantStrAttr` have been added to keep code clean.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D111855
mlir/include/mlir/IR/OpBase.td
mlir/test/lib/Dialect/Test/TestOps.td
mlir/test/mlir-tblgen/constant-str-attr-invalid.mlir [new file with mode: 0644]
mlir/test/mlir-tblgen/op-attribute.td
mlir/test/mlir-tblgen/op-format.mlir
mlir/test/mlir-tblgen/pattern.mlir
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
mlir/tools/mlir-tblgen/RewriterGen.cpp