[PATCH] [clang-extra-tools] [clang-format] Fix AlwaysBreakAfterDefinitionReturnType incompatibility with BreakBeforeBraces: Stroustrup

Curdeius Curdeius curdeius at gmail.com
Mon Aug 11 08:50:04 PDT 2014


Hi,

I have found a bug when using a style like:
  AlwaysBreakAfterDefinitionReturnType: true
  BreakBeforeBraces: Stroustrup

I attach a straightforward patch that passes the tests.
However, I think that the issue may be actually somewhere deeper, e.g. in
`Line.Last` pointing incorrectly to a different token than l_brace (cf. the
patch).

An example.

Before:
  template <class T>
  T *f(T &c)  // Problem here: no line break before f
  {
    return NULL;
  }

After:
  template <class T>
  T *
  f(T &c)
  {
    return NULL;
  }

Regards,
Marek Kurdej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140811/98a2dbb9/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-clang-format-Fix-AlwaysBreakAfterDefinitionReturnTyp.patch
Type: application/octet-stream
Size: 2687 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140811/98a2dbb9/attachment.obj>


More information about the cfe-commits mailing list