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

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 8 08:37:23 PDT 2023


================
@@ -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);
----------------
shafik wrote:

```suggestion
                                        E->getOperatorLoc(),  /*IsInitList=*/false, /*IsTopLevelExpr=*/true);
```

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


More information about the cfe-commits mailing list