[clang-tools-extra] [clang-tidy] Exclude bitwise operators in bugprone-non-zero-enum-to-bool-conversion (PR #65498)

Congcong Cai via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 7 07:40:16 PDT 2023


================
@@ -49,6 +49,9 @@ bool NonZeroEnumToBoolConversionCheck::isLanguageVersionSupported(
 }
 
 void NonZeroEnumToBoolConversionCheck::registerMatchers(MatchFinder *Finder) {
+  auto ExcludedOperators = binaryOperation(hasAnyOperatorName(
+      "|", "&", "^", "<<", ">>", "~", "|=", "&=", "^=", "<<=", ">>="));
----------------
HerrCai0907 wrote:

> If you want, then yes, I can reduce this back to overload operators calls only.

I think current implement it fine, but maybe add some comment here to clarify why you want to exclude those operators. Because actually it's for the operator overloading instead of explicit operator.

https://github.com/llvm/llvm-project/pull/65498


More information about the cfe-commits mailing list