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

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 20 07:48:24 PDT 2019


klimek added a comment.

In D37813#1254891 <https://reviews.llvm.org/D37813#1254891>, @Typz wrote:

> In D37813#1254865 <https://reviews.llvm.org/D37813#1254865>, @klimek wrote:
>
> > In D37813#1253813 <https://reviews.llvm.org/D37813#1253813>, @Typz wrote:
> >
> > > In D37813#1184051 <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.


You say "and this patch fixes that", but in your test cases it looks like the indent of things within the namespace is not like the indent for namespaces. I'm thoroughly confused.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D37813/new/

https://reviews.llvm.org/D37813





More information about the cfe-commits mailing list