Fixes layouting regression and invalid-read.
Layouting would prevent breaking before + in
a[b + c] = d;
Regression detected by code review.
Also fixes an invalid-read found by the valgrind bot.
llvm-svn: 173262
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index d1af838..806a7eb 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -1365,6 +1365,13 @@
verifyGoogleFormat("A = new SomeType* [Length]();");
}
+TEST_F(FormatTest, FormatsBinaryOperatorsPrecedingEquals) {
+ verifyFormat("void f() {\n"
+ " x[aaaaaaaaa -\n"
+ " b] = 23;\n"
+ "}", getLLVMStyleWithColumns(15));
+}
+
TEST_F(FormatTest, FormatsCasts) {
verifyFormat("Type *A = static_cast<Type *>(P);");
verifyFormat("Type *A = (Type *)P;");