diff --git a/mlir/include/mlir/Support/IndentedOstream.h b/mlir/include/mlir/Support/IndentedOstream.h --- a/mlir/include/mlir/Support/IndentedOstream.h +++ b/mlir/include/mlir/Support/IndentedOstream.h @@ -131,7 +131,8 @@ StringRef remaining = output; while (!remaining.empty()) { auto split = remaining.split('\n'); - size_t indent = split.first.find_first_not_of(" \t"); + auto firstTrimmed = split.first.rtrim('\r'); + size_t indent = firstTrimmed.find_first_not_of(" \t"); if (indent != StringRef::npos) leadingWs = std::min(leadingWs, static_cast(indent)); remaining = split.second;