r215693 - clang-format: Prefer breaking after return type over template param
Daniel Jasper
djasper at google.com
Thu Aug 14 22:00:39 PDT 2014
Author: djasper
Date: Fri Aug 15 00:00:39 2014
New Revision: 215693
URL: http://llvm.org/viewvc/llvm-project?rev=215693&view=rev
Log:
clang-format: Prefer breaking after return type over template param
Before:
typename aaaaaaaaaa<aaaaaa>::aaaaaaaaaaa aaaaaaaaaa<
aaaaaa>::aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(bool *aaaaaaaaaaaaaaaaaa,
bool *aa) {}
After:
typename aaaaaaaaaa<aaaaaa>::aaaaaaaaaaa
aaaaaaaaaa<aaaaaa>::aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
bool *aaaaaaaaaaaaaaaaaa, bool *aa) {}
Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=215693&r1=215692&r2=215693&view=diff
==============================================================================
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Fri Aug 15 00:00:39 2014
@@ -1441,6 +1441,8 @@ unsigned TokenAnnotator::splitPenalty(co
return 110;
if (Right.is(tok::r_brace))
return 1;
+ if (Left.Type == TT_TemplateOpener)
+ return 100;
if (Left.opensScope())
return Left.ParameterCount > 1 ? Style.PenaltyBreakBeforeFirstCallParameter
: 19;
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=215693&r1=215692&r2=215693&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Fri Aug 15 00:00:39 2014
@@ -3428,6 +3428,10 @@ TEST_F(FormatTest, BreaksFunctionDeclara
" int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = 1);");
verifyFormat("aaaaaaaaaaaaaaaaaaaaaa\n"
"aaaaaaaaaaaaaaaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaa = 1);");
+ verifyGoogleFormat(
+ "typename aaaaaaaaaa<aaaaaa>::aaaaaaaaaaa\n"
+ "aaaaaaaaaa<aaaaaa>::aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
+ " bool *aaaaaaaaaaaaaaaaaa, bool *aa) {}");
}
TEST_F(FormatTest, TrailingReturnType) {
More information about the cfe-commits
mailing list