diff options
author | Haojian Wu <hokein@google.com> | 2017-07-12 16:38:59 +0000 |
---|---|---|
committer | Haojian Wu <hokein@google.com> | 2017-07-12 16:38:59 +0000 |
commit | a9a1b403bcabdd72c4fc7b80df05042c0ebd3b95 (patch) | |
tree | bc587b7aab0d9542289f6eda0ff8c9821dd24c26 /clang-tools-extra/test/clang-tidy/google-readability-casting.cpp | |
parent | 6f92d2dd24b03e26496bf59fea108ee16c18d28f (diff) | |
download | bcm5719-llvm-a9a1b403bcabdd72c4fc7b80df05042c0ebd3b95.tar.gz bcm5719-llvm-a9a1b403bcabdd72c4fc7b80df05042c0ebd3b95.zip |
[clang-tidy] Ignore blank spaces between cast's ")" and its sub expr.
Summary:
Before the change:
`auto i = (Enum) 5;` => `auto i = static_cast<Enum>( 5);`
After the change:
`auto i = (Enum) 5;` => `auto i = static_cast<Enum>(5);`
Reviewers: alexfh
Reviewed By: alexfh
Subscribers: JDevlieghere, xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D31700
llvm-svn: 307812
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/google-readability-casting.cpp')
-rw-r--r-- | clang-tools-extra/test/clang-tidy/google-readability-casting.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/google-readability-casting.cpp b/clang-tools-extra/test/clang-tidy/google-readability-casting.cpp index a4d29d6b28f..d36fef6fc94 100644 --- a/clang-tools-extra/test/clang-tidy/google-readability-casting.cpp +++ b/clang-tools-extra/test/clang-tidy/google-readability-casting.cpp @@ -85,6 +85,22 @@ void f(int a, double b, const char *cpc, const void *cpv, X *pX) { // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: {{.*}}; use static_cast/const_cast/reinterpret_cast [ // CHECK-FIXES: b1 = (const int&)b; + b1 = (int) b; + // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: {{.*}}; use static_cast {{.*}} + // CHECK-FIXES: b1 = static_cast<int>(b); + + b1 = (int) b; + // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: {{.*}}; use static_cast {{.*}} + // CHECK-FIXES: b1 = static_cast<int>(b); + + b1 = (int) (b); + // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: {{.*}}; use static_cast {{.*}} + // CHECK-FIXES: b1 = static_cast<int>(b); + + b1 = (int) (b); + // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: {{.*}}; use static_cast {{.*}} + // CHECK-FIXES: b1 = static_cast<int>(b); + Y *pB = (Y*)pX; // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: {{.*}}; use static_cast/const_cast/reinterpret_cast [ Y &rB = (Y&)*pX; @@ -114,6 +130,14 @@ void f(int a, double b, const char *cpc, const void *cpv, X *pX) { // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: redundant cast to the same type // CHECK-FIXES: {{^}} e = e; + e = (Enum) e; + // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: redundant cast to the same type + // CHECK-FIXES: {{^}} e = e; + + e = (Enum) (e); + // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: redundant cast to the same type + // CHECK-FIXES: {{^}} e = (e); + static const int kZero = 0; (int)kZero; // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: redundant cast to the same type |