[PATCH] D151761: clang-format: Add AlignConsecutiveShortCaseStatements

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 11 12:53:31 PDT 2023


HazardyKnusperkeks added a comment.

After I came across some of my code, where I'd really like a feature like this, I'm back at wishing to align the colons. Same as in a bit field. And when you would do that I think there would be no open issue with empty statements, right?

So for my code I'd favor

  switch (level) {
  case log::info    : return "info:     ";
  case log::warning : return "warning:  ";
  case log::error   : return "error:    ";
  case log::critical: return "critical: ";
  default           : return "";
  }

over

  switch (level) {
  case log::info:     return "info:     ";
  case log::warning:  return "warning:  ";
  case log::error:    return "error:    ";
  case log::critical: return "critical: ";
  default:            return "";
  }

(For me actually there would always be at least one space before the colon.)
Maybe think about it?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151761/new/

https://reviews.llvm.org/D151761



More information about the cfe-commits mailing list