When adding more tests, an issue with this approach was found using scopes:
switch (x) { case 1: break; case (2): break; case 3: { break; } // <-- Seems we should offset this by 2 } I'll look into getting this behavior and update the patch. ~Ryan ________________________________ From: Ryan Livingston Sent: Monday, February 6, 2017 7:28:54 AM To: cfe-commits@lists.llvm.org Subject: [PATCH] [clang-format]: Add support for changing case/default indent/outdent with clang-format Hi all, First time submitting a patch here. Any feedback is appreciated. This proposed patch adds a new configuration option CaseLabelOffset for clang-format which behaves similarly to AccessModifierOffset. Namely, it permits modifying the indent/outdent of case and default labels. With indent level 4, IndentCaseLabels false, and CaseLabelOffset 2 you'll get a switch like: switch (x) { case 1: break; case (2): break; } Our team uses this style of formatting and when investigating switching to clang-format, I couldn't find a way to accomplish it. So I thought trying a patch would be a good route. For verification, I ran: make clang-test My new tests failed and I iterated running: tools/clang/unittests/Format/FormatTests until everything passed. Thanks, Ryan Livingston
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits