[libunwind] r351877 - Add casts to avoid warnings about implicit conversions losing precision

Martin Storsjo via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 22 12:50:42 PST 2019


Author: mstorsjo
Date: Tue Jan 22 12:50:42 2019
New Revision: 351877

URL: http://llvm.org/viewvc/llvm-project?rev=351877&view=rev
Log:
Add casts to avoid warnings about implicit conversions losing precision

This fixes warnings like these:

DwarfInstructions.hpp:85:25: warning: implicit conversion
      loses integer precision: 'uint64_t' (aka 'unsigned long long') to
      'libunwind::DwarfInstructions<libunwind::LocalAddressSpace,
      libunwind::Registers_arm>::pint_t' (aka 'unsigned int')
      [-Wshorten-64-to-32]

DwarfInstructions.hpp:88:25: warning: implicit conversion
      loses integer precision: 'uint64_t' (aka 'unsigned long long') to
      'libunwind::DwarfInstructions<libunwind::LocalAddressSpace,
      libunwind::Registers_arm>::pint_t' (aka 'unsigned int')
      [-Wshorten-64-to-32]

Differential Revision: https://reviews.llvm.org/D56983

Modified:
    libunwind/trunk/src/DwarfInstructions.hpp

Modified: libunwind/trunk/src/DwarfInstructions.hpp
URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/DwarfInstructions.hpp?rev=351877&r1=351876&r2=351877&view=diff
==============================================================================
--- libunwind/trunk/src/DwarfInstructions.hpp (original)
+++ libunwind/trunk/src/DwarfInstructions.hpp Tue Jan 22 12:50:42 2019
@@ -81,12 +81,11 @@ typename A::pint_t DwarfInstructions<A,
     const RegisterLocation &savedReg) {
   switch (savedReg.location) {
   case CFI_Parser<A>::kRegisterInCFA:
-    return addressSpace.getRegister(cfa + (pint_t)savedReg.value);
+    return (pint_t)addressSpace.getRegister(cfa + (pint_t)savedReg.value);
 
   case CFI_Parser<A>::kRegisterAtExpression:
-    return addressSpace.getRegister(
-        evaluateExpression((pint_t)savedReg.value, addressSpace,
-                            registers, cfa));
+    return (pint_t)addressSpace.getRegister(evaluateExpression(
+        (pint_t)savedReg.value, addressSpace, registers, cfa));
 
   case CFI_Parser<A>::kRegisterIsExpression:
     return evaluateExpression((pint_t)savedReg.value, addressSpace,




More information about the cfe-commits mailing list