diff options
author | Manuel Klimek <klimek@google.com> | 2013-01-23 14:08:21 +0000 |
---|---|---|
committer | Manuel Klimek <klimek@google.com> | 2013-01-23 14:08:21 +0000 |
commit | c1237a8b8fb71bace4af3fcd7da91c41cbf107c6 (patch) | |
tree | 8a6dbce35217aaad97c5fce8383c72f27f0848e8 /clang/unittests/Format/FormatTest.cpp | |
parent | 7206a145dd83c3c39706c9a6c3581ae57d4c3630 (diff) | |
download | bcm5719-llvm-c1237a8b8fb71bace4af3fcd7da91c41cbf107c6.tar.gz bcm5719-llvm-c1237a8b8fb71bace4af3fcd7da91c41cbf107c6.zip |
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
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index d1af838a730..806a7eb9c08 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -1365,6 +1365,13 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) { 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;"); |