<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I can't help with the work itself, but as a developer I'd love to
see something like this in Clang. It would be very very useful.<br>
<br>
I can see an argument for this being stylistic, but as an
off-by-default option, I see no real downside to including it. <br>
<br>
Philip<br>
<br>
<div class="moz-cite-prefix">On 02/23/2014 03:58 PM, Nico Weber
wrote:<br>
</div>
<blockquote
cite="mid:CAMGbLiF9cLWt-Hr1eVFf=+cBkFb0eNQU95NkL1xSdqizWuU79w@mail.gmail.com"
type="cite">
<div dir="ltr">Hi,
<div><br>
</div>
<div>motivated by the current libsecurity_ssl brouhaha, I
experimented with giving clang a -Windent that warns on
strange indent. For performance and other reasons, it it only
compares the indent of the first statement after a
non-composite if/for/while with the indent of the if/for/while
itself, and warns if the statement following the if/for/while
(not the child of the if/for/while, but the statement after
that) has a higher indent than the if/for/while. So it'd warn
on this:</div>
<div><br>
</div>
<div> if (1)</div>
<div> do_stuff();</div>
<div> do_stuff(); // Has higher indent than the if</div>
<div><br>
</div>
<div>This works better than I thought it would – I tried it on
chromium, and while it fires quite a bit, when it fires it's
justified most of the time. It's probably too loud to be
enabled by default, but it should do well in nicely-formatted
codebases such as llvm, webkit, chromium's non-third-party
code, etc.</div>
<div><br>
</div>
<div>I'm away for the next week, but maybe someone wants to pick
it up. The patch and many code snippets that are tricky are
in <a moz-do-not-send="true"
href="http://llvm.org/bugs/show_bug.cgi?id=18938">http://llvm.org/bugs/show_bug.cgi?id=18938</a>
.</div>
<div><br>
</div>
<div>(I also tried a different approach that didn't work as
well, see bug.)</div>
<div><br>
</div>
<div>Nico</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
cfe-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a>
</pre>
</blockquote>
<br>
</body>
</html>