summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-10-25 14:29:37 +0000
committerDaniel Jasper <djasper@google.com>2013-10-25 14:29:37 +0000
commit33b909c5f37642840be684044e8a29dc772ae71c (patch)
tree99abea28569dc931753fc1bfc77fd82e1e3949eb /clang/unittests/Format/FormatTest.cpp
parent2acb2470f977ceb192b575d62f235d2b6a4f8ceb (diff)
downloadbcm5719-llvm-33b909c5f37642840be684044e8a29dc772ae71c.tar.gz
bcm5719-llvm-33b909c5f37642840be684044e8a29dc772ae71c.zip
clang-format: Adapt line break penalties for LLVM style.
Specifically make clang-format less eager to break after the opening parenthesis of a function call. Before: aaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); After: aaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); Apparently that is preferable. This penalties are adapted conservatively, we might have to increase them a little bit further. llvm-svn: 193410
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 431940938dc..ac95f27b2f6 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -2973,9 +2973,9 @@ TEST_F(FormatTest, BreaksDesireably) {
"aaaaaa(aaa, new Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaa));");
verifyFormat(
- "aaaaaaaaaaaaaaaaa(\n"
- " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
- " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);");
+ "aaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +\n"
+ " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
+ " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);");
// Indent consistently indenpendent of call expression.
verifyFormat("aaaaaaaaaaa(bbbbbbbbbbbbbbbbbbbbbbbbb.ccccccccccccccccc(\n"
@@ -3122,7 +3122,7 @@ TEST_F(FormatTest, FormatsBuilderPattern) {
" ->aaaaaaaaaaaaaaaa(\n"
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)\n"
" ->aaaaaaaaaaaaaaaaa();");
- verifyFormat(
+ verifyGoogleFormat(
"someobj->Add((new util::filetools::Handler(dir))\n"
" ->OnEvent1(NewPermanentCallback(\n"
" this, &HandlerHolderClass::EventHandlerCBA))\n"
@@ -4497,7 +4497,7 @@ TEST_F(FormatTest, LayoutCxx11ConstructorBraceInitializers) {
NoSpaces);
}
-TEST_F(FormatTest, FormatsBracedListsinColumnLayout) {
+TEST_F(FormatTest, FormatsBracedListsInColumnLayout) {
verifyFormat("vector<int> x = { 1, 22, 333, 4444, 55555, 666666, 7777777,\n"
" 1, 22, 333, 4444, 55555, 666666, 7777777,\n"
" 1, 22, 333, 4444, 55555, 666666, 7777777,\n"
@@ -4538,8 +4538,8 @@ TEST_F(FormatTest, FormatsBracedListsinColumnLayout) {
verifyFormat("vector<int> x = { 1, 1, 1, 1,\n"
" 1, 1, 1, 1, };",
getLLVMStyleWithColumns(39));
- verifyFormat("vector<int> x = {\n"
- " 1, 1, 1, 1, 1, 1, 1, 1, //\n"
+ verifyFormat("vector<int> x = { 1, 1, 1, 1,\n"
+ " 1, 1, 1, 1, //\n"
"};",
getLLVMStyleWithColumns(39));
verifyFormat("vector<int> x = { 1, 1, 1, 1,\n"
@@ -6597,6 +6597,8 @@ TEST_F(FormatTest, ParsesConfiguration) {
ConstructorInitializerIndentWidth, 1234u);
CHECK_PARSE("ColumnLimit: 1234", ColumnLimit, 1234u);
CHECK_PARSE("MaxEmptyLinesToKeep: 1234", MaxEmptyLinesToKeep, 1234u);
+ CHECK_PARSE("PenaltyBreakBeforeFirstCallParameter: 1234",
+ PenaltyBreakBeforeFirstCallParameter, 1234u);
CHECK_PARSE("PenaltyExcessCharacter: 1234", PenaltyExcessCharacter, 1234u);
CHECK_PARSE("PenaltyReturnTypeOnItsOwnLine: 1234",
PenaltyReturnTypeOnItsOwnLine, 1234u);
OpenPOWER on IntegriCloud