[PATCH] D70200: Fix illegal cast from uint64_t to int64_t

Max Moroz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 07:30:48 PST 2019


Dor1s accepted this revision.
Dor1s added a comment.
This revision is now accepted and ready to land.

Ha, nice! LGTM. Is there any test you could easily update or add to reproduce this corner case?



================
Comment at: llvm/tools/llvm-cov/CoverageExporterJson.cpp:72
+  uint64_t int64_max = static_cast<uint64_t>(std::numeric_limits<int64_t>::max());
+  return u > int64_max ? int64_max : u;
+}
----------------
nit: can return `std::min(u, std::numeric_limits<int64_t>::max())`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70200





More information about the llvm-commits mailing list