<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">Hi Daniel,<br><br>Most of appears to be working with the Whitesmiths; however I still have one group of tests failing.</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">These tests contain enumerations, the scenario is the following:<br><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">enum X</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">  {</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">  Y = 0</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">  }<br><br>which gets formatted to:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">enum X</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">{</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">  Y = 0</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">}</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br>If I call addUnwrappedLine() at the end of parseEnum() the result becomes the following:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">enum X</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">  {</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">    Y = 0</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">  }</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">The debug information tells me the following:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><div class="gmail_default">Line(0): enum[47] identifier[47] </div><div class="gmail_default">Line(1): l_brace[47] identifier[47] equal[47] numeric_constant[47] r_brace[47] </div><div class="gmail_default">Line(0): eof[47] </div><div><br></div><div>Hower for this result I expect it to be more like:</div><div><div class="gmail_default">Line(0): enum[47] identifier[47] </div><div class="gmail_default">Line(1): l_brace[47]</div><div class="gmail_default">Line(2): identifier[47] equal[47] numeric_constant[47]</div><div class="gmail_default">Line(1): r_brace[47] </div><div class="gmail_default">Line(0): eof[47] </div></div><div><br></div><div>However I'm guessing that I am missing something obvious;<br>I do however suspect parseBracedList() from doing something which I don't completely understand<br>OR something in the UnwrappedLineFormatter.cpp file to mess this up.<br><br>Any idea on where to look for the responsible?</div><div><br></div></div><div class="gmail_extra"><div><div><div dir="ltr"><div><font face="verdana, sans-serif"><font size="1"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0);display:inline">​JVApen​</div><br></font></font></div></div></div></div>
<br><div class="gmail_quote">On 26 December 2014 at 20:14, Daniel Jasper <span dir="ltr"><<a href="mailto:djasper@google.com" target="_blank">djasper@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Fri, Dec 26, 2014 at 7:53 PM, JVApen <span dir="ltr"><<a href="mailto:JVApen@gmail.com" target="_blank">JVApen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">Hi all,<br><br>I was looking into the clang tools to experiment with; hoping to convince some colleagues that tooling can save us time.<br>Anyhow; since I was trying to take baby steps; clang format looked like a very good start.<br>Unfortunately, we would not be programmers if we wouldn't do things a bit different than the rest of the world.</div><div style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">The current code; with too many files; uses the <a href="http://en.wikipedia.org/wiki/Indent_style#Whitesmiths_style" target="_blank">Whitesmiths style</a> at most places.<br>Though this is not yet supported by clang format.<br>Going through the code, adding support for it did not look like a big thing; since Allman and GNU are very similar.<br>The thing I did not realize is that both of them indent all code by one level compared to the {,<br>which is not done by Whitesmiths style.<br></div></div></blockquote><div><br></div></span><div>That actually shouldn't matter much. The whether or not to break before the "{" is controlled by calling addUnwrappedLine() one more time whereas the indentation is controlled by changing Line->Level. Basically all you should need to do is to change the order of "addUnwrappedLine(); ++Line->Level;" for the addUnwrappedLine() call for the "{". Unfortunately, there is no nice abstraction for this and you'll need to look at how to do this for the different kinds of syntactic elements individually. I can look into it and give more help if you get stuck.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span><div dir="ltr"><div style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">I already wrote a unit test, based on the Allman unit test; useful for test driven development<br>and experimented already with the code in lib/Format/UnwrappedLineParser.cpp<br>Though can't seem to find out how to prevent the extra indent;<br>does anyone with more codebase experience have an idea where to start?</div><span><font color="#888888"><br clear="all"><div><div><div dir="ltr"><div><font face="verdana, sans-serif">JVApen<font size="1"><br></font></font></div></div></div></div>
</font></span></div>
<br></span>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>
</blockquote></div><br></div></div>