[llvm-bugs] [Bug 25148] New: clang-format: missing options for templates formatting

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 12 06:58:12 PDT 2015


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

            Bug ID: 25148
           Summary: clang-format: missing options for templates formatting
           Product: new-bugs
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: j.l.k at gmx.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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] http://clang.llvm.org/docs/ClangFormatStyleOptions.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151012/4d1ef61e/attachment.html>


More information about the llvm-bugs mailing list