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

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 6 02:31:37 PST 2017


klimek added a comment.

In https://reviews.llvm.org/D37813#945125, @Typz wrote:

> I don't think this is really relevant for this tool: if someone changes the implementation of the macro, then *they* must indeed if it should not be formatted like a namespace (and keep the clang-format configuration unchanged), or if it should now be formatted like a class (and thus make changes to clang-format configuration). Here we are not defining what the macro does, but how clang-format should indent it : in most case I don't think the indentation format should actually depend on the way it is implemented...


Ok, that's probably where our different opinions come from - I would want a macro to be formatted to reflect how it's implemented, because otherwise I'm going to be surprised when I look at the implementation, and I consider surprises to be something to avoid in programming in general, where possible.

That said, I'm also then a bit confused by your tests - they seem to currently format a mixture of namespace and class formatting, and combine the indentation of a class-scope with namespace end comments.


https://reviews.llvm.org/D37813





More information about the cfe-commits mailing list