Details
- Reviewers
djasper klimek sammccall - Commits
- rG81b61a8291b5: Fix Bug 38713: clang-format mishandles a short block after "default:" in a…
rC341284: Fix Bug 38713: clang-format mishandles a short block after "default:" in a…
rL341284: Fix Bug 38713: clang-format mishandles a short block after "default:" in a…
Diff Detail
- Repository
- rC Clang
Event Timeline
Thanks!
lib/Format/UnwrappedLineFormatter.cpp | ||
---|---|---|
486 | Just to check my understanding...
You could consider // default: in switch statement above this line. | |
unittests/Format/FormatTest.cpp | ||
1012 | the intent of this test might be clearer if the cases were formatted as case 0: { return false; } on one line |
lib/Format/UnwrappedLineFormatter.cpp | ||
---|---|---|
486 | Exactly! | |
unittests/Format/FormatTest.cpp | ||
1012 | I used the same test case that exposed this bug. Please see it in the bug report. Because of the bug, "case" and "default" case labels were handled differently. The former was correctly left alone, but the latter was merged into one line. Therefore, the test case checks that neither is merged. |
Just to check my understanding...
we want to treat default the same as case, but the heuristics are different:
You could consider // default: in switch statement above this line.