[PATCH] clang-format: Add "AllowShortNamespacesOnASingleLine" option

Daniel Jasper via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 7 15:08:18 PDT 2015


Would it be possible to send the patch through reviews.llvm.org? It makes
review much easier for me.

On Thu, Aug 6, 2015 at 6:18 PM, chris beck via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Rationale:
>
> I sometimes use a different clang tool, iwyu ("include what you use"), to
> clean up header file inclusions in my C++ projects. Iwyu seeks to correct
> the includes of a header or cpp unit so that definitions which are needed
> are included, and definitions which only need to be forward declared are
> forward declared. It often generates code like this at the top of your file:
>
> namespace foo { class bar; }
> namespace baz { struct quaz; }
> ...
>
> Unfortunately, clang-format dislikes braces which are arranged this way
> and always wants to break after them, and after the forward declaration, no
> matter what configuration options are used (as far as I can tell).
>
> I wrote a small patch so that short namespaces like these can be set on a
> single line regardless of chosen brace-style if a boolean option
> "AllowShortNamespacesOnASingleLine" is enabled, please find attached.
>
> Best Regards,
> Chris Beck
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150808/2bf3044e/attachment.html>


More information about the cfe-commits mailing list