<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:10pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:10pt; color:#000000; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>When adding more tests, an issue with this approach was found using scopes:</p>
<p><br>
</p>
<p></p>
<div>switch (x) {</div>
<div>  case 1:</div>
<div>    break;</div>
<div>  case (2):</div>
<div>    break;</div>
<div>  case 3: {</div>
<div>    break;</div>
<div>} // <-- Seems we should offset this by 2</div>
<div>}</div>
<div><br>
</div>
<div>I'll look into getting this behavior and update the patch.</div>
<div><br>
</div>
<div>~Ryan</div>
<br>
<p></p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Ryan Livingston<br>
<b>Sent:</b> Monday, February 6, 2017 7:28:54 AM<br>
<b>To:</b> cfe-commits@lists.llvm.org<br>
<b>Subject:</b> [PATCH] [clang-format]: Add support for changing case/default indent/outdent with clang-format</font>
<div> </div>
</div>
<div>
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:10pt; color:#000000; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi all,</p>
<p><br>
</p>
<p>First time submitting a patch here. Any feedback is appreciated.</p>
<p><br>
</p>
<p>This proposed patch adds a new configuration option <span>CaseLabelOffset for clang-format which behaves similarly to <span>AccessModifierOffset. Namely, it permits modifying the indent/outdent of case and default labels.</span></span></p>
<p><span><span><br>
</span></span></p>
<p><span><span>With indent level 4, IndentCaseLabels false, and CaseLabelOffset 2 you'll get a switch like:</span></span></p>
<p><span><span><br>
</span></span></p>
<p><span><span></span></span></p>
<div>switch (x) {</div>
<div>  case 1:</div>
<div>    break;</div>
<div>  case (2):</div>
<div>    break;</div>
<div>}</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>For verification, I ran:</div>
<div><br>
</div>
<div>  make clang-test</div>
<div><br>
</div>
<div>My new tests failed and I iterated running:</div>
<div><br>
</div>
<div>  <span>tools/clang/unittests/Format/FormatTests</span></div>
<div><span><br>
</span></div>
<div><span>until everything passed.</span></div>
<div><br>
</div>
<div>Thanks,</div>
<div>Ryan Livingston</div>
<br>
<p></p>
</div>
</div>
</div>
</body>
</html>