[lld] 2179930 - [lld-macho] Fix unwind info personality size

Jez Ng via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 26 15:57:34 PDT 2021


Author: Jez Ng
Date: 2021-08-26T18:52:06-04:00
New Revision: 2179930868f6166deccbf21f2f7565ec7666ff70

URL: https://github.com/llvm/llvm-project/commit/2179930868f6166deccbf21f2f7565ec7666ff70
DIFF: https://github.com/llvm/llvm-project/commit/2179930868f6166deccbf21f2f7565ec7666ff70.diff

LOG: [lld-macho] Fix unwind info personality size

This was missed by {D107035}. This fix addresses the following warning:

  loop variable 'personality' has type 'const uint32_t &' (aka 'const unsigned int &') but is initialized with type 'const unsigned long long' resulting in a copy [-Wrange-loop-analysis]

In addition to fixing the size, I also removed the const reference,
since there's no performance benefit to avoiding copies of integer-sized
values.

Added: 
    

Modified: 
    lld/MachO/UnwindInfoSection.cpp

Removed: 
    


################################################################################
diff  --git a/lld/MachO/UnwindInfoSection.cpp b/lld/MachO/UnwindInfoSection.cpp
index 5405be199cd7c..95a5f57ded43e 100644
--- a/lld/MachO/UnwindInfoSection.cpp
+++ b/lld/MachO/UnwindInfoSection.cpp
@@ -572,7 +572,7 @@ void UnwindInfoSectionImpl<Ptr>::writeTo(uint8_t *buf) const {
     *i32p++ = encoding.first;
 
   // Personalities
-  for (const uint32_t &personality : personalities)
+  for (Ptr personality : personalities)
     *i32p++ =
         in.got->addr + (personality - 1) * target->wordSize - in.header->addr;
 


        


More information about the llvm-commits mailing list