@@ -124,14 +124,14 @@ writeAddressRanges(raw_svector_ostream &Stream,
124124 const DebugAddressRangesVector &AddressRanges,
125125 const bool WriteRelativeRanges = false ) {
126126 for (const DebugAddressRange &Range : AddressRanges) {
127- support::endian::write (Stream, Range.LowPC , support ::little);
127+ support::endian::write (Stream, Range.LowPC , llvm::endianness ::little);
128128 support::endian::write (
129129 Stream, WriteRelativeRanges ? Range.HighPC - Range.LowPC : Range.HighPC ,
130- support ::little);
130+ llvm::endianness ::little);
131131 }
132132 // Finish with 0 entries.
133- support::endian::write (Stream, 0ULL , support ::little);
134- support::endian::write (Stream, 0ULL , support ::little);
133+ support::endian::write (Stream, 0ULL , llvm::endianness ::little);
134+ support::endian::write (Stream, 0ULL , llvm::endianness ::little);
135135 return AddressRanges.size () * 16 + 16 ;
136136}
137137
@@ -209,13 +209,15 @@ getDWARF5Header(const LocListsRangelistsHeader &Header) {
209209 getDWARF5RngListLocListHeaderSize () - sizeof (UnitLengthType);
210210
211211 support::endian::write (*HeaderStream, Header.UnitLength + HeaderSize,
212- support::little);
213- support::endian::write (*HeaderStream, Header.Version , support::little);
214- support::endian::write (*HeaderStream, Header.AddressSize , support::little);
212+ llvm::endianness::little);
213+ support::endian::write (*HeaderStream, Header.Version ,
214+ llvm::endianness::little);
215+ support::endian::write (*HeaderStream, Header.AddressSize ,
216+ llvm::endianness::little);
215217 support::endian::write (*HeaderStream, Header.SegmentSelector ,
216- support ::little);
218+ llvm::endianness ::little);
217219 support::endian::write (*HeaderStream, Header.OffsetEntryCount ,
218- support ::little);
220+ llvm::endianness ::little);
219221 return HeaderBuffer;
220222}
221223
@@ -254,17 +256,18 @@ static bool emitWithBase(raw_ostream &OS, const DebugVector &Entries,
254256 }
255257
256258 support::endian::write (OS, static_cast <uint8_t >(BaseAddressx),
257- support ::little);
259+ llvm::endianness ::little);
258260 uint32_t BaseIndex = AddrWriter.getIndexFromAddress (Base, CU);
259261 encodeULEB128 (BaseIndex, OS);
260262 for (auto &OffsetEntry : Offsets) {
261263 support::endian::write (OS, static_cast <uint8_t >(OffsetPair),
262- support ::little);
264+ llvm::endianness ::little);
263265 encodeULEB128 (OffsetEntry.StartOffset , OS);
264266 encodeULEB128 (OffsetEntry.EndOffset , OS);
265267 Func (OffsetEntry.Index );
266268 }
267- support::endian::write (OS, static_cast <uint8_t >(EndOfList), support::little);
269+ support::endian::write (OS, static_cast <uint8_t >(EndOfList),
270+ llvm::endianness::little);
268271 return true ;
269272}
270273
@@ -291,7 +294,7 @@ DebugRangeListsSectionWriter::addRanges(DebugAddressRangesVector &Ranges) {
291294 const DebugAddressRange &Range = Ranges[I];
292295 support::endian::write (*CUBodyStream,
293296 static_cast <uint8_t >(dwarf::DW_RLE_startx_length),
294- support ::little);
297+ llvm::endianness ::little);
295298 uint32_t Index = AddrWriter->getIndexFromAddress (Range.LowPC , *CU);
296299 encodeULEB128 (Index, *CUBodyStream);
297300 encodeULEB128 (Range.HighPC - Range.LowPC , *CUBodyStream);
@@ -301,7 +304,7 @@ DebugRangeListsSectionWriter::addRanges(DebugAddressRangesVector &Ranges) {
301304 if (WrittenStartxLength)
302305 support::endian::write (*CUBodyStream,
303306 static_cast <uint8_t >(dwarf::DW_RLE_end_of_list),
304- support ::little);
307+ llvm::endianness ::little);
305308 CurrentOffset = CUBodyBuffer->size ();
306309 return RangeEntries.size () - 1 ;
307310}
@@ -315,7 +318,7 @@ void DebugRangeListsSectionWriter::finalizeSection() {
315318 const uint32_t SizeOfArraySection = RangeEntries.size () * SizeOfArrayEntry;
316319 for (uint32_t Offset : RangeEntries)
317320 support::endian::write (*CUArrayStream, Offset + SizeOfArraySection,
318- support ::little);
321+ llvm::endianness ::little);
319322
320323 std::unique_ptr<DebugBufferVector> Header = getDWARF5Header (
321324 {static_cast <uint32_t >(SizeOfArraySection + CUBodyBuffer.get ()->size ()),
@@ -359,17 +362,17 @@ void DebugARangesSectionWriter::writeARangesSection(
359362 uint32_t Size = 8 + 4 + 2 * sizeof (uint64_t ) * (AddressRanges.size () + 1 );
360363
361364 // Header field #1: set size.
362- support::endian::write (RangesStream, Size, support ::little);
365+ support::endian::write (RangesStream, Size, llvm::endianness ::little);
363366
364367 // Header field #2: version number, 2 as per the specification.
365368 support::endian::write (RangesStream, static_cast <uint16_t >(2 ),
366- support ::little);
369+ llvm::endianness ::little);
367370
368371 assert (CUMap.count (Offset) && " Original CU offset is not found in CU Map" );
369372 // Header field #3: debug info offset of the correspondent compile unit.
370373 support::endian::write (
371374 RangesStream, static_cast <uint32_t >(CUMap.find (Offset)->second .Offset ),
372- support ::little);
375+ llvm::endianness ::little);
373376
374377 // Header field #4: address size.
375378 // 8 since we only write ELF64 binaries for now.
@@ -380,7 +383,7 @@ void DebugARangesSectionWriter::writeARangesSection(
380383
381384 // Padding before address table - 4 bytes in the 64-bit-pointer case.
382385 support::endian::write (RangesStream, static_cast <uint32_t >(0 ),
383- support ::little);
386+ llvm::endianness ::little);
384387
385388 writeAddressRanges (RangesStream, AddressRanges, true );
386389 }
@@ -473,10 +476,10 @@ void DebugAddrWriter::update(DIEBuilder &DIEBlder, DWARFUnit &CU) {
473476 break ;
474477 case 4 :
475478 support::endian::write (*AddressStream, static_cast <uint32_t >(Address),
476- support ::little);
479+ llvm::endianness ::little);
477480 break ;
478481 case 8 :
479- support::endian::write (*AddressStream, Address, support ::little);
482+ support::endian::write (*AddressStream, Address, llvm::endianness ::little);
480483 break ;
481484 }
482485 };
@@ -492,11 +495,12 @@ void DebugAddrWriter::update(DIEBuilder &DIEBlder, DWARFUnit &CU) {
492495void DebugAddrWriterDwarf5::update (DIEBuilder &DIEBlder, DWARFUnit &CU) {
493496 // Need to layout all sections within .debug_addr
494497 // Within each section sort Address by index.
495- const endianness Endian =
496- BC->DwCtx ->isLittleEndian () ? support::little : support::big;
498+ const endianness Endian = BC->DwCtx ->isLittleEndian ()
499+ ? llvm::endianness::little
500+ : llvm::endianness::big;
497501 const DWARFSection &AddrSec = BC->DwCtx ->getDWARFObj ().getAddrSection ();
498502 DWARFDataExtractor AddrData (BC->DwCtx ->getDWARFObj (), AddrSec,
499- Endian == support ::little, 0 );
503+ Endian == llvm::endianness ::little, 0 );
500504 DWARFDebugAddrTable AddrTable;
501505 DIDumpOptions DumpOpts;
502506 constexpr uint32_t HeaderSize = 8 ;
@@ -594,11 +598,11 @@ void DebugLocWriter::addList(DIEBuilder &DIEBldr, DIE &Die, DIEValue &AttrInfo,
594598
595599 for (const DebugLocationEntry &Entry : LocList) {
596600 support::endian::write (*LocStream, static_cast <uint64_t >(Entry.LowPC ),
597- support ::little);
601+ llvm::endianness ::little);
598602 support::endian::write (*LocStream, static_cast <uint64_t >(Entry.HighPC ),
599- support ::little);
603+ llvm::endianness ::little);
600604 support::endian::write (*LocStream, static_cast <uint16_t >(Entry.Expr .size ()),
601- support ::little);
605+ llvm::endianness ::little);
602606 *LocStream << StringRef (reinterpret_cast <const char *>(Entry.Expr .data ()),
603607 Entry.Expr .size ());
604608 LocSectionOffset += 2 * 8 + 2 + Entry.Expr .size ();
@@ -618,15 +622,17 @@ std::unique_ptr<DebugBufferVector> DebugLocWriter::getBuffer() {
618622void DebugLocWriter::finalize (DIEBuilder &DIEBldr, DIE &Die) {}
619623
620624static void writeEmptyListDwarf5 (raw_svector_ostream &Stream) {
621- support::endian::write (Stream, static_cast <uint32_t >(4 ), support::little);
625+ support::endian::write (Stream, static_cast <uint32_t >(4 ),
626+ llvm::endianness::little);
622627 support::endian::write (Stream, static_cast <uint8_t >(dwarf::DW_LLE_start_end),
623- support ::little);
628+ llvm::endianness ::little);
624629
625630 const char Zeroes[16 ] = {0 };
626631 Stream << StringRef (Zeroes, 16 );
627632 encodeULEB128 (0 , Stream);
628- support::endian::write (
629- Stream, static_cast <uint8_t >(dwarf::DW_LLE_end_of_list), support::little);
633+ support::endian::write (Stream,
634+ static_cast <uint8_t >(dwarf::DW_LLE_end_of_list),
635+ llvm::endianness::little);
630636}
631637
632638static void writeLegacyLocList (DIEValue &AttrInfo,
@@ -645,21 +651,21 @@ static void writeLegacyLocList(DIEValue &AttrInfo,
645651 for (const DebugLocationEntry &Entry : LocList) {
646652 support::endian::write (LocStream,
647653 static_cast <uint8_t >(dwarf::DW_LLE_startx_length),
648- support ::little);
654+ llvm::endianness ::little);
649655 const uint32_t Index = AddrWriter.getIndexFromAddress (Entry.LowPC , CU);
650656 encodeULEB128 (Index, LocStream);
651657
652658 support::endian::write (LocStream,
653659 static_cast <uint32_t >(Entry.HighPC - Entry.LowPC ),
654- support ::little);
660+ llvm::endianness ::little);
655661 support::endian::write (LocStream, static_cast <uint16_t >(Entry.Expr .size ()),
656- support ::little);
662+ llvm::endianness ::little);
657663 LocStream << StringRef (reinterpret_cast <const char *>(Entry.Expr .data ()),
658664 Entry.Expr .size ());
659665 }
660666 support::endian::write (LocStream,
661667 static_cast <uint8_t >(dwarf::DW_LLE_end_of_list),
662- support ::little);
668+ llvm::endianness ::little);
663669 replaceLocValbyForm (DIEBldr, Die, AttrInfo, AttrInfo.getForm (), EntryOffset);
664670}
665671
@@ -701,7 +707,7 @@ static void writeDWARF5LocList(uint32_t &NumberOfEntries, DIEValue &AttrInfo,
701707 const DebugLocationEntry &Entry = LocList[I];
702708 support::endian::write (LocBodyStream,
703709 static_cast <uint8_t >(dwarf::DW_LLE_startx_length),
704- support ::little);
710+ llvm::endianness ::little);
705711 const uint32_t Index = AddrWriter.getIndexFromAddress (Entry.LowPC , CU);
706712 encodeULEB128 (Index, LocBodyStream);
707713 encodeULEB128 (Entry.HighPC - Entry.LowPC , LocBodyStream);
@@ -713,7 +719,7 @@ static void writeDWARF5LocList(uint32_t &NumberOfEntries, DIEValue &AttrInfo,
713719 if (WrittenStartxLength)
714720 support::endian::write (LocBodyStream,
715721 static_cast <uint8_t >(dwarf::DW_LLE_end_of_list),
716- support ::little);
722+ llvm::endianness ::little);
717723}
718724
719725void DebugLoclistWriter::addList (DIEBuilder &DIEBldr, DIE &Die,
@@ -753,7 +759,7 @@ void DebugLoclistWriter::finalizeDWARF5(DIEBuilder &DIEBldr, DIE &Die) {
753759 support::endian::write (
754760 *LocArrayStream,
755761 static_cast <uint32_t >(SizeOfArraySection + RelativeOffset),
756- support ::little);
762+ llvm::endianness ::little);
757763
758764 std::unique_ptr<DebugBufferVector> Header = getDWARF5Header (
759765 {static_cast <uint32_t >(SizeOfArraySection + LocBodyBuffer.get ()->size ()),
@@ -884,11 +890,11 @@ void DebugStrOffsetsWriter::finalizeSection(DWARFUnit &Unit,
884890 if (RetVal == ProcessedBaseOffsets.end () || StrOffsetSectionWasModified) {
885891 // Writing out the header for each section.
886892 support::endian::write (*StrOffsetsStream, CurrentSectionSize + 4 ,
887- support ::little);
893+ llvm::endianness ::little);
888894 support::endian::write (*StrOffsetsStream, static_cast <uint16_t >(5 ),
889- support ::little);
895+ llvm::endianness ::little);
890896 support::endian::write (*StrOffsetsStream, static_cast <uint16_t >(0 ),
891- support ::little);
897+ llvm::endianness ::little);
892898
893899 uint64_t BaseOffset = StrOffsetsBuffer->size ();
894900 ProcessedBaseOffsets[*Val] = BaseOffset;
@@ -897,7 +903,8 @@ void DebugStrOffsetsWriter::finalizeSection(DWARFUnit &Unit,
897903 StrListBaseAttrInfo.getForm (),
898904 DIEInteger (BaseOffset));
899905 for (const auto &Entry : IndexToAddressMap)
900- support::endian::write (*StrOffsetsStream, Entry.second , support::little);
906+ support::endian::write (*StrOffsetsStream, Entry.second ,
907+ llvm::endianness::little);
901908 } else {
902909 DIEBldr.replaceValue (&Die, dwarf::DW_AT_str_offsets_base,
903910 StrListBaseAttrInfo.getForm (),
0 commit comments