-
Notifications
You must be signed in to change notification settings - Fork 10.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clang-format adds new line between semicolon and body-less loop #61708
Comments
@llvm/issue-subscribers-clang-format |
Steps to reproduce:
I have this behavior on 16.0.0 and 17.0.0. I do not have an older version to test or bisect setup at the moment. |
That's fine, this is clang-format's behavior since its inception (i think) and definitely intended. Question is, do we want this to be configurable |
I would like to make this configurable. Any suggestions are welcome, otherwise I may try to bring a proposal. Maybe |
The default value of
|
A for/while loop with only a semicolon as its body should be treated as an empty loop. Fixes llvm#61708.
I'd say this should not be formatted on a single line. I'd change |
See the discussion from here and onward. |
A for/while loop with only a semicolon as its body should be treated as an empty loop. Fixes #61708.
@owenca, @HazardyKnusperkeks, sorry to bump this old thread, but is there a way to revert to the "old" behavior, i.e., having the semi-colon on a single line? It seems https://reviews.llvm.org/D154550#4526386 never got merged, so I cannot use |
Yes, by setting |
This, however, introduces a very large number of other white-space changes. Is something like |
I don't think so, if you mean:
Empty loops are short loops and should follow the setting of |
OK, thanks, no problem. |
I'm gonna borrow example from this SO question (and here's a similar one):
The text was updated successfully, but these errors were encountered: