[Mlir-commits] [mlir] [mlir][Pass] Handle escaped pipline option values (PR #97667)
Nikhil Kalra
llvmlistbot at llvm.org
Thu Jul 4 13:53:08 PDT 2024
================
@@ -60,6 +60,20 @@ template <typename ParserT>
static void printOptionValue(raw_ostream &os, const bool &value) {
os << (value ? StringRef("true") : StringRef("false"));
}
+template <typename ParserT>
+static void printOptionValue(raw_ostream &os, const std::string &str) {
+ // Check if the string needs to be escaped before writing it to the ostream.
+ const size_t spaceIndex = str.find_first_of(' ');
+ const size_t escapeIndex =
+ std::min({str.find_first_of('{'), str.find_first_of('\''),
+ str.find_first_of('"')});
+ const bool requiresEscape = spaceIndex < escapeIndex;
----------------
nikalra wrote:
Added another test to verify!
https://github.com/llvm/llvm-project/pull/97667
More information about the Mlir-commits
mailing list