[PATCH] D144011: [clang]Fix warning for signed conversion

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 14 11:08:01 PST 2023


MaskRay added a comment.

I think it makes sense for `-Wsign-conversion` to not warn for this case. I do not know whether we need another diagnostic like `-Wshorten-64-to-32` for this case, but am inclined to no.

`-m32` doesn't emit a warning. I wonder whether the newly added condition can be merged with the following condition:

  if ((!isa<EnumType>(Target) || !isa<EnumType>(Source)) &&
      ((TargetRange.NonNegative && !LikelySourceRange.NonNegative) ||
       (!TargetRange.NonNegative && LikelySourceRange.NonNegative &&
        LikelySourceRange.Width == TargetRange.Width))) {
    if (S.SourceMgr.isInSystemMacro(CC))


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

https://reviews.llvm.org/D144011



More information about the cfe-commits mailing list