[PATCH] D56983: [libunwind] Add casts to avoid warnings about implicit conversions losing precision

Louis Dionne via Phabricator reviews at reviews.llvm.org
Tue Jan 22 08:30:43 PST 2019


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

In D56983#1366437 <https://reviews.llvm.org/D56983#1366437>, @mstorsjo wrote:

> In D56983#1366300 <https://reviews.llvm.org/D56983#1366300>, @ldionne wrote:
>
> > I'm not really familiar with this code -- can you quickly explain why it's OK to lose precision here? Mostly for my education.
>
>
> The LocalAddressSpace class has got a `getRegister` method that returns `uint64_t`, while this method returns a variable sized to the actual size of registers on the current architecture. I.e. this fixes warnings on 32 bit architectures.


I guess my question could have been rephrased as: why doesn't `LocalAddressSpace::getRegister` return a `uint32_t` on 32 bit architectures, but that's not useful because you might just as well always return a 64 bit value, which is larger than needed in the worst case. I see why that's the right place to put this cast now.

LGTM.


Repository:
  rUNW libunwind

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

https://reviews.llvm.org/D56983





More information about the libcxx-commits mailing list