[libcxx-commits] [PATCH] D139114: [Clang][Sema] Enabled implicit conversion warning for CompoundAssignment operator.

Fahad Nayyar via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jan 6 10:55:33 PST 2023


fahadnayyar added inline comments.


================
Comment at: clang/lib/Sema/SemaChecking.cpp:13402
+  // intergral operands.
+  if (E->getLHS()->getType()->isIntegerType() &&
+      E->getRHS()->getType()->isIntegerType() && !E->isShiftAssignOp())
----------------
arichardson wrote:
> Why is this restricted to integers? It looks like `CheckImplicitConversion` also handles other types? Does calling it unconditionally cause any issues?
@arichardson since `AnalyzeCompoundAssignment` already does some custom checks for certain data types like floats, I added the change only for integers as I am trying to fix the behaviour only for integral operands in this patch. Otherwise we see more than one (required) warning for floats operands and also for shift assign operator.

This patch targets only integral changes like test 3-5 in `conversion-64-32.c`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139114/new/

https://reviews.llvm.org/D139114



More information about the libcxx-commits mailing list