[Mlir-commits] [mlir] [mlir][doc] Trim summary text during DocGen (PR #68477)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sat Oct 7 03:49:46 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
<details>
<summary>Changes</summary>
When defining a multi-line string in tblgen, the output in the Markdown file currently contains too much whitespace and newlines for Hugo's Markdown parser. For example, for `arith.addui_extended` the tblgen
```tblgen
let summary = [{
extended unsigned integer addition operation returning sum and overflow bit
}];
```
is currently converted to
```markdown
_
extended unsigned integer addition operation returning sum and overflow bit
_
```
which causes the text to not be italicized (as can be seen at https://mlir.llvm.org/docs/Dialects/ArithOps/#arithaddui_extended-arithadduiextendedop). After this PR, the output becomes
```
_Extended unsigned integer addition operation returning sum and overflow bit_
```
---
Full diff: https://github.com/llvm/llvm-project/pull/68477.diff
1 Files Affected:
- (modified) mlir/tools/mlir-tblgen/OpDocGen.cpp (+3-2)
``````````diff
diff --git a/mlir/tools/mlir-tblgen/OpDocGen.cpp b/mlir/tools/mlir-tblgen/OpDocGen.cpp
index 088d34597f315fc..498aa40435fb115 100644
--- a/mlir/tools/mlir-tblgen/OpDocGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpDocGen.cpp
@@ -50,8 +50,9 @@ using mlir::tblgen::Operator;
void mlir::tblgen::emitSummary(StringRef summary, raw_ostream &os) {
if (!summary.empty()) {
- char first = std::toupper(summary.front());
- llvm::StringRef rest = summary.drop_front();
+ llvm::StringRef trimmed = summary.trim();
+ char first = std::toupper(trimmed.front());
+ llvm::StringRef rest = trimmed.drop_front();
os << "\n_" << first << rest << "_\n\n";
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/68477
More information about the Mlir-commits
mailing list