Extend AllowShortBlocksOnASingleLine for else blocks. See https://bugs.llvm.org/show_bug.cgi?id=49722
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Could you add the case where the else is not empty.
clang/unittests/Format/FormatTest.cpp | ||
---|---|---|
5413 | Can you please use verifyFormat (as this does some extra stuff to ensure its stable) |
use verifyFormat instead of EXPECT_EQ (as this does some extra stuff to ensure its stable)
clang/unittests/Format/FormatTest.cpp | ||
---|---|---|
5419 | you can remove the "format(" here now..." when its 2 arguments to verifyFormat its a kind of verifyFormat(after,before,Style) alternatively you can use: verifyFormat(after,Style) it will deliberately messUp the the text and ensure it resets itself back to the desired after |
Ok now I'm a little puzzled, shouldn't this be covered by AllowShortIfStatementsOnASingleLine?
I think at a minimum we need to understand why those options don't work, and I agree we should add a ReleaseNote and add something to the documentation (by editing Format.h)
That's exactly what i thought when i first stumbled over the behavior :D But I think the majority of users might not even consider adding empty else blocks. Only a few either just do it or have to comply with some standards, f.e. MISRA .
Thank you for the patch, Do you need help committing this? if so we need your name and email address to do so
Thanks for the reminder. I wasn't sure about where we are in the process. I just did a rebase, compiled and run the tests again and it's all still fine but this is my first contribution and i don't think i have commit access according to https://www.llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access . I'd be glad if someone else could commit for me. What's the best method to send the email address?
one of us can commit it for you but we need to do the following to attribute it to you
commit --amend --author="John Doe <jdoe@llvm.org>"
So I need your name and email address.
Can you please use verifyFormat (as this does some extra stuff to ensure its stable)