clang-format: Fix incorrect line breaks after forced operator wraps.
Before:
bool x = aaaaa //
||
bbbbb
//
|| cccc;
After:
bool x = aaaaa //
|| bbbbb
//
|| cccc;
llvm-svn: 293839
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 390dd20..cb0d7b3 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -4151,6 +4151,15 @@
Style);
}
+TEST_F(FormatTest, EnforcedOperatorWraps) {
+ // Here we'd like to wrap after the || operators, but a comment is forcing an
+ // earlier wrap.
+ verifyFormat("bool x = aaaaa //\n"
+ " || bbbbb\n"
+ " //\n"
+ " || cccc;");
+}
+
TEST_F(FormatTest, NoOperandAlignment) {
FormatStyle Style = getLLVMStyle();
Style.AlignOperands = false;