[llvm] af8eff4 - [DWARFLinkerParallel] Use llvm::endianness::native (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 5 21:21:42 PDT 2023


Author: Kazu Hirata
Date: 2023-10-05T21:21:36-07:00
New Revision: af8eff41dfc79eaf9ae9594c52b1e996ca59a911

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

LOG: [DWARFLinkerParallel] Use llvm::endianness::native (NFC)

Added: 
    

Modified: 
    llvm/lib/DWARFLinkerParallel/DWARFLinkerCompileUnit.cpp
    llvm/lib/DWARFLinkerParallel/OutputSections.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DWARFLinkerParallel/DWARFLinkerCompileUnit.cpp b/llvm/lib/DWARFLinkerParallel/DWARFLinkerCompileUnit.cpp
index f66dfbf217b3894..96017bac31342aa 100644
--- a/llvm/lib/DWARFLinkerParallel/DWARFLinkerCompileUnit.cpp
+++ b/llvm/lib/DWARFLinkerParallel/DWARFLinkerCompileUnit.cpp
@@ -1090,8 +1090,7 @@ void CompileUnit::cloneDieAttrExpression(
         OutputExpression.push_back(dwarf::DW_OP_addr);
         uint64_t LinkedAddress =
             SA->Address + (VarAddressAdjustment ? *VarAddressAdjustment : 0);
-        if ((getEndianness() == support::endianness::little) !=
-            sys::IsLittleEndianHost)
+        if (getEndianness() != llvm::endianness::native)
           sys::swapByteOrder(LinkedAddress);
         ArrayRef<uint8_t> AddressBytes(
             reinterpret_cast<const uint8_t *>(&LinkedAddress),
@@ -1128,8 +1127,7 @@ void CompileUnit::cloneDieAttrExpression(
           OutputExpression.push_back(*OutOperandKind);
           uint64_t LinkedAddress =
               SA->Address + (VarAddressAdjustment ? *VarAddressAdjustment : 0);
-          if ((getEndianness() == support::endianness::little) !=
-              sys::IsLittleEndianHost)
+          if (getEndianness() != llvm::endianness::native)
             sys::swapByteOrder(LinkedAddress);
           ArrayRef<uint8_t> AddressBytes(
               reinterpret_cast<const uint8_t *>(&LinkedAddress),

diff  --git a/llvm/lib/DWARFLinkerParallel/OutputSections.cpp b/llvm/lib/DWARFLinkerParallel/OutputSections.cpp
index 9c711f4b6bdcdef..8e7caa7bb407425 100644
--- a/llvm/lib/DWARFLinkerParallel/OutputSections.cpp
+++ b/llvm/lib/DWARFLinkerParallel/OutputSections.cpp
@@ -151,18 +151,18 @@ void SectionDescriptor::emitIntVal(uint64_t Val, unsigned Size) {
   } break;
   case 2: {
     uint16_t ShortVal = static_cast<uint16_t>(Val);
-    if ((Endianess == support::endianness::little) != sys::IsLittleEndianHost)
+    if (Endianess != llvm::endianness::native)
       sys::swapByteOrder(ShortVal);
     OS.write(reinterpret_cast<const char *>(&ShortVal), Size);
   } break;
   case 4: {
     uint32_t ShortVal = static_cast<uint32_t>(Val);
-    if ((Endianess == support::endianness::little) != sys::IsLittleEndianHost)
+    if (Endianess != llvm::endianness::native)
       sys::swapByteOrder(ShortVal);
     OS.write(reinterpret_cast<const char *>(&ShortVal), Size);
   } break;
   case 8: {
-    if ((Endianess == support::endianness::little) != sys::IsLittleEndianHost)
+    if (Endianess != llvm::endianness::native)
       sys::swapByteOrder(Val);
     OS.write(reinterpret_cast<const char *>(&Val), Size);
   } break;


        


More information about the llvm-commits mailing list