diff options
author | Daniel Jasper <djasper@google.com> | 2013-04-01 17:13:26 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-04-01 17:13:26 +0000 |
commit | 81d2d38d2d774a2550fa0d2efffa707e7a53b39c (patch) | |
tree | c197a28b91c76916a7dffa7c8bf3a81e015d02c0 /unittests/Format/FormatTest.cpp | |
parent | bf27951d675b8da1246069bc4ae68066338a9f86 (diff) |
Improve formatting of function types.
Before: void * (*a)(int *, SomeType *);
After: void *(*a)(int *, SomeType *);
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178474 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 83c7a2adbf..62ce4c33ac 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -2213,7 +2213,7 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) { verifyIndependentOfContext("a[a * a] = 1;"); verifyIndependentOfContext("f() * b;"); verifyIndependentOfContext("a * [self dostuff];"); - verifyIndependentOfContext("a * (a + b);"); + verifyIndependentOfContext("int x = a * (a + b);"); verifyIndependentOfContext("(a *)(a + b);"); verifyIndependentOfContext("int *pa = (int *)&a;"); verifyIndependentOfContext("return sizeof(int **);"); @@ -2378,12 +2378,14 @@ TEST_F(FormatTest, FormatsFunctionTypes) { verifyFormat("A<SomeType()> a;"); verifyFormat("A<void(*)(int, std::string)> a;"); verifyFormat("A<void *(int)>;"); + verifyFormat("void *(*a)(int *, SomeType *);"); // FIXME: Inconsistent. verifyFormat("int (*func)(void *);"); verifyFormat("void f() { int(*func)(void *); }"); - verifyGoogleFormat("A<void*(int)>;"); + verifyGoogleFormat("A<void*(int*, SomeType*)>;"); + verifyGoogleFormat("void* (*a)(int);"); } TEST_F(FormatTest, BreaksLongDeclarations) { |