Issue 148199
Summary [format] Macro replacement results in long code to be put on a single line.
Labels new issue
Assignees
Reporter JVApen
    ````
#define DEFAULT_UNREACHABLE() default: break
auto func()
{
    switch (0)
    {
        case 0:
 return MyVeryLongInitialization{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, {MyOtherClass{abc,def,ghi}}};   
        case 1:
         return MyVeryLongInitialization{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z, {MyOtherClass{abc,def,ghi}}};   
         DEFAULT_UNREACHABLE();
 }
}
````
I'm using the following config:
````
--style="{ 'Macros': ['DEFAULT_UNREACHABLE=default: break' ], 'ColumnLimit': 20, 'AllowShortCaseExpressionOnASingleLine': true}"
````
results in 
````
#define DEFAULT_UNREACHABLE() \
  default:                    \
 break
auto func() {
  switch (0) {
  case 0:
    return MyVeryLongInitialization{
        a,
        b,
        c,
        d,
 e,
        f,
        g,
        h,
        i,
        j,
 k,
        l,
        m,
        n,
        o,
        p,
        q,
 r,
        s,
        t,
        u,
        v,
        w,
 x,
        y,
        z,
        {MyOtherClass{
            abc,
 def,
            ghi}}};
  case 1:
    return MyVeryLongInitialization{a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, {MyOtherClass{abc, def, ghi}}};
 DEFAULT_UNREACHABLE();
  }
}
````
while I expect the second return to be formatted the same as the first one.

Note that with 'Macros', I cannot define a replacement for `DEFAULT_UNREACHABLE()`, only for `DEFAULT_UNREACHABLE` 
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to