diff options
author | Daniel Jasper <djasper@google.com> | 2013-01-10 11:14:08 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-01-10 11:14:08 +0000 |
commit | 5cf7cf317f684dc61b8a0e4476440b5635b80db4 (patch) | |
tree | 89c93ff86a8c6c57ef45b83918abdf56568bcd76 /unittests/Format/FormatTest.cpp | |
parent | a2d37a51846fc748833b744076098a5ea002ab00 (diff) |
Improve clang-format's understanding of casts.
This fixes llvm.org/PR14684.
Before: int *pa = (int *) & a;
After: int *pa = (int *)&a;
We still don't understand all kinds of casts. I added a FIXME to
address that.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172056 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 739bcdd80f..51a0bd6488 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -980,6 +980,7 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) { verifyFormat("a * -b;"); verifyFormat("a * ++b;"); verifyFormat("a * --b;"); + verifyFormat("int *pa = (int *)&a;"); verifyFormat("InvalidRegions[*R] = 0;"); @@ -988,8 +989,8 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) { verifyFormat("A<int *, int *> a;"); verifyFormat("A<int **, int **> a;"); verifyFormat("Type *A = static_cast<Type *>(P);"); - verifyFormat("Type *A = (Type *) P;"); - verifyFormat("Type *A = (vector<Type *, int *>) P;"); + verifyFormat("Type *A = (Type *)P;"); + verifyFormat("Type *A = (vector<Type *, int *>)P;"); verifyFormat( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n" |