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
AllowShortBlocksOnASingleLine fails on ForEachMacros #45432
Comments
You are correct the TT_ForEachMacro is not being considered in the rules for
|
According to the clang-format doc, it seems that AllowShortLoopsOnASingleLine: true only applies to
but not to
If this is the intended behavior, then only the AllowShortBlocksOnASingleLine option is relevant. |
You are correct, I worked my way around that too..but thanks for stating that here. I looked further into this, we can add this I feel. but, the existing tests are wrong. The following is present for a situation where we have LLVM style
But actually if they are going to abide by the rules of for loops then all of these the tests need to be change to match the basic for loop, but not for UNKNOWN_FORACH which is not a know ForEachMacro
This isn't a big change but its a breaking change, I think we can propose it but we might get pushback. |
For the record, review in progress: https://reviews.llvm.org/D94955. |
as there is no further action on this fix since Jan 2021, I'll take over this review. |
TT_ForEachMacro should be considered in rules AllowShortBlocksOnASingleLine and AllowShortLoopsOnASingleLine. Fixes llvm/llvm-project#45432. Reviewed By: MyDeveloperDay Differential Revision: https://reviews.llvm.org/D94955
Extended Description
.clang-format:
Before:
After:
rng (i, 0, 10) { std::cout << i; }
Expect:
The text was updated successfully, but these errors were encountered: