[Mlir-commits] [mlir] [mlir] Set WrapNamespaceBodyWithEmptyLines: Never (PR #221421)

Fangrui Song llvmlistbot at llvm.org
Sat Sep 5 01:04:26 PDT 2026


https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/221421

MLIR predominantly writes namespace bodies without a wrapping empty line: in
mlir/lib and mlir/include 35% of bodies start with an empty line and 32% end
with one.

```
namespace ns { // no empty line below
struct A {
};
} // namespace ns  // no empty live above
```

New code drifts the other way, partly related to LLM preference. Pin the
majority style using a clang-format 20 feature to stop further damage.


>From 181feb03c0a813f21edf4338226e8cdcabac9faf Mon Sep 17 00:00:00 2001
From: Fangrui Song <i at maskray.me>
Date: Sat, 5 Sep 2026 00:47:11 -0700
Subject: [PATCH] [mlir] Set WrapNamespaceBodyWithEmptyLines: Never

MLIR predominantly writes namespace bodies without a wrapping empty line: in
mlir/lib and mlir/include 35% of bodies start with an empty line and 32% end
with one.

```
namespace ns { // no empty line below
struct A {
};
} // namespace ns  // no empty live above
```

New code drifts the other way, partly related to LLM preference. Pin the
majority style using a clang-format 20 feature to stop further damage.
---
 mlir/.clang-format | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mlir/.clang-format b/mlir/.clang-format
index 76cc928e64588..cbf894d360915 100644
--- a/mlir/.clang-format
+++ b/mlir/.clang-format
@@ -1,3 +1,4 @@
 BasedOnStyle: LLVM
 AlwaysBreakTemplateDeclarations: Yes
 LineEnding: LF
+WrapNamespaceBodyWithEmptyLines: Never



More information about the Mlir-commits mailing list