[cfe-dev] clang-format: options for formatting templates

matthew whitehead via cfe-dev cfe-dev at lists.llvm.org
Tue Nov 24 17:57:13 PST 2015


Similar to bug 25148
https://llvm.org/bugs/show_bug.cgi?id=25148

There seems to be no options for directly formatting large template
declarations, instead the formatting is done mostly using the column width
and associates penalties.
(An example of our preferred formatting style for templates can be seen in
example1.cpp (attached), while the current output of clang-format can be
seen in example2.cpp).

Is there any current options that would solve provide the formatting we
require that I have overlooked please?
if not, is there anyone currently working on implementing something like
this?
otherwise, I would potentially be interested in implementing something to
solve this if someone can give me some guidance on where to start?
our .clang-format is attached as well for reference

I was thinking a potential solution would be adding an
AlwaysBreakOnOpeningTemplate option similar to the AlignAfterOpenBracket
option.

Cheers,
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151125/1b76e22b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.zip
Type: application/zip
Size: 1850 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151125/1b76e22b/attachment.zip>


More information about the cfe-dev mailing list