[prev in list] [next in list] [prev in thread] [next in thread]
List: cfe-dev
Subject: [cfe-dev] clang-format debugging help: bin-packing of argument subexpressions
From: Jacob Bandes-Storch via cfe-dev <cfe-dev () lists ! llvm ! org>
Date: 2017-04-23 19:50:38
Message-ID: CADcs6kObgHUOmCGc3s+J9=2qEMargjFgc9KQWWgzCispansf-g () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hi,
Is there anyone familiar with the clang-format implementation who could
point me in the right direction for fixing a limitation?
I have noticed that setting "BinPackArguments: false" also disables
bin-packing of expressions *within* call arguments, after the first filled
line. For instance:
someFunctionCall(
argumentOne,
argumentTwo,
1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14
+ 15
+ 16
+ 17
+ 18
+ 19
+ 20);
I could see enabling/disabling bin-packing for expressions being a valuable
feature, perhaps as a separate BinPackExpressions (separate from
-Parameters and -Arguments), but as it is today this just seems like a bug.
The implementation of ContinuationIndenter::addTokenOnCurrentLine,
addTokenOnNewLine,
canBreak, mustBreak, etc. are a bit hairy for a first-time reader, so I'm
not really sure what's going wrong yet. It seems mustBreak is returning
true from "Current.is(TT_BinaryOperator) && Current.CanBreakBefore &&
State.Stack.back().BreakBeforeParameter
<https://github.com/llvm-mirror/clang/blob/master/lib/Format/ContinuationIndenter.cpp#L248-L251>".
Does anyone have insight into why this condition exists?
BreakBeforeParameter doesn't seem relevant to this situation.
Thanks :-)
Jacob
[Attachment #5 (text/html)]
<div dir="ltr"><div><div class="gmail_signature"><div dir="ltr"><div><span \
style="font-size:12.8px">Hi,</span><br \
class="gmail-m_6968777363088364278gmail-Apple-interchange-newline" \
style="font-size:12.8px"><span style="font-size:12.8px">Is there anyone familiar with \
the clang-format implementation who could point me in the right direction for fixing \
a limitation?</span><div style="font-size:12.8px"><br></div><div \
style="font-size:12.8px">I have noticed that setting "BinPackArguments: \
false" also disables bin-packing of expressions <b>within</b> call arguments, \
after the first filled line. For instance:<div><br></div><div><div> \
someFunctionCall(</div><div> argumentOne,</div><div> \
argumentTwo,</div><div> 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + \
12 + 13 + 14</div><div> + 15</div><div> \
+ 16</div><div> + 17</div><div> + \
18</div><div> + 19</div><div> + \
20);</div></div><div><br></div><div>I could see enabling/disabling bin-packing for \
expressions being a valuable feature, perhaps as a separate BinPackExpressions \
(separate from -Parameters and -Arguments), but as it is today this just seems like a \
bug.</div><div><br></div><div>The implementation of \
ContinuationIndenter::<wbr>addTokenOnCurrentLine, <wbr>addTokenOnNewLine, canBreak, \
mustBreak, etc. are a bit hairy for a first-time reader, so I'm not really sure \
what's going wrong yet. It seems mustBreak is returning true from "<a \
href="https://github.com/llvm-mirror/clang/blob/master/lib/Format/ContinuationIndenter.cpp#L248-L251" \
target="_blank">Current.is(TT_BinaryOperator) && Current.CanBreakBefore \
&& State.Stack.back().<wbr>BreakBeforeParameter</a>". Does anyone have \
insight into why this condition exists? BreakBeforeParameter doesn't seem \
relevant to this situation.</div></div><div style="font-size:12.8px"><br></div><div \
style="font-size:12.8px">Thanks :-)</div></div><div \
style="font-size:12.8px">Jacob</div></div></div></div> </div>
[Attachment #6 (text/plain)]
_______________________________________________
cfe-dev mailing list
cfe-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic