[PATCH] D141515: [libunwind] Fixed an upcoming clang -Wsign-conversion warning

Fahad Nayyar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 11 09:05:50 PST 2023


fahadnayyar created this revision.
Herald added projects: libunwind, All.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libunwind.
fahadnayyar requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Fixing an upcoming clang warning (from https://reviews.llvm.org/D139114) in libunwind.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141515

Files:
  libunwind/src/AddressSpace.hpp


Index: libunwind/src/AddressSpace.hpp
===================================================================
--- libunwind/src/AddressSpace.hpp
+++ libunwind/src/AddressSpace.hpp
@@ -246,7 +246,7 @@
 inline int64_t LocalAddressSpace::getSLEB128(pint_t &addr, pint_t end) {
   const uint8_t *p = (uint8_t *)addr;
   const uint8_t *pend = (uint8_t *)end;
-  int64_t result = 0;
+  uint64_t result = 0;
   int bit = 0;
   uint8_t byte;
   do {
@@ -260,7 +260,7 @@
   if ((byte & 0x40) != 0 && bit < 64)
     result |= (-1ULL) << bit;
   addr = (pint_t) p;
-  return result;
+  return (uint64_t) result;
 }
 
 inline LocalAddressSpace::pint_t


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141515.488251.patch
Type: text/x-patch
Size: 636 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230111/fdb3e927/attachment.bin>


More information about the llvm-commits mailing list