[PATCH] D43183: clang-format: introduce `CaseBlockIndent` to control indent in switch

Daniel Jasper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 15 07:04:30 PST 2018


djasper added a comment.

That doesn't explain to me how this is error prone. I can't think how you'd create an error by this that would not be caught by the compiler. Much less if you consistently use clang-format.

It's fundamentally what you get for IndentCaseLabels: false. Even without braces you have this issue to some extend. But LLVM has several thousand switches, about a thousand with braces formatted this way and I am not aware of a single time this has caused a bug or even confusion.

And to me (but this is obviously objective), your suggestions hide the structure of the code even more as they lead to a state where the closing brace is not aligned with the start of the line/statement that contains the opening braces. That looks like a bug to me more than anything else and I don't think there is another situation where clang-format would do that.


Repository:
  rC Clang

https://reviews.llvm.org/D43183





More information about the cfe-commits mailing list