[PATCH] D46535: Correct warning on Float->Integer conversions.
Erich Keane via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 7 13:31:45 PDT 2018
erichkeane marked 2 inline comments as done.
erichkeane added inline comments.
================
Comment at: lib/Sema/SemaChecking.cpp:9440-9441
+ diag::warn_impcast_literal_float_to_integer_out_of_range);
+ if (IntegerValue.isUnsigned() &&
+ (IntegerValue.isMaxValue() || IntegerValue.isMinValue()))
+ return DiagnoseImpCast(
----------------
aaron.ballman wrote:
> I think you can combine all of the predicates into:
> ```
> if (!IsBool && ((IntegerValue.isSigned() && (...) || (IntegerValue.isUnsigned() && (...))))
> return DiagnoseImpCast(S, E, T, CContext, diag::warn_impcast_literal_float_to_integer_out_of_range);
> ```
I'd waffled on whether to combine those ore not, since I was 50/50 and you have an opinion, combining it :)
Repository:
rC Clang
https://reviews.llvm.org/D46535
More information about the cfe-commits
mailing list