diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp --- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp +++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp @@ -151,11 +151,11 @@ return str; } -// Escape a string using LLVM/MLIR encoding. E.g. foo"bar -> foo\22bar. +// Escape a string using C++ encoding. E.g. foo"bar -> foo\x22bar. static std::string escapeString(StringRef value) { std::string ret; llvm::raw_string_ostream os(ret); - llvm::printEscapedString(value, os); + os.write_escaped(value); return os.str(); }