summaryrefslogtreecommitdiffstats
path: root/unittests
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-11-11 23:04:51 +0000
committerDaniel Jasper <djasper@google.com>2014-11-11 23:04:51 +0000
commit411d4e186ce6fff47c41aaa20cdcbcf7cc2488fd (patch)
treea1ab4e68f17a0e93263043923efce6427c8cec63 /unittests
parentdbcf9811c819d499abd976768403cfa619a82cde (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221727 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Format/FormatTest.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 1f95a89893..37c3c0e752 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/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.