[clang-tools-extra] [clang-tidy] fix false positive for implicit conversion of comparison result in C23 (PR #113639)

Julian Schmidt via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 27 06:42:33 PDT 2024


================
@@ -298,6 +300,11 @@ void ImplicitBoolConversionCheck::registerMatchers(MatchFinder *Finder) {
                          hasCastKind(CK_FloatingToBoolean),
                          hasCastKind(CK_PointerToBoolean),
                          hasCastKind(CK_MemberPointerToBoolean)),
+                   // Exclude cases of C23 comparison result.
+                   unless(allOf(
+                       isC23(),
+                       hasSourceExpression(binaryOperator(hasAnyOperatorName(
+                           ">", ">=", "==", "!=", "<", "<="))))),
----------------
5chmidti wrote:

nit: `ignoringParens(binaryOperator(...))`

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


More information about the cfe-commits mailing list