diff options
author | Jonas Toth <jonas.toth@gmail.com> | 2018-04-11 09:53:08 +0000 |
---|---|---|
committer | Jonas Toth <jonas.toth@gmail.com> | 2018-04-11 09:53:08 +0000 |
commit | 78ae36a38efc636a15591487f529230fa94ef1a4 (patch) | |
tree | 6fffdb00c47b763fae619c21eae1f6e744cb40d5 /clang-tidy/hicpp | |
parent | 0b5a0d7c2d8cc61f30405214f300e933639d0adc (diff) |
[clang-tidy] add missing assignment operations in hicpp-signed-bitwise
This patch resolves the bug https://bugs.llvm.org/show_bug.cgi?id=36963.
- implement missing assignment operators for hicpp-signed-bitwise
- mention fix in release notes
Reviewers:
aaron.ballman, hokein, alexfh
Differential: https://reviews.llvm.org/D45414
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@329789 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'clang-tidy/hicpp')
-rw-r--r-- | clang-tidy/hicpp/SignedBitwiseCheck.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/clang-tidy/hicpp/SignedBitwiseCheck.cpp b/clang-tidy/hicpp/SignedBitwiseCheck.cpp index 887c0bee..03900527 100644 --- a/clang-tidy/hicpp/SignedBitwiseCheck.cpp +++ b/clang-tidy/hicpp/SignedBitwiseCheck.cpp @@ -36,7 +36,8 @@ void SignedBitwiseCheck::registerMatchers(MatchFinder *Finder) { Finder->addMatcher( binaryOperator( allOf(anyOf(hasOperatorName("^"), hasOperatorName("|"), - hasOperatorName("&")), + hasOperatorName("&"), hasOperatorName("^="), + hasOperatorName("|="), hasOperatorName("&=")), unless(allOf(hasLHS(IsStdBitmask), hasRHS(IsStdBitmask))), @@ -48,10 +49,11 @@ void SignedBitwiseCheck::registerMatchers(MatchFinder *Finder) { // Shifting and complement is not allowed for any signed integer type because // the sign bit may corrupt the result. Finder->addMatcher( - binaryOperator(allOf(anyOf(hasOperatorName("<<"), hasOperatorName(">>")), - hasEitherOperand(SignedIntegerOperand), - hasLHS(hasType(isInteger())), - hasRHS(hasType(isInteger())))) + binaryOperator( + allOf(anyOf(hasOperatorName("<<"), hasOperatorName(">>"), + hasOperatorName("<<="), hasOperatorName(">>=")), + hasEitherOperand(SignedIntegerOperand), + hasLHS(hasType(isInteger())), hasRHS(hasType(isInteger())))) .bind("binary-sign-interference"), this); @@ -84,10 +86,8 @@ void SignedBitwiseCheck::check(const MatchFinder::MatchResult &Result) { else llvm_unreachable("unexpected matcher result"); } - - diag(Location, - "use of a signed integer operand with a %select{binary|unary}0 bitwise " - "operator") + diag(Location, "use of a signed integer operand with a " + "%select{binary|unary}0 bitwise operator") << IsUnary << SignedOperand->getSourceRange(); } |