[clang] [clang-format] Support BraceWrapping.AfterNamespace with AllowShortNamespacesOnASingleLine (PR #123010)
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 8 17:24:50 PST 2025
================
@@ -28430,6 +28430,36 @@ TEST_F(FormatTest, ShortNamespacesOption) {
"}}} // namespace foo::bar::baz",
"namespace foo { namespace bar { namespace baz { class qux; } } }",
Style);
+ Style.FixNamespaceComments = false;
+
+ Style.BreakBeforeBraces = FormatStyle::BS_Custom;
+ Style.BraceWrapping.AfterNamespace = true;
+ verifyFormat("namespace foo { class bar; }", Style);
+ verifyFormat("namespace foo { namespace bar { class baz; } }", Style);
+ verifyFormat("namespace foo\n"
+ "{ // comment\n"
+ "class bar;\n"
+ "}",
+ Style);
+ verifyFormat("namespace foo { class bar; }",
+ "namespace foo {\n"
+ "class bar;\n"
+ "}",
+ Style);
+
+ verifyFormat("namespace foo\n"
+ "{\n"
+ "namespace bar\n"
+ "{ // comment\n"
+ "class baz;\n"
+ "}\n"
+ "}\n",
----------------
owenca wrote:
```suggestion
"}",
```
https://github.com/llvm/llvm-project/pull/123010
More information about the cfe-commits
mailing list