r189353 - clang-format: Format segments of builder-type calls one per line.

Daniel Jasper djasper at google.com
Fri Sep 6 01:59:07 PDT 2013


Again, thanks for root-causing this!

Fixed the cause for the regression in r190126. However, I don't think we
address this well in all cases. E.g. if getTopLevelRegion() had a
parameter, we would still break after that call (and we "always" have).
Please file a bug, if this comes up!


On Fri, Sep 6, 2013 at 1:20 AM, Tobias Grosser <tobias at grosser.es> wrote:

> On 08/27/2013 07:24 AM, Daniel Jasper wrote:
>
>> Author: djasper
>> Date: Tue Aug 27 09:24:43 2013
>> New Revision: 189353
>>
>> URL: http://llvm.org/viewvc/llvm-**project?rev=189353&view=rev<http://llvm.org/viewvc/llvm-project?rev=189353&view=rev>
>> Log:
>> clang-format: Format segments of builder-type calls one per line.
>>
>> This fixes llvm.org/PR14818.
>>
>> Before:
>>    return llvm::StringSwitch<Reference::**Kind>(name)
>>               .StartsWith(".eh_frame_hdr", ORDER_EH_FRAMEHDR)
>>               .StartsWith(".eh_frame", ORDER_EH_FRAME)
>>               .StartsWith(".init", ORDER_INIT).StartsWith(".fini"**,
>> ORDER_FINI)
>>               .StartsWith(".hash", ORDER_HASH).Default(ORDER_**TEXT);
>>
>> After:
>>    return llvm::StringSwitch<Reference::**Kind>(name)
>>               .StartsWith(".eh_frame_hdr", ORDER_EH_FRAMEHDR)
>>               .StartsWith(".eh_frame", ORDER_EH_FRAME)
>>               .StartsWith(".init", ORDER_INIT)
>>               .StartsWith(".fini", ORDER_FINI)
>>               .StartsWith(".hash", ORDER_HASH)
>>               .Default(ORDER_TEXT);
>>
>
> This change introduced the following regression:
>
> Before:
>
> int foo() {
>   if (1)
>     if (1)
>       if (1)
>         O.indent(2 * (depth + 1))
>             << "Node"
>             << static_cast<void *>(RI->getTopLevelRegion()->**
> getBBNode(*BI))
>             << ";\n";
> }
>
> After:
>
> int foo() {
>   if (1)
>     if (1)
>       if (1)
>         O.indent(2 * (depth + 1)) << "Node"
>                                   << static_cast<void
> *>(RI->getTopLevelRegion()
>
> ->getBBNode(*BI))
>                                   << ";\n";
> }
>
> I believe moving the << to a new line is better to read than adding a line
> break before the call to ->getBBNode().
>
> Cheers,
> Tobias
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130906/36bdec24/attachment.html>


More information about the cfe-commits mailing list