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

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 23 06:48:06 PST 2017


klimek added a comment.

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

> ping?


Argh, very sorry for the delay in response.

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

> In https://reviews.llvm.org/D37813#876227, @klimek wrote:
>
> > I think instead of introducing more and more special cases of macros we might want to handle, we should instead allow specifying macro productions globally.
>
>
> what do you mean?
>  Do you mean to group all the macro configuration options into "Macros" field, still containing one field for each kind of macro? Or do you have something else in mind?


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).

That will allow folks to actually specify the semantics they care about instead of us growing ever increasing special-case logic for different types of macros.


https://reviews.llvm.org/D37813





More information about the cfe-commits mailing list