[all-commits] [llvm/llvm-project] 0f052a: [mlir] Make `StringRefParameter` roundtrippable (#...

Markus Böck via All-commits all-commits at lists.llvm.org
Fri Sep 8 15:06:51 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0f052a972ebe9bdf2c1eb56bddf6abb04eec50d6
      https://github.com/llvm/llvm-project/commit/0f052a972ebe9bdf2c1eb56bddf6abb04eec50d6
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2023-09-09 (Sat, 09 Sep 2023)

  Changed paths:
    M mlir/include/mlir/IR/AttrTypeBase.td
    M mlir/include/mlir/IR/OpImplementation.h
    M mlir/lib/IR/AsmPrinter.cpp
    M mlir/test/mlir-tblgen/attr-or-type-format-roundtrip.mlir

  Log Message:
  -----------
  [mlir] Make `StringRefParameter` roundtrippable (#65813)

The current printer of `StringRefParameter` simply prints out the
content of the string as is without escaping it any way. This leads to
it generating invalid syntax, causing parser errors when read in again.

This PR fixes that by adding `printString` to `AsmPrinter`, allowing one
to print a string that can be parsed with `parseString`, using the same
escaping syntax as `StringAttr`.




More information about the All-commits mailing list