diff options
author | Daniel Jasper <djasper@google.com> | 2014-11-11 23:04:51 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2014-11-11 23:04:51 +0000 |
commit | 3eb341c4783bab96c1c2984d917b43edab47719c (patch) | |
tree | 8277916c959a4fb5a15c91bed6b55d6ef264bbb5 /clang/unittests/Format/FormatTest.cpp | |
parent | de5e32b5b45381e55272a7991fdc56afa946d7ca (diff) | |
download | bcm5719-llvm-3eb341c4783bab96c1c2984d917b43edab47719c.tar.gz bcm5719-llvm-3eb341c4783bab96c1c2984d917b43edab47719c.zip |
clang-format: Improve handling of comments in binary expressions.
Before:
b = a &&
// Comment
b.c &&
d;
After:
b = a &&
// Comment
b.c && d;
This fixes llvm.org/PR21535.
llvm-svn: 221727
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 1f95a89893d..37c3c0e7528 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -3118,6 +3118,9 @@ TEST_F(FormatTest, LineBreakingInBinaryExpressions) { verifyFormat("if ((aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ||\n" " bbbbbbbbbbbbbbbbbb) && // aaaaaaaaaaaaaaaa\n" " cccccc) {\n}"); + verifyFormat("b = a &&\n" + " // Comment\n" + " b.c && d;"); // If the LHS of a comparison is not a binary expression itself, the // additional linebreak confuses many people. |