[PATCH] D151761: clang-format: Add AlignConsecutiveShortCaseStatements

Galen Elias via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 12 21:39:45 PDT 2023


galenelias added a comment.

Well, I guess I didn't put quite enough thought into the `AlignCaseColons` option.  While this solves the empty case label problem, it will also match in non-short case label scenarios such as the following, which doesn't seem desirable:

  switch (level) {
  case log::info  :
  case log::error :
    return true;
  case log::none     :
  case log::warning  :
  case log::critical :
    return false;
  }

In order to solve this (and the other) issues, I think the only solution is to roll a custom alignment method instead of using `AlignTokens`, so that the alignment can be more correctly based on the detection of short case statements.

This is going to take considerably more time and code, so not sure when I'll be able to work on it.


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

https://reviews.llvm.org/D151761



More information about the cfe-commits mailing list