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

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 18 04:23:13 PST 2017


klimek added a comment.

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

> OK.
>
> So you mean a solution like the one discussed earlier would be the way to go?
>
> > I mean that we can configure macros in the format style, like "define A(X) class X {". I'm not 100% sure whether we would just try to use the Preprocessor for this, or whether we'd want to only allow a small subset of actual macros, but the general idea would be the same: The UnwrappedLineParser would parse the macro at the expansion location A(X) into an unwrapped line, and then parse the expansion into a child line, with the tokens tha tare not in the argument of the call being marked as fixed (parent child might also be better inverted).
>
> (As a side-note, I want to stress out that we would actually need a 'reversible' description to support the namespace case, to allow generating the end-of-namespace comment)


I believe this will be needed for various reasons. The plan is to make this similar to how we format #ifdef trees, for which clang-format already has full support.

> Is there any work on that side, any timeline when this may be supported ?

Some initial design work has been done, and Krasimir said that he's interested. No timeline though :(


https://reviews.llvm.org/D37813





More information about the cfe-commits mailing list