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

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 15 09:18:09 PST 2023


yaxunl added a comment.

In D144011#4126853 <https://reviews.llvm.org/D144011#4126853>, @MaskRay wrote:

> I think it makes sense for `-Wsign-conversion` to not warn for this LP64 case, like we don't emit a warning for `-m32`. I do not know whether we need another diagnostic like `-Wshorten-64-to-32` for this case, but am inclined to no.
>
> 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))

Yes. Will do.


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

https://reviews.llvm.org/D144011



More information about the cfe-commits mailing list