Skip to content

Conversation

@CoTinker
Copy link
Contributor

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.

This PR addresses a markdown formatting issue by ensuring a `\n` is
emitted if the description string does not already end with one.
@llvmbot llvmbot added mlir:core MLIR Core Infrastructure mlir labels Oct 18, 2024
@CoTinker CoTinker requested a review from jpienaar October 18, 2024 12:54
@llvmbot
Copy link
Member

llvmbot commented Oct 18, 2024

@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-mlir-core

Author: Longsheng Mou (CoTinker)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/112898.diff

1 Files Affected:

  • (modified) mlir/tools/mlir-tblgen/OpDocGen.cpp (+4-1)
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,

@CoTinker
Copy link
Contributor Author

Thanks for your review.

@CoTinker CoTinker merged commit 0a6def6 into llvm:main Oct 19, 2024
11 checks passed
@CoTinker CoTinker deleted the doc branch October 19, 2024 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mlir:core MLIR Core Infrastructure mlir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[mlir][doc] Adds a \n if description string not end with \n.

3 participants