Skip to content

Commit 1cc3d14

Browse files
committed
fix replace
1 parent 7795d9e commit 1cc3d14

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mlir/tools/mlir-tblgen/OpPythonBindingGen.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "llvm/Support/FormatVariadic.h"
2222
#include "llvm/TableGen/Error.h"
2323
#include "llvm/TableGen/Record.h"
24+
#include <regex>
2425

2526
using namespace mlir;
2627
using namespace mlir::tblgen;
@@ -1043,7 +1044,7 @@ static std::string makeDocStringForOp(const Operator &op) {
10431044

10441045
auto desc = op.getDescription().rtrim(" \t").str();
10451046
// Replace all """ with \"\"\" to avoid early termination of the literal.
1046-
desc = llvm::join(llvm::split(desc, R"(""")"), R"(\"\"\")");
1047+
desc = std::regex_replace(desc, std::regex(R"(""")"), R"(\"\"\")");
10471048

10481049
std::string docString = "\n";
10491050
llvm::raw_string_ostream os(docString);

0 commit comments

Comments
 (0)