diff options
| author | Daniel Jasper <djasper@google.com> | 2013-12-19 16:45:34 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2013-12-19 16:45:34 +0000 |
| commit | 19a541eff09b82f2271685333c4e9d446b2bad60 (patch) | |
| tree | bb9f7dc20ed38f679557e2eda2a65519d95f89ea /clang/unittests/Format/FormatTest.cpp | |
| parent | e6d79ec0ebac350355c76d8132e9f1cce62e0cac (diff) | |
| download | bcm5719-llvm-19a541eff09b82f2271685333c4e9d446b2bad60.tar.gz bcm5719-llvm-19a541eff09b82f2271685333c4e9d446b2bad60.zip | |
clang-format: Increase penalty for breaking comments.
Unexpectedly, it seems that people commonly know what they were doing
when writing a comment.
Also, being more conservative about comment breaking has the advantage
of giving more flexibility. If a linebreak within the comment can
improve formatting, the author can add it (after which clang-format
won't undo it). There is no way to override clang-format's behavior if
it breaks a comment.
llvm-svn: 197698
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index db105ee3233..a56333d7783 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -996,14 +996,14 @@ TEST_F(FormatTest, SplitsLongCxxComments) { format("// A comment before a macro definition\n" "#define a b", getLLVMStyleWithColumns(20))); - EXPECT_EQ("void ffffff(int aaaaaaaaa, // wwww\n" - " int a, int bbb, // xxxxxxx\n" - " // yyyyyyyyy\n" - " int c, int d, int e) {}", + EXPECT_EQ("void\n" + "ffffff(int aaaaaaaaa, // wwww\n" + " int bbbbbbbbbb, // xxxxxxx\n" + " // yyyyyyyyyy\n" + " int c, int d, int e) {}", format("void ffffff(\n" " int aaaaaaaaa, // wwww\n" - " int a,\n" - " int bbb, // xxxxxxx yyyyyyyyy\n" + " int bbbbbbbbbb, // xxxxxxx yyyyyyyyyy\n" " int c, int d, int e) {}", getLLVMStyleWithColumns(40))); EXPECT_EQ("//\t aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", @@ -1067,9 +1067,9 @@ TEST_F(FormatTest, PriorityOfCommentBreaking) { format("if (xxxxxxxxxx && yyy || // aaaaaa bbbbbbbb cccc\n" " zzz) q();", getLLVMStyleWithColumns(40))); - EXPECT_EQ("fffffffff(&xxx, // aaaaaaaaaaaa\n" - " // bbbbbbbbbbb\n" - " zzz);", + EXPECT_EQ("fffffffff(\n" + " &xxx, // aaaaaaaaaaaa bbbbbbbbbbb\n" + " zzz);", format("fffffffff(&xxx, // aaaaaaaaaaaa bbbbbbbbbbb\n" " zzz);", getLLVMStyleWithColumns(40))); |

