[clang] [clang-format] Support BraceWrapping.AfterNamespace with AllowShortNamespacesOnASingleLine (PR #123010)

Galen Elias via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 22 11:58:52 PST 2025


galenelias wrote:

> Is there an github "Issue" for this? I can't quite understand what problem we are trying to fix.

There is not a GitHub Issue filed yet, but I could get one filed if that would be helpful.

The issue is just there are users who want to use `AllowShortNamespacesOnASingleLine=true`, but who also currently use `BraceWrapping.AfterNamespace=true`.

So, they want the following code:

```cpp
namespace Foo
{
struct Bar;
}
```

To be formatted as:
```cpp
namespace Foo { struct Bar; }
```

But currently that isn't working.  AllowShortNamespacesOnASingleLine is currently written assuming BraceWrapping.AfterNamespace == false (which is the more common style).

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


More information about the cfe-commits mailing list