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

Francois Ferrand via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 3 08:39:52 PDT 2018


Typz added a comment.

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

(as long as there is a single argument. When multiple arguments are used, I add to choose a heuristic...)

As far as I understand, the divergence is that you would want something to "match" the implementation of the macro, while I propose a simpler heuristic, which should work fine for namespaces...


Repository:
  rC Clang

https://reviews.llvm.org/D37813





More information about the cfe-commits mailing list