[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


================
@@ -14490,12 +14564,12 @@ static void DiagnoseFloatingImpCast(Sema &S, Expr *E, QualType T,
 
 /// Analyze the given compound assignment for the possible losing of
 /// floating-point precision.
-static void AnalyzeCompoundAssignment(Sema &S, BinaryOperator *E) {
+void ImplicitConversionChecker::AnalyzeCompoundAssignment(BinaryOperator *E) {
   assert(isa<CompoundAssignOperator>(E) &&
          "Must be compound assignment operation");
   // Recurse on the LHS and RHS in here
-  AnalyzeImplicitConversions(S, E->getLHS(), E->getOperatorLoc());
-  AnalyzeImplicitConversions(S, E->getRHS(), E->getOperatorLoc());
+  AnalyzeImplicitConversions(E->getLHS(), E->getOperatorLoc(), false, true);
+  AnalyzeImplicitConversions(E->getRHS(), E->getOperatorLoc(), false, true);
----------------
shafik wrote:

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

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


More information about the cfe-commits mailing list