summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-07-18 14:46:07 +0000
committerDaniel Jasper <djasper@google.com>2013-07-18 14:46:07 +0000
commit998cabcff487b2941f738dfc8b607f03aadccd46 (patch)
tree8342a1ee8d5c5b2de3400defc75545045352c361 /clang/unittests/Format/FormatTest.cpp
parentbe0474c047b1cb01225494ccb3210d501490685c (diff)
downloadbcm5719-llvm-998cabcff487b2941f738dfc8b607f03aadccd46.tar.gz
bcm5719-llvm-998cabcff487b2941f738dfc8b607f03aadccd46.zip
clang-format: Fix bad line break with pointers to members.
Before: void f() { (a->* aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)(aaaa, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb); } After: void f() { (a->*aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)( aaaa, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb); } Also add missing test case. llvm-svn: 186583
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 05119f37cb1..ecdb7216ba6 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -3335,6 +3335,10 @@ TEST_F(FormatTest, UnderstandsPointersToMembers) {
" ((*a).*f)();\n"
" a.*x;\n"
"}");
+ verifyFormat("void f() {\n"
+ " (a->*aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)(\n"
+ " aaaa, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb);\n"
+ "}");
FormatStyle Style = getLLVMStyle();
Style.PointerBindsToType = true;
verifyFormat("typedef bool* (Class::*Member)() const;", Style);
@@ -3633,6 +3637,11 @@ TEST_F(FormatTest, FormatsCasts) {
verifyFormat("my_int a = (my_int)++ a;");
verifyFormat("my_int a = (my_int) + 2;");
+ // Don't break after a cast's
+ verifyFormat("int aaaaaaaaaaaaaaaaaaaaaaaaaaa =\n"
+ " (aaaaaaaaaaaaaaaaaaaaaaaaaa *)(aaaaaaaaaaaaaaaaaaaaaa +\n"
+ " bbbbbbbbbbbbbbbbbbbbbb);");
+
// These are not casts.
verifyFormat("void f(int *) {}");
verifyFormat("f(foo)->b;");
OpenPOWER on IntegriCloud