[llvm] [mlir] [MLIR] Make generated markdown doc more consistent (PR #119926)

Kevin Gleason via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 17 11:57:16 PST 2024


================
@@ -54,12 +54,12 @@ cl::opt<bool> allowHugoSpecificFeatures(
     cl::cat(docCat));
 
 void mlir::tblgen::emitSummary(StringRef summary, raw_ostream &os) {
-  if (!summary.empty()) {
-    StringRef trimmed = summary.trim();
-    char first = std::toupper(trimmed.front());
-    StringRef rest = trimmed.drop_front();
-    os << "\n_" << first << rest << "_\n\n";
-  }
+  if (summary.empty())
+    return;
+  StringRef trimmed = summary.trim();
+  char first = std::toupper(trimmed.front());
+  StringRef rest = trimmed.drop_front();
+  os << "\n_" << first << rest << "_\n";
----------------
GleasonK wrote:

Ah, that was made more difficult to review thanks to format change, apologies!

Switched to early exit since some doc methods wrapped the entire body in an `if` while others used early exit, decided to make consistent.

https://github.com/llvm/llvm-project/pull/119926


More information about the llvm-commits mailing list