<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - clang-format: missing options for templates formatting"
href="https://llvm.org/bugs/show_bug.cgi?id=25148">25148</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang-format: missing options for templates formatting
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>3.7
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>j.l.k@gmx.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>When writing templated C++ code, I've converged to the following style for
out-of-class member function definitions:
template< typename Mesh,
typename MeshDependentData,
typename DifferentialOperator,
typename BoundaryConditions,
typename RightHandSide,
typename Matrix >
bool
Solver< Mesh, MeshDependentData, DifferentialOperator, BoundaryConditions,
RightHandSide, Matrix >::
preIterate( const RealType & time,
const RealType & tau,
const MeshType & mesh,
DofVectorType & dofVector,
MeshDependentDataType & mdd )
{
...
}
After reading the documentation for the style options [1], I don't see a way to
achieve exactly this result with clang-format. The closest I got with
"ColumnLimit: 0" is this:
template < typename Mesh, typename MeshDependentData, typename
DifferentialOperator, typename BoundaryConditions, typename RightHandSide,
typename Matrix >
bool
Solver< Mesh, MeshDependentData, DifferentialOperator, BoundaryConditions,
RightHandSide, Matrix >::preIterate( const RealType & time,
const RealType & tau,
const MeshType & mesh,
DofVectorType & dofVector,
MeshDependentDataType & mdd )
{
...
}
The missing options are:
1. Aligning template parameters on separate lines in template declarations and
possibly also member's class qualification. This should be the same as function
arguments list.
2. Breaking after :: if the member's class qualification is "sufficiently long"
(or always for consistency).
[1] <a href="http://clang.llvm.org/docs/ClangFormatStyleOptions.html">http://clang.llvm.org/docs/ClangFormatStyleOptions.html</a></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>