[PATCH] D37813: clang-format: better handle namespace macros

Francois Ferrand via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 4 02:59:03 PDT 2018


Typz added a comment.

In https://reviews.llvm.org/D37813#1254865, @klimek wrote:

> In https://reviews.llvm.org/D37813#1253813, @Typz wrote:
>
> > In https://reviews.llvm.org/D37813#1184051, @klimek wrote:
> >
> > > The problem here is that we have different opinions on how the formatting on namespace macros should behave in the first place- I think they should behave like namespaces, you want them to be formatted differently.
> > >  Given that you want full control over the formatting of those macros, and them not actually be formatted exactly like namespaces or classes, I think we need a more generic mechanism for you to express that.
> >
> >
> > Not sure what you mean here. I want them to behave like namespaces as well, this is actually the use case I have... As implemented, they indeed behave exactly like namespaces :
> >
> >   TESTSUITE(a) {                       namespace a {
> >   } // TESTSUITE(a)                    } // namespace a
> >                                   VS
> >   TESTSUITE(a) { TESTSUITE(b) {        namespace a { namespace b {
> >   } // TESTSUITE(a::b)                 }} // namespace a::b
>
>
> I thought we had the discussion upthread that they indent differently from namespaces. I'm working on a patch that allows you to configure macros.


The current behavior is that they indent differently from namespace, because clang does not know these macros are conceptually equivalent to namespaces. And this patch actually fixes that, letting clang know they are actually macros.


Repository:
  rC Clang

https://reviews.llvm.org/D37813





More information about the cfe-commits mailing list