[Mlir-commits] [mlir] 0a6def6 - [mlir][doc] Emit `\n` if description not end with `\n`. (#112898)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Oct 18 19:17:48 PDT 2024
Author: Longsheng Mou
Date: 2024-10-19T10:17:44+08:00
New Revision: 0a6def62c2807d213e2b80f23c4a14cb9302f3fd
URL: https://github.com/llvm/llvm-project/commit/0a6def62c2807d213e2b80f23c4a14cb9302f3fd
DIFF: https://github.com/llvm/llvm-project/commit/0a6def62c2807d213e2b80f23c4a14cb9302f3fd.diff
LOG: [mlir][doc] Emit `\n` if description not end with `\n`. (#112898)
This PR addresses a markdown formatting issue by ensuring a `\n` is
emitted if the description string does not already end with one. Fixes
#112672.
Added:
Modified:
mlir/tools/mlir-tblgen/OpDocGen.cpp
Removed:
################################################################################
diff --git a/mlir/tools/mlir-tblgen/OpDocGen.cpp b/mlir/tools/mlir-tblgen/OpDocGen.cpp
index ff3c6b16bb6ebc..d499c78a5cf44d 100644
--- a/mlir/tools/mlir-tblgen/OpDocGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpDocGen.cpp
@@ -70,7 +70,10 @@ void mlir::tblgen::emitSummary(StringRef summary, raw_ostream &os) {
// nested in the op definition.
void mlir::tblgen::emitDescription(StringRef description, raw_ostream &os) {
raw_indented_ostream ros(os);
- ros.printReindented(description.rtrim(" \t"));
+ StringRef trimmed = description.rtrim(" \t");
+ ros.printReindented(trimmed);
+ if (!trimmed.ends_with("\n"))
+ ros << "\n";
}
void mlir::tblgen::emitDescriptionComment(StringRef description,
More information about the Mlir-commits
mailing list