Allow breaking between a type and name in variable declarations.
authorDaniel Jasper <djasper@google.com>
Sun, 24 Feb 2013 18:54:32 +0000 (18:54 +0000)
committerDaniel Jasper <djasper@google.com>
Sun, 24 Feb 2013 18:54:32 +0000 (18:54 +0000)
commit26d1b1db23babd59003f7c79219894b07fac32bb
tree604a09518c9025cdd36b0cec35e3290c4e5139ff
parentc68c6df88485b7521133103c848393b8a13842af
Allow breaking between a type and name in variable declarations.

This fixes llvm.org/PR14967 and is generall necessary to avoid
situations where the column limit is exceeded. The challenge is
restricting such lines splits, otherwise clang-format suddenly starts
breaking at bad places.

Before:
ReallyLongReturnType<TemplateParam1, TemplateParam2>
ReallyReallyLongFunctionName(
    const std::string &SomeParameter,
    const SomeType<string,
                   SomeOtherTemplateParameter> &ReallyReallyLongParameterName,
    const SomeType<string,
                   SomeOtherTemplateParameter> &AnotherLongParameterName) {}

After:
ReallyLongReturnType<TemplateParam1, TemplateParam2>
ReallyReallyLongFunctionName(
    const std::string &SomeParameter,
    const SomeType<string, SomeOtherTemplateParameter> &
        ReallyReallyLongParameterName,
    const SomeType<string, SomeOtherTemplateParameter> &
        AnotherLongParameterName) {}

llvm-svn: 175999
clang/lib/Format/Format.cpp
clang/lib/Format/TokenAnnotator.cpp
clang/lib/Format/TokenAnnotator.h
clang/unittests/Format/FormatTest.cpp