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

Francois Ferrand via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 13 08:48:30 PST 2018


Typz added a comment.

Hum, not sure I fully got your proposal. So you actually mean that clang-format you format like this (with 4-space indent for clarity):

  switch (x) {
  case 0:
      break;
  case 1: {
      foo();
      break;
  }
  case 2: {
      foo();
  } break;
  case 3:
      {
          foo();
      }
      bar();
      break;
  }

Is this right?

If so it does not really help me: I don't care so much how it is formatted, but I think the current way is way too error prone (and I cannot change the style to indent the case blocks themself). So i'll have to keep a patch in my fork :-(
Or maybe the behavior should be dependant on `IndentCaseLabels` (though this would change LLVM style formatting) ?


Repository:
  rC Clang

https://reviews.llvm.org/D43183





More information about the cfe-commits mailing list