diff options
| author | Daniel Jasper <djasper@google.com> | 2013-07-15 15:04:42 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2013-07-15 15:04:42 +0000 |
| commit | 49a9448d957ece632a619d91221c82516233b75b (patch) | |
| tree | ca5041663a426ec2de95c09a1474cb13a526e7b4 /clang/unittests/Format/FormatTest.cpp | |
| parent | f20d2672e2eb95c21f46b4a18446b4a40dddc092 (diff) | |
| download | bcm5719-llvm-49a9448d957ece632a619d91221c82516233b75b.tar.gz bcm5719-llvm-49a9448d957ece632a619d91221c82516233b75b.zip | |
clang-format: Improve c-style cast detection.
Before:
#define x ((int) - 1)
#define p(q) ((int *) & q)
After:
#define x ((int)-1)
#define p(q) ((int *)&q)
llvm-svn: 186324
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 01dd38e3c30..c8827c8dec6 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -3565,6 +3565,8 @@ TEST_F(FormatTest, FormatsCasts) { verifyFormat("my_int a = (my_int)2.0f;"); verifyFormat("my_int a = (my_int)sizeof(int);"); verifyFormat("return (my_int)aaa;"); + verifyFormat("#define x ((int)-1)"); + verifyFormat("#define p(q) ((int *)&q)"); // FIXME: Without type knowledge, this can still fall apart miserably. verifyFormat("void f() { my_int a = (my_int) * b; }"); |

