Re: [cfe-users] clang-format option to not break lines at operator ->

2017-06-22 Thread Mikhail Artemyev via cfe-users
Hi All,

I am currently trying to beatify a reasonably large code base, and I am
quite surprised about how clang-format breaks long lines where there is a
'->' operator.

Example:
% cat test.cpp
int func() {
   aaa = bb->cc(SomeNamespace::Function(
?"":"")).gg();
}

I tried different clang-format styles, but they all break this long line at
the '->':
% for s in LLVM Google Chromium Mozilla WebKit; do clang-format
-style="{BasedOnStyle: $s, ColumnLimit: 80}" test.cpp; done
int func() {
  aaa = bb
->cc(SomeNamespace::Function( ?
""
  :
""))
.gg();
}
int func() {
  aaa = bb
->cc(SomeNamespace::Function( ?
""
  :
""))
.gg();
}
int func() {
  aaa = bb
->cc(SomeNamespace::Function( ?
""
  :
""))
.gg();
}
int
func()
{
  aaa =
bb
  ->cc(SomeNamespace::Function( ? "" :
""))
  .gg();
}
int func()
{
aaa = bb
  ->cc(SomeNamespace::Function(
   ? "" : ""))
  .gg();
}

Is there a way to prevent clang-format from breaking lines like that at the
'->'?

Thank you,
Mikhail

>
___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users


Re: [cfe-users] clang-format option to not break lines at operator ->

2017-06-25 Thread Mikhail Artemyev via cfe-users
Hi Csaba,

I can think of several possible results that look better (to me) than the
current one:

int func() {
   aaa = bb->cc(

 SomeNamespace::Function(?"":"")).gg();
}

OR

int func() {
   aaa = bb->cc(
 SomeNamespace::Function(
?"":"")
 ).gg();
}


OR

int func() {
   aaa = bb->cc(SomeNamespace::Function(
?"":"")).gg();
}


In fact, pretty much anything that doesn't break the line at '->' works for
me.

This is not the case with the current clang-format, though. If you run
clang-format (with any predefined style) for either of the aforementioned
codes, it always breaks the line with '->', even if all lines satisfy the
column limit.

Thank you,
Mikhail


On Sat, Jun 24, 2017 at 10:25 AM, Csaba Raduly  wrote:

> Hi Mikhail,
>
> On Thu, Jun 22, 2017 at 11:44 PM, Mikhail Artemyev via cfe-users
>  wrote:
> > Hi All,
> >
> > I am currently trying to beatify a reasonably large code base, and I am
> > quite surprised about how clang-format breaks long lines where there is a
> > '->' operator.
> >
> > Example:
> > % cat test.cpp
> > int func() {
> >aaa = bb->cc(SomeNamespace::Function(
> ?"":"")).gg();
> > }
>
>
> How would you like the result to look like?
>
> Csaba
>
> --
> GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
> The Tao of math: The numbers you can count are not the real numbers.
> Life is complex, with real and imaginary parts.
> "Ok, it boots. Which means it must be bug-free and perfect. " -- Linus
> Torvalds
> "People disagree with me. I just ignore them." -- Linus Torvalds
>
___
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users