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

Daniel Jasper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 2 06:41:34 PST 2018


djasper added a comment.

Got two responses so far.

1. Having to closing braces in the same column is weird, but not that weird. Consider



  namespace n {
  void f() {
    ...
  }
  }

2. Richard Smith (code owner of Clang) says that he doesn't really like the two closing braces in the same column, but he always cheats by removing the braces for the last case label / default. You never need them. In any case he'd strongly prefer the current behavior over adding an extra break and more indentation.

In conclusion, I don't think we want to move forward with making clang-format do

  switch (x) {
  case 1:
    {
      doSomething();
    }
  }

even with IndentCaseLabels: false.


Repository:
  rC Clang

https://reviews.llvm.org/D43183





More information about the cfe-commits mailing list