[cfe-dev] clang-format BreakBeforeBraces: Custom

phi clang via cfe-dev cfe-dev at lists.llvm.org
Wed Feb 3 08:30:08 PST 2016


Hi All,

learning curve is steep :)

From
CX08$ more c1.c
struct yo {
int i;
int j;
};

int f(int i, int j)
{ if(i){i++;} else {j++;}
  return(i+j);
}

I'd like to get
CX08$ more c1.c
struct yo
{ int i;
  int j;
};

int f(int i, int j)
{ if(i)
  { i++;
  }
  else
  { j++;
    return(i+j);
  }
}


I found BreakBeforeBraces Allman about ok but has an extra line I don't want

CX08$ /home/phi/llvmbuild/bin/clang-format c.c
struct yo
{ <----- don't want this \n
  int i;
  int j;
};

int f(int i, int j)
{<----- don't want this \n
  if (i)
  {<----- don't want this \n
    i++;
  }
  else
  {<----- don't want this \n
    j++;
  }
  return (i + j);
}


Any ideas how to tweak .clang-format

Try and fail on all option is a bit slow :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160203/96cce70a/attachment.html>


More information about the cfe-dev mailing list