[clang] [sema] Improve -Wsign-compare (PR #65684)

via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 8 11:11:13 PDT 2023


=?utf-8?q?FĂ©lix?= Cloutier <fcloutier at apple.com>


================
@@ -14308,22 +14382,22 @@ static bool AnalyzeBitFieldAssignment(Sema &S, FieldDecl *Bitfield, Expr *Init,
 
 /// Analyze the given simple or compound assignment for warning-worthy
 /// operations.
-static void AnalyzeAssignment(Sema &S, BinaryOperator *E) {
+void ImplicitConversionChecker::AnalyzeAssignment(BinaryOperator *E) {
   // Just recurse on the LHS.
-  AnalyzeImplicitConversions(S, E->getLHS(), E->getOperatorLoc());
+  AnalyzeImplicitConversions(E->getLHS(), E->getOperatorLoc(), false, true);
 
   // We want to recurse on the RHS as normal unless we're assigning to
   // a bitfield.
   if (FieldDecl *Bitfield = E->getLHS()->getSourceBitField()) {
     if (AnalyzeBitFieldAssignment(S, Bitfield, E->getRHS(),
                                   E->getOperatorLoc())) {
       // Recurse, ignoring any implicit conversions on the RHS.
-      return AnalyzeImplicitConversions(S, E->getRHS()->IgnoreParenImpCasts(),
-                                        E->getOperatorLoc());
+      return AnalyzeImplicitConversions(E->getRHS()->IgnoreParenImpCasts(),
+                                        E->getOperatorLoc(), false, true);
     }
   }
 
-  AnalyzeImplicitConversions(S, E->getRHS(), E->getOperatorLoc());
+  AnalyzeImplicitConversions(E->getRHS(), E->getOperatorLoc(), false, true);
----------------
apple-fcloutier wrote:

Ugh, missed that one. Will address with the next batch of changes.

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


More information about the cfe-commits mailing list