=?utf-8?q?Björn?= Svensson <bjorn.a.svens...@est.tech>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/149...@github.com>


================
@@ -75,16 +86,21 @@ void SignedCharMisuseCheck::registerMatchers(MatchFinder 
*Finder) {
   const auto UnSignedCharCastExpr =
       charCastExpression(false, IntegerType, "unsignedCastExpression");
 
-  // Catch assignments with signed char -> integer conversion.
+  // Catch assignments with signed char -> integer conversion. Ignore false
+  // positives on C23 enums with the fixed underlying type of signed char.
   const auto AssignmentOperatorExpr =
       expr(binaryOperator(hasOperatorName("="), hasLHS(hasType(IntegerType)),
-                          hasRHS(SignedCharCastExpr)));
+                          hasRHS(SignedCharCastExpr)),
+           unless(allOf(isC23Stmt(), binaryOperator(hasLHS(hasType(
+                                         hasCanonicalType(enumType())))))));
----------------
vbvictor wrote:

And new matchers `isC23` are obsolete

https://github.com/llvm/llvm-project/pull/149790
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to