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

Francois Ferrand via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 28 06:52:20 PST 2018


Typz added a comment.

> I don't agree that that's the same thing. The closing brace is still neatly aligned with the line of the opening brace (which happens to be just the opening brace).

This invariant is not really applicable to switch statements, where code of each "branch" is already indented with no opening brace. :-)

I can try to change the mode so that we get either "google" style:

  switch (x) {
  case 0: {
    foo():
  } break;
  }

or "regular indentation" mode (e.g. what would look like no special indentation rule):

  switch (x) {
  case 0:
    {
      foo():
    }
    break;
  }

Generally, would a flag for `CaseBlockIndent` be acceptable for this purpose ?
Or should the behavior simply be selected depending on `IndentCaseLabels` ?


Repository:
  rC Clang

https://reviews.llvm.org/D43183





More information about the cfe-commits mailing list