-
Notifications
You must be signed in to change notification settings - Fork 11.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
Incorrect clang-format pointer alignment when variables are declared in conditionals #60146
Comments
@llvm/issue-subscribers-clang-format |
I'm seeing this also with an even simpler repro: for (int i = 0; Foo& foo : foos) turns into for (int i = 0; Foo & foo : foos) even with |
I can confirm this behaviour and would like to gently bump this report. if (MyClass * obj{GetMyClass()}) But - for some reason - if (auto* obj{GetMyClass()}) if (int* obj{GetInt()}) I have reproduced that in clang-format:
The only config option I changed:
|
Is there a chance for a fix for this? |
We have the
|
So just to be sure. Technically we dont have any better option besides providing this additional TypeNames? For very large code bases with millions of types (although not all used in such cases but still a lot) it may not be possible to provide all the types. For this we mas have to live with it, correct? Thx! |
In general, |
This is related but different. I have moved it to #109358. |
This is different as there is no semicolon. Please split it to a new issue or use the |
Thanks so much for your reply. I created #109371 |
Given:
and
_clang-format
:clang-format 15 yields the following. Notice the pointer alignment is no longer left, despite
asking for it to be left.
In this case, we scoped the variable declaration in the if conditional. If we move it out of the
conditional, pointer alignment is as expected:
The text was updated successfully, but these errors were encountered: