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: unassignedb...@nondot.org
          Reporter: j....@gmx.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to