[PATCH] D37143: [clang-format] Fixed missing enter before bracket in typedef enum and extern

Pawel Maciocha via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 26 02:01:11 PDT 2017


PriMee added a comment.

I merged them just because of their presence in the same bug report... As to the unit tests, I'll add them as soon as possible.

With reference to `extern` part, once again:
There is no brace wrapping flag that let us control opening brace's position. In case of other keywords (class, function, control statement etc.) we have opportunity to decide how should it look like. Here, we can't do it similarly. What we want is leaving braces **unformatted** (leave them as in the input), but what's more we still want to call **parseBlock** function. The only option is to set MustBreakBefore flag manually (only when needed, when the left brace is on non-header line, parseBlock does move it by default).

One more correction: Would be probably better to replace the line `MustBreakBeforeNextToken = true;` with `FormatTok->MustBreakBefore = true;`
It does work as expected as well (still passes every test - there are some!), but is more intuitive and understandable.

I'll work on these problems on monday.


https://reviews.llvm.org/D37143





More information about the cfe-commits mailing list