xgupta added a comment.

In D155457#4523388 <https://reviews.llvm.org/D155457#4523388>, @cor3ntin wrote:

> I'm not sure I understand the motivation for this change. Sure, people do 
> that but they also might do the same thing for ssize_t, intmax_t, or to 
> compare int to int32_t.
> I think a better heuristic would be to not emit a warning for any integral 
> (and floating point?) type that have the same canonical types (but we 
> probably still want one if their non-canonical type if the same)

I am not sure but are you expecting these changes -

  // Don't warn if the comparison involves integral or floating-point types 
with the same canonical types.
  QualType LHSCanonical = Constant->getType().getCanonicalType();
  QualType RHSCanonical = Other->getType().getCanonicalType();
  if ((LHSCanonical->isIntegralOrEnumerationType() || 
LHSCanonical->isFloatingType()) &&
      S.Context.hasSameType(LHSCanonical, RHSCanonical)) {
    return false;
  }

This will silence a lot of warnings and a total 5 test case fails.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155457

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to