<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 6/30/20 12:55 PM, Matt Arsenault via
llvm-dev wrote:<br>
</div>
<blockquote type="cite" cite="mid:3B1350BE-183C-4E78-9E8F-F12E087A3A2D@gmail.com">
<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Jun 28, 2020, at 11:30, MyDeveloper Day via
llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="" moz-do-not-send="true">llvm-dev@lists.llvm.org</a>>
wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<p style="caret-color: rgb(0, 0, 0); font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; font-family: Helvetica, Arial,
sans-serif; font-size: 15.008px;" class="">I’m a
contributor to clang-format and would like to see LLVM
100% clang formatted so we can use LLVM as a massive
test-suite for clang-format when we make changes.</p>
<br class="Apple-interchange-newline">
</div>
</blockquote>
</div>
<br class="">
<div class="">My main issue with this would be that clang-format
does things that I don’t believe are stated in the LLVM style
guide and I also disagree with. There’s a whole set of cases
where it makes unwelcome changes to put things that were on
separate lines on a single line. Whenever I run clang-format, I
typically git checkout -p to discard all of these.</div>
<div class=""><br class="">
</div>
<div class="">For example, it likes to take member initializer
lists and pack them into as few lines as possible. This is just
asking for merge conflicts (e.g. AMDGPUSubtarget has a ton of
fields in it, and out of tree code is constantly adding new
fields for unreleased subtargets). It also mangles BuildMI
calls, where I believe every .add() should be on its own line,
and stringing this into BuildMI().addFoo().addBar() is way less
readable.</div>
</blockquote>
<p><br>
</p>
<p>I agree that this is problematic. There are a number of places
where repeated syntactic structures (e.g., in enums, initializers,
chained-operator invocation) are represented using regular line
offsets and line breaks. This is valuable, allows for
semantically-relevant grouping, and in my opinion, enhances
readability. I've certainly caught bugs in code that I've written
because they became obvious once I lined everything up. Can
clang-format be taught to format things in this way? For
particular, long sections of code, I can imagine using some
don't-format-here markers, but you wouldn't want these around
every BuildMI(...) call.</p>
<p> -Hal<br>
</p>
<p><br>
</p>
<blockquote type="cite" cite="mid:3B1350BE-183C-4E78-9E8F-F12E087A3A2D@gmail.com">
<div class=""><br class="">
</div>
<div class="">I also believe it’s 4 space indent on line wraps
differs from the stated 2 space indent level (and this also
disagrees with emacs llvm-style)</div>
<div class=""><br class="">
</div>
<div class="">-Matt</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
</body>
</html>