[PATCH] [clang-format] Added: FormatStyle::IndentNamespaces to indent the content of namespaces

Curdeius Curdeius curdeius at gmail.com
Fri Jul 26 05:17:57 PDT 2013


Hi,
Clang-format was lacking an option to add indentation within namespaces.
I've created a patch that adds this option to clang::Format::FormatStyle.
There is also a basic test.
You'll find it in the attachment.

I think it will be nice to have a possibility to indent only the content of
namespaces, but excluding the inner namespaces, i.e. to have something like:


> namespace outer {
>   class Indented1;
> namespace inner1 {
>   class Indented2;
> } // namespace inner1
> namespace inner2 {
> } // namespace inner2
> } // namespace outer


instead of:


> namespace outer {
>   class Indented1;
>   namespace inner1 {
>     class Indented2;
>   } // namespace inner1
>   namespace inner2 {
>   } // namespace inner2
> } // namespace outer


Regards,
Marek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130726/6e45c8e6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-format-IndentNamespaces.zip
Type: application/zip
Size: 1676 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130726/6e45c8e6/attachment.zip>


More information about the cfe-commits mailing list