[clang] [clang-format] Add `AllowShortNamespacesOnASingleLine` option (PR #105597)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 29 18:16:46 PST 2024


================
@@ -4504,6 +4504,16 @@ TEST_F(FormatTest, FormatsCompactNamespaces) {
                "} // namespace bbbbbb\n"
                "} // namespace aaaaaa",
                Style);
+
+  verifyFormat("namespace a { namespace b { namespace c {\n"
+               "}}} // namespace a::b::c",
+               Style);
+
+  verifyFormat("namespace a { namespace b {\n"
+               "namespace cc {\n"
+               "}}} // namespace a::b::cc",
----------------
owenca wrote:

```suggestion
  verifyFormat("namespace a { namespace b {\n"
               "namespace c {\n"
               "}}} // namespace a::b::c",
```
The test case on lines 4508-4509 (with `ColumnLimit: 41`) is the current behavior and can be deleted.

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


More information about the cfe-commits mailing list