diff --git a/clang/lib/APINotes/APINotesWriter.cpp b/clang/lib/APINotes/APINotesWriter.cpp index a92b379a8e56a..770d78e22050c 100644 --- a/clang/lib/APINotes/APINotesWriter.cpp +++ b/clang/lib/APINotes/APINotesWriter.cpp @@ -294,7 +294,7 @@ class IdentifierTableInfo { uint32_t KeyLength = Key.size(); uint32_t DataLength = sizeof(uint32_t); - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); writer.write(KeyLength); writer.write(DataLength); return {KeyLength, DataLength}; @@ -303,7 +303,7 @@ class IdentifierTableInfo { void EmitKey(raw_ostream &OS, key_type_ref Key, unsigned) { OS << Key; } void EmitData(raw_ostream &OS, key_type_ref, data_type_ref Data, unsigned) { - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); writer.write(Data); } }; @@ -326,7 +326,7 @@ void APINotesWriter::Implementation::writeIdentifierBlock( llvm::raw_svector_ostream BlobStream(HashTableBlob); // Make sure that no bucket is at offset 0 llvm::support::endian::write(BlobStream, 0, - llvm::support::little); + llvm::endianness::little); Offset = Generator.Emit(BlobStream); } @@ -354,21 +354,21 @@ class ObjCContextIDTableInfo { uint32_t KeyLength = sizeof(uint32_t) + sizeof(uint8_t) + sizeof(uint32_t); uint32_t DataLength = sizeof(uint32_t); - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); writer.write(KeyLength); writer.write(DataLength); return {KeyLength, DataLength}; } void EmitKey(raw_ostream &OS, key_type_ref Key, unsigned) { - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); writer.write(Key.parentContextID); writer.write(Key.contextKind); writer.write(Key.contextID); } void EmitData(raw_ostream &OS, key_type_ref, data_type_ref Data, unsigned) { - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); writer.write(Data); } }; @@ -406,7 +406,7 @@ unsigned getVersionedInfoSize( /// Emit a serialized representation of a version tuple. void emitVersionTuple(raw_ostream &OS, const VersionTuple &VT) { - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); // First byte contains the number of components beyond the 'major' component. uint8_t descriptor; @@ -445,7 +445,7 @@ void emitVersionedInfo( return LHS.first < RHS.first; }); - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); writer.write(VI.size()); for (const auto &E : VI) { emitVersionTuple(OS, E.first); @@ -479,7 +479,7 @@ class VersionedTableInfo { return asDerived().getUnversionedInfoSize(UI); }); - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); writer.write(KeyLength); writer.write(DataLength); return {KeyLength, DataLength}; @@ -495,7 +495,7 @@ class VersionedTableInfo { /// Emit a serialized representation of the common entity information. void emitCommonEntityInfo(raw_ostream &OS, const CommonEntityInfo &CEI) { - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); uint8_t payload = 0; if (auto swiftPrivate = CEI.isSwiftPrivate()) { @@ -535,7 +535,7 @@ unsigned getCommonTypeInfoSize(const CommonTypeInfo &CTI) { void emitCommonTypeInfo(raw_ostream &OS, const CommonTypeInfo &CTI) { emitCommonEntityInfo(OS, CTI); - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); if (auto swiftBridge = CTI.getSwiftBridge()) { writer.write(swiftBridge->size() + 1); OS.write(swiftBridge->c_str(), swiftBridge->size()); @@ -558,7 +558,7 @@ class ObjCContextInfoTableInfo unsigned getKeyLength(key_type_ref) { return sizeof(uint32_t); } void EmitKey(raw_ostream &OS, key_type_ref Key, unsigned) { - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); writer.write(Key); } @@ -607,7 +607,7 @@ void APINotesWriter::Implementation::writeObjCContextBlock( llvm::raw_svector_ostream BlobStream(HashTableBlob); // Make sure that no bucket is at offset 0 llvm::support::endian::write(BlobStream, 0, - llvm::support::little); + llvm::endianness::little); Offset = Generator.Emit(BlobStream); } @@ -626,7 +626,7 @@ void APINotesWriter::Implementation::writeObjCContextBlock( llvm::raw_svector_ostream BlobStream(HashTableBlob); // Make sure that no bucket is at offset 0 llvm::support::endian::write(BlobStream, 0, - llvm::support::little); + llvm::endianness::little); Offset = Generator.Emit(BlobStream); } @@ -656,7 +656,7 @@ void emitVariableInfo(raw_ostream &OS, const VariableInfo &VI) { OS.write(reinterpret_cast(bytes), 2); - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); writer.write(VI.getType().size()); OS.write(VI.getType().data(), VI.getType().size()); } @@ -672,7 +672,7 @@ class ObjCPropertyTableInfo } void EmitKey(raw_ostream &OS, key_type_ref Key, unsigned) { - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); writer.write(std::get<0>(Key)); writer.write(std::get<1>(Key)); writer.write(std::get<2>(Key)); @@ -717,7 +717,7 @@ void APINotesWriter::Implementation::writeObjCPropertyBlock( llvm::raw_svector_ostream BlobStream(HashTableBlob); // Make sure that no bucket is at offset 0 llvm::support::endian::write(BlobStream, 0, - llvm::support::little); + llvm::endianness::little); Offset = Generator.Emit(BlobStream); } @@ -741,7 +741,7 @@ class ObjCMethodTableInfo } void EmitKey(raw_ostream &OS, key_type_ref Key, unsigned) { - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); writer.write(std::get<0>(Key)); writer.write(std::get<1>(Key)); writer.write(std::get<2>(Key)); @@ -757,7 +757,7 @@ class ObjCMethodTableInfo void emitUnversionedInfo(raw_ostream &OS, const ObjCMethodInfo &OMI) { uint8_t flags = 0; - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); flags = (flags << 1) | OMI.DesignatedInit; flags = (flags << 1) | OMI.RequiredInit; writer.write(flags); @@ -785,7 +785,7 @@ void APINotesWriter::Implementation::writeObjCMethodBlock( llvm::raw_svector_ostream BlobStream(HashTableBlob); // Make sure that no bucket is at offset 0 llvm::support::endian::write(BlobStream, 0, - llvm::support::little); + llvm::endianness::little); Offset = Generator.Emit(BlobStream); } @@ -815,21 +815,21 @@ class ObjCSelectorTableInfo { sizeof(uint16_t) + sizeof(uint32_t) * Key.Identifiers.size(); uint32_t DataLength = sizeof(uint32_t); - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); writer.write(KeyLength); writer.write(DataLength); return {KeyLength, DataLength}; } void EmitKey(raw_ostream &OS, key_type_ref Key, unsigned) { - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); writer.write(Key.NumPieces); for (auto Identifier : Key.Identifiers) writer.write(Identifier); } void EmitData(raw_ostream &OS, key_type_ref, data_type_ref Data, unsigned) { - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); writer.write(Data); } }; @@ -853,7 +853,7 @@ void APINotesWriter::Implementation::writeObjCSelectorBlock( llvm::raw_svector_ostream BlobStream(HashTableBlob); // Make sure that no bucket is at offset 0 llvm::support::endian::write(BlobStream, 0, - llvm::support::little); + llvm::endianness::little); Offset = Generator.Emit(BlobStream); } @@ -873,7 +873,7 @@ class GlobalVariableTableInfo } void EmitKey(raw_ostream &OS, key_type_ref Key, unsigned) { - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); writer.write(Key.parentContextID); writer.write(Key.contextKind); writer.write(Key.contextID); @@ -911,7 +911,7 @@ void APINotesWriter::Implementation::writeGlobalVariableBlock( llvm::raw_svector_ostream BlobStream(HashTableBlob); // Make sure that no bucket is at offset 0 llvm::support::endian::write(BlobStream, 0, - llvm::support::little); + llvm::endianness::little); Offset = Generator.Emit(BlobStream); } @@ -938,7 +938,7 @@ void emitParamInfo(raw_ostream &OS, const ParamInfo &PI) { if (auto RCC = PI.getRetainCountConvention()) flags |= static_cast(RCC.value()) + 1; - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); writer.write(flags); } @@ -963,7 +963,7 @@ void emitFunctionInfo(raw_ostream &OS, const FunctionInfo &FI) { if (auto RCC = FI.getRetainCountConvention()) flags |= static_cast(RCC.value()) + 1; - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); writer.write(flags); writer.write(FI.NumAdjustedNullable); @@ -987,7 +987,7 @@ class GlobalFunctionTableInfo } void EmitKey(raw_ostream &OS, key_type_ref Key, unsigned) { - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); writer.write(Key.parentContextID); writer.write(Key.contextKind); writer.write(Key.contextID); @@ -1025,7 +1025,7 @@ void APINotesWriter::Implementation::writeGlobalFunctionBlock( llvm::raw_svector_ostream BlobStream(HashTableBlob); // Make sure that no bucket is at offset 0 llvm::support::endian::write(BlobStream, 0, - llvm::support::little); + llvm::endianness::little); Offset = Generator.Emit(BlobStream); } @@ -1043,7 +1043,7 @@ class EnumConstantTableInfo unsigned getKeyLength(key_type_ref) { return sizeof(uint32_t); } void EmitKey(raw_ostream &OS, key_type_ref Key, unsigned) { - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); writer.write(Key); } @@ -1079,7 +1079,7 @@ void APINotesWriter::Implementation::writeEnumConstantBlock( llvm::raw_svector_ostream BlobStream(HashTableBlob); // Make sure that no bucket is at offset 0 llvm::support::endian::write(BlobStream, 0, - llvm::support::little); + llvm::endianness::little); Offset = Generator.Emit(BlobStream); } @@ -1101,7 +1101,7 @@ class CommonTypeTableInfo } void EmitKey(raw_ostream &OS, key_type_ref Key, unsigned) { - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); writer.write(Key.parentContextID); writer.write(Key.contextKind); writer.write(Key.contextID); @@ -1131,7 +1131,7 @@ class TagTableInfo : public CommonTypeTableInfo { } void emitUnversionedInfo(raw_ostream &OS, const TagInfo &TI) { - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); uint8_t Flags = 0; if (auto extensibility = TI.EnumExtensibility) { @@ -1187,7 +1187,7 @@ void APINotesWriter::Implementation::writeTagBlock( llvm::raw_svector_ostream BlobStream(HashTableBlob); // Make sure that no bucket is at offset 0 llvm::support::endian::write(BlobStream, 0, - llvm::support::little); + llvm::endianness::little); Offset = Generator.Emit(BlobStream); } @@ -1206,7 +1206,7 @@ class TypedefTableInfo } void emitUnversionedInfo(raw_ostream &OS, const TypedefInfo &TI) { - llvm::support::endian::Writer writer(OS, llvm::support::little); + llvm::support::endian::Writer writer(OS, llvm::endianness::little); uint8_t Flags = 0; if (auto swiftWrapper = TI.SwiftWrapper) @@ -1237,7 +1237,7 @@ void APINotesWriter::Implementation::writeTypedefBlock( llvm::raw_svector_ostream BlobStream(HashTableBlob); // Make sure that no bucket is at offset 0 llvm::support::endian::write(BlobStream, 0, - llvm::support::little); + llvm::endianness::little); Offset = Generator.Emit(BlobStream); } diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index 4ce89267e03f4..c44ecacb3de3a 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/lib/Basic/SourceManager.cpp @@ -1219,7 +1219,7 @@ LineOffsetMapping LineOffsetMapping::get(llvm::MemoryBufferRef Buffer, // This is much faster than scanning each byte independently. if ((unsigned long)(End - Start) > sizeof(Word)) { do { - Word = llvm::support::endian::read64(Buf, llvm::support::little); + Word = llvm::support::endian::read64(Buf, llvm::endianness::little); // no new line => jump over sizeof(Word) bytes. auto Mask = likelyhasbetween(Word, '\n', '\r'); if (!Mask) { diff --git a/clang/lib/Driver/OffloadBundler.cpp b/clang/lib/Driver/OffloadBundler.cpp index 0ad9de299603b..a7bc15e87ef67 100644 --- a/clang/lib/Driver/OffloadBundler.cpp +++ b/clang/lib/Driver/OffloadBundler.cpp @@ -324,7 +324,7 @@ static uint64_t Read8byteIntegerFromBuffer(StringRef Buffer, size_t pos) { /// Write 8-byte integers to a buffer in little-endian format. static void Write8byteIntegerToBuffer(raw_ostream &OS, uint64_t Val) { - llvm::support::endian::write(OS, Val, llvm::support::little); + llvm::support::endian::write(OS, Val, llvm::endianness::little); } class BinaryFileHandler final : public FileHandler { diff --git a/lld/ELF/DWARF.h b/lld/ELF/DWARF.h index 9a7993903d866..e1688fef9c9e4 100644 --- a/lld/ELF/DWARF.h +++ b/lld/ELF/DWARF.h @@ -73,7 +73,7 @@ template class LLDDwarfObj final : public llvm::DWARFObject { StringRef getLineStrSection() const override { return lineStrSection; } bool isLittleEndian() const override { - return ELFT::TargetEndianness == llvm::support::little; + return ELFT::TargetEndianness == llvm::endianness::little; } std::optional find(const llvm::DWARFSection &sec, diff --git a/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp b/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp index a3b91fc37dac7..f0832dbf07347 100644 --- a/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp +++ b/lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp @@ -179,7 +179,7 @@ ObjectFilePDB::loadPDBFile(std::string PdbPath, llvm::StringRef Path = Buffer->getBufferIdentifier(); auto Stream = std::make_unique( - std::move(Buffer), llvm::support::little); + std::move(Buffer), llvm::endianness::little); auto File = std::make_unique(Path, std::move(Stream), Allocator); if (auto EC = File->parseFileHeaders()) { diff --git a/llvm/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h b/llvm/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h index 108abb291498e..9461af8a48fc2 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h +++ b/llvm/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h @@ -24,7 +24,7 @@ class SymbolVisitorDelegate; class SymbolDeserializer : public SymbolVisitorCallbacks { struct MappingInfo { MappingInfo(ArrayRef RecordData, CodeViewContainer Container) - : Stream(RecordData, llvm::support::little), Reader(Stream), + : Stream(RecordData, llvm::endianness::little), Reader(Stream), Mapping(Reader, Container) {} BinaryByteStream Stream; diff --git a/llvm/include/llvm/DebugInfo/CodeView/TypeDeserializer.h b/llvm/include/llvm/DebugInfo/CodeView/TypeDeserializer.h index 2b17f5ccb13b0..acea4e341cb73 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/TypeDeserializer.h +++ b/llvm/include/llvm/DebugInfo/CodeView/TypeDeserializer.h @@ -28,7 +28,7 @@ namespace codeview { class TypeDeserializer : public TypeVisitorCallbacks { struct MappingInfo { explicit MappingInfo(ArrayRef RecordData) - : Stream(RecordData, llvm::support::little), Reader(Stream), + : Stream(RecordData, llvm::endianness::little), Reader(Stream), Mapping(Reader) {} BinaryByteStream Stream; diff --git a/llvm/include/llvm/Support/BinaryByteStream.h b/llvm/include/llvm/Support/BinaryByteStream.h index d313994fd5b43..ed1a0b229713a 100644 --- a/llvm/include/llvm/Support/BinaryByteStream.h +++ b/llvm/include/llvm/Support/BinaryByteStream.h @@ -133,7 +133,7 @@ class MutableBinaryByteStream : public WritableBinaryStream { /// causing the underlying data to grow. This class owns the underlying data. class AppendingBinaryByteStream : public WritableBinaryStream { std::vector Data; - llvm::endianness Endian = llvm::support::little; + llvm::endianness Endian = llvm::endianness::little; public: AppendingBinaryByteStream() = default; diff --git a/llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp b/llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp index 689c643a7006c..3cafa3a93a0d2 100644 --- a/llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp +++ b/llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp @@ -185,7 +185,7 @@ Error CVTypeVisitor::visitFieldListMemberStream(BinaryStreamReader &Reader) { struct FieldListVisitHelper { FieldListVisitHelper(TypeVisitorCallbacks &Callbacks, ArrayRef Data, VisitorDataSource Source) - : Stream(Data, llvm::support::little), Reader(Stream), + : Stream(Data, llvm::endianness::little), Reader(Stream), Deserializer(Reader), Visitor((Source == VDS_BytesPresent) ? Pipeline : Callbacks) { if (Source == VDS_BytesPresent) { diff --git a/llvm/lib/DebugInfo/CodeView/RecordName.cpp b/llvm/lib/DebugInfo/CodeView/RecordName.cpp index 5fbbc4a5d4977..e06b036ede63a 100644 --- a/llvm/lib/DebugInfo/CodeView/RecordName.cpp +++ b/llvm/lib/DebugInfo/CodeView/RecordName.cpp @@ -324,7 +324,7 @@ StringRef llvm::codeview::getSymbolName(CVSymbol Sym) { if (Sym.kind() == SymbolKind::S_CONSTANT) { // S_CONSTANT is preceded by an APSInt, which has a variable length. So we // have to do a full deserialization. - BinaryStreamReader Reader(Sym.content(), llvm::support::little); + BinaryStreamReader Reader(Sym.content(), llvm::endianness::little); // The container doesn't matter for single records. SymbolRecordMapping Mapping(Reader, CodeViewContainer::ObjectFile); ConstantSym Const(SymbolKind::S_CONSTANT); diff --git a/llvm/lib/DebugInfo/CodeView/RecordSerialization.cpp b/llvm/lib/DebugInfo/CodeView/RecordSerialization.cpp index d76905df8681f..032704478ffe8 100644 --- a/llvm/lib/DebugInfo/CodeView/RecordSerialization.cpp +++ b/llvm/lib/DebugInfo/CodeView/RecordSerialization.cpp @@ -103,7 +103,7 @@ Error llvm::codeview::consume(BinaryStreamReader &Reader, APSInt &Num) { Error llvm::codeview::consume(StringRef &Data, APSInt &Num) { ArrayRef Bytes(Data.bytes_begin(), Data.bytes_end()); - BinaryByteStream S(Bytes, llvm::support::little); + BinaryByteStream S(Bytes, llvm::endianness::little); BinaryStreamReader SR(S); auto EC = consume(SR, Num); Data = Data.take_back(SR.bytesRemaining()); @@ -129,7 +129,7 @@ Error llvm::codeview::consume(BinaryStreamReader &Reader, uint32_t &Item) { Error llvm::codeview::consume(StringRef &Data, uint32_t &Item) { ArrayRef Bytes(Data.bytes_begin(), Data.bytes_end()); - BinaryByteStream S(Bytes, llvm::support::little); + BinaryByteStream S(Bytes, llvm::endianness::little); BinaryStreamReader SR(S); auto EC = consume(SR, Item); Data = Data.take_back(SR.bytesRemaining()); diff --git a/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewReader.cpp b/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewReader.cpp index d72fe2683f92c..d14d81f3f76d3 100644 --- a/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewReader.cpp +++ b/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewReader.cpp @@ -276,7 +276,7 @@ Error LVCodeViewReader::collectInlineeInfo( } Error LVCodeViewReader::traverseInlineeLines(StringRef Subsection) { - BinaryStreamReader SR(Subsection, llvm::support::little); + BinaryStreamReader SR(Subsection, llvm::endianness::little); DebugInlineeLinesSubsectionRef Lines; if (Error E = Lines.initialize(SR)) return createStringError(errorToErrorCode(std::move(E)), getFileName()); @@ -514,7 +514,7 @@ Error LVCodeViewReader::loadPrecompiledObject(PrecompRecord &Precomp, [&](TypeIndex TI, const CVType &Type) { TypeArray.push_back(Type); }); ItemStream = - std::make_unique>(llvm::support::little); + std::make_unique>(llvm::endianness::little); ItemStream->setItems(TypeArray); TypeStream.setUnderlyingStream(*ItemStream); @@ -621,7 +621,7 @@ Error LVCodeViewReader::traverseSymbolsSubsection(StringRef Subsection, LVSymbolVisitorDelegate VisitorDelegate(this, Section, &getObj(), SectionContents); CVSymbolArray Symbols; - BinaryStreamReader Reader(BinaryData, llvm::support::little); + BinaryStreamReader Reader(BinaryData, llvm::endianness::little); if (Error E = Reader.readArray(Symbols, Reader.getLength())) return createStringError(errorToErrorCode(std::move(E)), getFileName()); diff --git a/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp b/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp index 5a6414f5564f8..80b644103fefd 100644 --- a/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp +++ b/llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp @@ -2939,7 +2939,7 @@ Error LVLogicalVisitor::finishVisitation(CVType &Record, TypeIndex TI, // Customized version of 'FieldListVisitHelper'. Error LVLogicalVisitor::visitFieldListMemberStream( TypeIndex TI, LVElement *Element, ArrayRef FieldList) { - BinaryByteStream Stream(FieldList, llvm::support::little); + BinaryByteStream Stream(FieldList, llvm::endianness::little); BinaryStreamReader Reader(Stream); FieldListDeserializer Deserializer(Reader); TypeVisitorCallbackPipeline Pipeline; diff --git a/llvm/lib/DebugInfo/MSF/MSFBuilder.cpp b/llvm/lib/DebugInfo/MSF/MSFBuilder.cpp index e909e851a9051..ed2d14dd79e45 100644 --- a/llvm/lib/DebugInfo/MSF/MSFBuilder.cpp +++ b/llvm/lib/DebugInfo/MSF/MSFBuilder.cpp @@ -386,7 +386,7 @@ Expected MSFBuilder::commit(StringRef Path, return std::move(EC); FileBufferByteStream Buffer(std::move(*OutFileOrError), - llvm::support::little); + llvm::endianness::little); BinaryStreamWriter Writer(Buffer); if (auto EC = Writer.writeObject(*Layout.SB)) diff --git a/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp index fb8b11b9c1588..ad3d09ae50e9c 100644 --- a/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp @@ -188,7 +188,7 @@ Error DbiStreamBuilder::generateFileInfoSubstream() { uint32_t NamesOffset = calculateNamesOffset(); FileInfoBuffer = MutableBinaryByteStream(MutableArrayRef(Data, Size), - llvm::support::little); + llvm::endianness::little); WritableBinaryStreamRef MetadataBuffer = WritableBinaryStreamRef(FileInfoBuffer).keep_front(NamesOffset); diff --git a/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp b/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp index 91b428afaddbf..fb0ca2f9cf229 100644 --- a/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/NativeSession.cpp @@ -74,7 +74,7 @@ Error NativeSession::createFromPdb(std::unique_ptr Buffer, std::unique_ptr &Session) { StringRef Path = Buffer->getBufferIdentifier(); auto Stream = std::make_unique( - std::move(Buffer), llvm::support::little); + std::move(Buffer), llvm::endianness::little); auto Allocator = std::make_unique(); auto File = std::make_unique(Path, std::move(Stream), *Allocator); @@ -104,8 +104,8 @@ loadPdbFile(StringRef PdbPath, std::unique_ptr &Allocator) { if (EC || Magic != file_magic::pdb) return make_error(EC); - auto Stream = std::make_unique(std::move(Buffer), - llvm::support::little); + auto Stream = std::make_unique( + std::move(Buffer), llvm::endianness::little); auto File = std::make_unique(PdbPath, std::move(Stream), *Allocator); if (auto EC = File->parseFileHeaders()) diff --git a/llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp b/llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp index 30d5a563e8bda..22663f009637d 100644 --- a/llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp @@ -165,7 +165,7 @@ Error TpiStreamBuilder::finalizeMsfLayout() { reinterpret_cast(HashBuffer.data()), calculateHashBufferSize()); HashValueStream = - std::make_unique(Bytes, llvm::support::little); + std::make_unique(Bytes, llvm::endianness::little); } return Error::success(); } diff --git a/llvm/lib/ObjectYAML/CodeViewYAMLTypeHashing.cpp b/llvm/lib/ObjectYAML/CodeViewYAMLTypeHashing.cpp index e921ae1e7d8d3..0ec8662f42ffc 100644 --- a/llvm/lib/ObjectYAML/CodeViewYAMLTypeHashing.cpp +++ b/llvm/lib/ObjectYAML/CodeViewYAMLTypeHashing.cpp @@ -49,7 +49,7 @@ DebugHSection llvm::CodeViewYAML::fromDebugH(ArrayRef DebugH) { assert(DebugH.size() >= 8); assert((DebugH.size() - 8) % 8 == 0); - BinaryStreamReader Reader(DebugH, llvm::support::little); + BinaryStreamReader Reader(DebugH, llvm::endianness::little); DebugHSection DHS; cantFail(Reader.readInteger(DHS.Magic)); cantFail(Reader.readInteger(DHS.Version)); @@ -69,7 +69,7 @@ ArrayRef llvm::CodeViewYAML::toDebugH(const DebugHSection &DebugH, uint32_t Size = 8 + 8 * DebugH.Hashes.size(); uint8_t *Data = Alloc.Allocate(Size); MutableArrayRef Buffer(Data, Size); - BinaryStreamWriter Writer(Buffer, llvm::support::little); + BinaryStreamWriter Writer(Buffer, llvm::endianness::little); cantFail(Writer.writeInteger(DebugH.Magic)); cantFail(Writer.writeInteger(DebugH.Version)); diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp index f3fd7fee4f45f..3800b23843fa9 100644 --- a/llvm/lib/ProfileData/InstrProfReader.cpp +++ b/llvm/lib/ProfileData/InstrProfReader.cpp @@ -1337,12 +1337,12 @@ Error IndexedInstrProfReader::readNextRecord(NamedInstrProfRecord &Record) { Error IndexedInstrProfReader::readBinaryIds( std::vector &BinaryIds) { return readBinaryIdsInternal(*DataBuffer, BinaryIdsSize, BinaryIdsStart, - BinaryIds, llvm::support::little); + BinaryIds, llvm::endianness::little); } Error IndexedInstrProfReader::printBinaryIds(raw_ostream &OS) { return printBinaryIdsInternal(OS, *DataBuffer, BinaryIdsSize, BinaryIdsStart, - llvm::support::little); + llvm::endianness::little); } void InstrProfReader::accumulateCounts(CountSumOrPercent &Sum, bool IsCS) { diff --git a/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp b/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp index 4063a647bec38..604f22d711190 100644 --- a/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp +++ b/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp @@ -135,9 +135,9 @@ class ARMDisassembler : public MCDisassembler { ARMDisassembler(const MCSubtargetInfo &STI, MCContext &Ctx, const MCInstrInfo *MCII) : MCDisassembler(STI, Ctx), MCII(MCII) { - InstructionEndianness = STI.hasFeature(ARM::ModeBigEndianInstructions) - ? llvm::support::big - : llvm::support::little; + InstructionEndianness = STI.hasFeature(ARM::ModeBigEndianInstructions) + ? llvm::endianness::big + : llvm::endianness::little; } ~ARMDisassembler() override = default; diff --git a/llvm/tools/llvm-objdump/MachODump.cpp b/llvm/tools/llvm-objdump/MachODump.cpp index fb8bc034b29c0..f80a12d2f84b8 100644 --- a/llvm/tools/llvm-objdump/MachODump.cpp +++ b/llvm/tools/llvm-objdump/MachODump.cpp @@ -7629,14 +7629,13 @@ namespace { template static uint64_t read(StringRef Contents, ptrdiff_t Offset) { - using llvm::support::little; - if (Offset + sizeof(T) > Contents.size()) { outs() << "warning: attempt to read past end of buffer\n"; return T(); } - uint64_t Val = support::endian::read(Contents.data() + Offset); + uint64_t Val = support::endian::read( + Contents.data() + Offset); return Val; } diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index ac0bded350743..89d59e2a77ad9 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -788,7 +788,7 @@ class ARMPrettyPrinter : public PrettyPrinter { } private: - llvm::endianness InstructionEndianness = llvm::support::little; + llvm::endianness InstructionEndianness = llvm::endianness::little; }; ARMPrettyPrinter ARMPrettyPrinterInst; @@ -811,8 +811,8 @@ class AArch64PrettyPrinter : public PrettyPrinter { for (; Pos + 4 <= End; Pos += 4) OS << ' ' << format_hex_no_prefix( - llvm::support::endian::read(Bytes.data() + Pos, - llvm::support::little), + llvm::support::endian::read( + Bytes.data() + Pos, llvm::endianness::little), 8); if (Pos < End) { OS << ' '; @@ -2289,9 +2289,9 @@ static void disassembleObject(ObjectFile *Obj, bool InlineRelocs) { if (Elf32BE && (Elf32BE->isRelocatableObject() || !(Elf32BE->getPlatformFlags() & ELF::EF_ARM_BE8))) { Features.AddFeature("+big-endian-instructions"); - ARMPrettyPrinterInst.setInstructionEndianness(llvm::support::big); + ARMPrettyPrinterInst.setInstructionEndianness(llvm::endianness::big); } else { - ARMPrettyPrinterInst.setInstructionEndianness(llvm::support::little); + ARMPrettyPrinterInst.setInstructionEndianness(llvm::endianness::little); } } diff --git a/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp b/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp index 447a9cb6b3599..5ce663e2efc9a 100644 --- a/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp +++ b/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp @@ -1286,7 +1286,7 @@ Error DumpOutputStyle::dumpTypesFromObjectFile() { return ContentsOrErr.takeError(); uint32_t Magic; - BinaryStreamReader Reader(*ContentsOrErr, llvm::support::little); + BinaryStreamReader Reader(*ContentsOrErr, llvm::endianness::little); if (auto EC = Reader.readInteger(Magic)) return EC; if (Magic != COFF::DEBUG_SECTION_MAGIC) diff --git a/llvm/tools/llvm-pdbutil/ExplainOutputStyle.cpp b/llvm/tools/llvm-pdbutil/ExplainOutputStyle.cpp index 3e57e318d7e05..ce9d659335b30 100644 --- a/llvm/tools/llvm-pdbutil/ExplainOutputStyle.cpp +++ b/llvm/tools/llvm-pdbutil/ExplainOutputStyle.cpp @@ -66,9 +66,8 @@ Error ExplainOutputStyle::explainPdbFile() { } Error ExplainOutputStyle::explainBinaryFile() { - std::unique_ptr Stream = - std::make_unique(File.unknown().getBuffer(), - llvm::support::little); + std::unique_ptr Stream = std::make_unique( + File.unknown().getBuffer(), llvm::endianness::little); switch (opts::explain::InputType) { case opts::explain::InputFileType::DBIStream: { DbiStream Dbi(std::move(Stream)); diff --git a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp index 10839383cb139..fa870666fe61a 100644 --- a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp +++ b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp @@ -1415,7 +1415,7 @@ static void exportStream() { SourceStream = File.createIndexedStream(Index); auto OutFile = ExitOnErr( FileOutputBuffer::create(OutFileName, SourceStream->getLength())); - FileBufferByteStream DestStream(std::move(OutFile), llvm::support::little); + FileBufferByteStream DestStream(std::move(OutFile), llvm::endianness::little); BinaryStreamWriter Writer(DestStream); ExitOnErr(Writer.writeStreamRef(*SourceStream)); ExitOnErr(DestStream.commit()); diff --git a/llvm/tools/llvm-readobj/COFFDumper.cpp b/llvm/tools/llvm-readobj/COFFDumper.cpp index 6e32a7eeb9d7d..bdfb8acec069e 100644 --- a/llvm/tools/llvm-readobj/COFFDumper.cpp +++ b/llvm/tools/llvm-readobj/COFFDumper.cpp @@ -1237,7 +1237,7 @@ void COFFDumper::printCodeViewSymbolSection(StringRef SectionName, } case DebugSubsectionKind::FrameData: { // First four bytes is a relocation against the function. - BinaryStreamReader SR(Contents, llvm::support::little); + BinaryStreamReader SR(Contents, llvm::endianness::little); DebugFrameDataSubsectionRef FrameData; if (Error E = FrameData.initialize(SR)) @@ -1354,7 +1354,7 @@ void COFFDumper::printCodeViewSymbolsSubsection(StringRef Subsection, CVSymbolDumper CVSD(W, Types, CodeViewContainer::ObjectFile, std::move(CODD), CompilationCPUType, opts::CodeViewSubsectionBytes); CVSymbolArray Symbols; - BinaryStreamReader Reader(BinaryData, llvm::support::little); + BinaryStreamReader Reader(BinaryData, llvm::endianness::little); if (Error E = Reader.readArray(Symbols, Reader.getLength())) { W.flush(); reportError(std::move(E), Obj->getFileName()); @@ -1369,7 +1369,7 @@ void COFFDumper::printCodeViewSymbolsSubsection(StringRef Subsection, } void COFFDumper::printCodeViewFileChecksums(StringRef Subsection) { - BinaryStreamRef Stream(Subsection, llvm::support::little); + BinaryStreamRef Stream(Subsection, llvm::endianness::little); DebugChecksumsSubsectionRef Checksums; if (Error E = Checksums.initialize(Stream)) reportError(std::move(E), Obj->getFileName()); @@ -1389,7 +1389,7 @@ void COFFDumper::printCodeViewFileChecksums(StringRef Subsection) { } void COFFDumper::printCodeViewInlineeLines(StringRef Subsection) { - BinaryStreamReader SR(Subsection, llvm::support::little); + BinaryStreamReader SR(Subsection, llvm::endianness::little); DebugInlineeLinesSubsectionRef Lines; if (Error E = Lines.initialize(SR)) reportError(std::move(E), Obj->getFileName()); @@ -1449,7 +1449,7 @@ void COFFDumper::mergeCodeViewTypes(MergingTypeTableBuilder &CVIDs, Obj->getFileName()); CVTypeArray Types; - BinaryStreamReader Reader(Data, llvm::support::little); + BinaryStreamReader Reader(Data, llvm::endianness::little); if (auto EC = Reader.readArray(Types, Reader.getLength())) { consumeError(std::move(EC)); W.flush(); @@ -2150,7 +2150,7 @@ void COFFDumper::printCGProfile() { StringRef CGProfileContents = unwrapOrError(Obj->getFileName(), CGProfileSection.getContents()); - BinaryStreamReader Reader(CGProfileContents, llvm::support::little); + BinaryStreamReader Reader(CGProfileContents, llvm::endianness::little); ListScope L(W, "CGProfile"); while (!Reader.empty()) { diff --git a/llvm/tools/llvm-readobj/MachODumper.cpp b/llvm/tools/llvm-readobj/MachODumper.cpp index ce5ba46695d86..fb5a58747e50d 100644 --- a/llvm/tools/llvm-readobj/MachODumper.cpp +++ b/llvm/tools/llvm-readobj/MachODumper.cpp @@ -760,8 +760,8 @@ void MachODumper::printCGProfile() { StringRef CGProfileContents = unwrapOrError(Obj->getFileName(), CGProfileSection.getContents()); BinaryStreamReader Reader(CGProfileContents, Obj->isLittleEndian() - ? llvm::support::little - : llvm::support::big); + ? llvm::endianness::little + : llvm::endianness::big); ListScope L(W, "CGProfile"); while (!Reader.empty()) { diff --git a/llvm/unittests/DebugInfo/CodeView/RandomAccessVisitorTest.cpp b/llvm/unittests/DebugInfo/CodeView/RandomAccessVisitorTest.cpp index 0686b47c69d52..3eda776fdf6a3 100644 --- a/llvm/unittests/DebugInfo/CodeView/RandomAccessVisitorTest.cpp +++ b/llvm/unittests/DebugInfo/CodeView/RandomAccessVisitorTest.cpp @@ -152,7 +152,8 @@ class RandomAccessVisitorTest : public testing::Test { } struct GlobalTestState { - GlobalTestState() : Strings(Allocator), ItemStream(llvm::support::little) {} + GlobalTestState() + : Strings(Allocator), ItemStream(llvm::endianness::little) {} BumpPtrAllocator Allocator; StringSaver Strings; @@ -370,7 +371,7 @@ TEST_F(RandomAccessVisitorTest, CrossChunkName) { {Builder.records()[0]}, {Builder.records()[1]}, }; - BinaryItemStream ItemStream(llvm::support::little); + BinaryItemStream ItemStream(llvm::endianness::little); ItemStream.setItems(TypeArray); VarStreamArray TypeStream(ItemStream); @@ -386,7 +387,7 @@ TEST_F(RandomAccessVisitorTest, CrossChunkName) { ArrayRef Buffer(reinterpret_cast(TIO.data()), TIO.size() * sizeof(TypeIndexOffset)); - BinaryStreamReader Reader(Buffer, llvm::support::little); + BinaryStreamReader Reader(Buffer, llvm::endianness::little); FixedStreamArray PartialOffsets; ASSERT_THAT_ERROR(Reader.readArray(PartialOffsets, 2), Succeeded()); diff --git a/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp b/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp index b35fa2739e356..58bc83997d1a9 100644 --- a/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp +++ b/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp @@ -181,7 +181,7 @@ static void TestFunctionInfoDecodeError(llvm::endianness ByteOrder, const uint64_t BaseAddr, std::string ExpectedErrorMsg) { uint8_t AddressSize = 4; - DataExtractor Data(Bytes, ByteOrder == llvm::support::little, AddressSize); + DataExtractor Data(Bytes, ByteOrder == llvm::endianness::little, AddressSize); llvm::Expected Decoded = FunctionInfo::decode(Data, BaseAddr); // Make sure decoding fails. ASSERT_FALSE((bool)Decoded); @@ -192,7 +192,7 @@ static void TestFunctionInfoDecodeError(llvm::endianness ByteOrder, TEST(GSYMTest, TestFunctionInfoDecodeErrors) { // Test decoding FunctionInfo objects that ensure we report an appropriate // error message. - const llvm::endianness ByteOrder = llvm::support::little; + const llvm::endianness ByteOrder = llvm::endianness::little; SmallString<512> Str; raw_svector_ostream OutStrm(Str); FileWriter FW(OutStrm, ByteOrder); @@ -237,22 +237,23 @@ TEST(GSYMTest, TestFunctionInfoEncodeErrors) { const uint32_t InvalidName = 0; const uint32_t ValidName = 1; FunctionInfo InvalidNameFI(FuncAddr, FuncSize, InvalidName); - TestFunctionInfoEncodeError(llvm::support::little, InvalidNameFI, + TestFunctionInfoEncodeError( + llvm::endianness::little, InvalidNameFI, "attempted to encode invalid FunctionInfo object"); FunctionInfo InvalidLineTableFI(FuncAddr, FuncSize, ValidName); // Empty line tables are not valid. Verify if the encoding of anything // in our line table fails, that we see get the error propagated. InvalidLineTableFI.OptLineTable = LineTable(); - TestFunctionInfoEncodeError(llvm::support::little, InvalidLineTableFI, - "attempted to encode invalid LineTable object"); + TestFunctionInfoEncodeError(llvm::endianness::little, InvalidLineTableFI, + "attempted to encode invalid LineTable object"); FunctionInfo InvalidInlineInfoFI(FuncAddr, FuncSize, ValidName); // Empty line tables are not valid. Verify if the encoding of anything // in our line table fails, that we see get the error propagated. InvalidInlineInfoFI.Inline = InlineInfo(); - TestFunctionInfoEncodeError(llvm::support::little, InvalidInlineInfoFI, - "attempted to encode invalid InlineInfo object"); + TestFunctionInfoEncodeError(llvm::endianness::little, InvalidInlineInfoFI, + "attempted to encode invalid InlineInfo object"); } static void TestFunctionInfoEncodeDecode(llvm::endianness ByteOrder, @@ -267,7 +268,7 @@ static void TestFunctionInfoEncodeDecode(llvm::endianness ByteOrder, ASSERT_EQ(ExpectedOffset.get(), 0ULL); std::string Bytes(OutStrm.str()); uint8_t AddressSize = 4; - DataExtractor Data(Bytes, ByteOrder == llvm::support::little, AddressSize); + DataExtractor Data(Bytes, ByteOrder == llvm::endianness::little, AddressSize); llvm::Expected Decoded = FunctionInfo::decode(Data, FI.Range.start()); // Make sure decoding succeeded. @@ -306,30 +307,30 @@ TEST(GSYMTest, TestFunctionInfoEncoding) { // Make sure that we can encode and decode a FunctionInfo with no line table // or inline info. FunctionInfo FI(FuncAddr, FuncSize, FuncName); - TestFunctionInfoEncodeDecode(llvm::support::little, FI); - TestFunctionInfoEncodeDecode(llvm::support::big, FI); + TestFunctionInfoEncodeDecode(llvm::endianness::little, FI); + TestFunctionInfoEncodeDecode(llvm::endianness::big, FI); // Make sure that we can encode and decode a FunctionInfo with a line table // and no inline info. FunctionInfo FILines(FuncAddr, FuncSize, FuncName); AddLines(FuncAddr, FileIdx, FILines); - TestFunctionInfoEncodeDecode(llvm::support::little, FILines); - TestFunctionInfoEncodeDecode(llvm::support::big, FILines); + TestFunctionInfoEncodeDecode(llvm::endianness::little, FILines); + TestFunctionInfoEncodeDecode(llvm::endianness::big, FILines); // Make sure that we can encode and decode a FunctionInfo with no line table // and with inline info. FunctionInfo FIInline(FuncAddr, FuncSize, FuncName); AddInline(FuncAddr, FuncSize, FIInline); - TestFunctionInfoEncodeDecode(llvm::support::little, FIInline); - TestFunctionInfoEncodeDecode(llvm::support::big, FIInline); + TestFunctionInfoEncodeDecode(llvm::endianness::little, FIInline); + TestFunctionInfoEncodeDecode(llvm::endianness::big, FIInline); // Make sure that we can encode and decode a FunctionInfo with no line table // and with inline info. FunctionInfo FIBoth(FuncAddr, FuncSize, FuncName); AddLines(FuncAddr, FileIdx, FIBoth); AddInline(FuncAddr, FuncSize, FIBoth); - TestFunctionInfoEncodeDecode(llvm::support::little, FIBoth); - TestFunctionInfoEncodeDecode(llvm::support::big, FIBoth); + TestFunctionInfoEncodeDecode(llvm::endianness::little, FIBoth); + TestFunctionInfoEncodeDecode(llvm::endianness::big, FIBoth); } static void TestInlineInfoEncodeDecode(llvm::endianness ByteOrder, @@ -343,7 +344,7 @@ static void TestInlineInfoEncodeDecode(llvm::endianness ByteOrder, ASSERT_FALSE(Err); std::string Bytes(OutStrm.str()); uint8_t AddressSize = 4; - DataExtractor Data(Bytes, ByteOrder == llvm::support::little, AddressSize); + DataExtractor Data(Bytes, ByteOrder == llvm::endianness::little, AddressSize); llvm::Expected Decoded = InlineInfo::decode(Data, BaseAddr); // Make sure decoding succeeded. ASSERT_TRUE((bool)Decoded); @@ -355,7 +356,7 @@ static void TestInlineInfoDecodeError(llvm::endianness ByteOrder, StringRef Bytes, const uint64_t BaseAddr, std::string ExpectedErrorMsg) { uint8_t AddressSize = 4; - DataExtractor Data(Bytes, ByteOrder == llvm::support::little, AddressSize); + DataExtractor Data(Bytes, ByteOrder == llvm::endianness::little, AddressSize); llvm::Expected Decoded = InlineInfo::decode(Data, BaseAddr); // Make sure decoding fails. ASSERT_FALSE((bool)Decoded); @@ -469,8 +470,8 @@ TEST(GSYMTest, TestInlineInfo) { ASSERT_EQ(*InlineInfos->at(1), Inline1); // Test encoding and decoding InlineInfo objects - TestInlineInfoEncodeDecode(llvm::support::little, Root); - TestInlineInfoEncodeDecode(llvm::support::big, Root); + TestInlineInfoEncodeDecode(llvm::endianness::little, Root); + TestInlineInfoEncodeDecode(llvm::endianness::big, Root); } TEST(GSYMTest, TestInlineInfoEncodeErrors) { @@ -480,16 +481,16 @@ TEST(GSYMTest, TestInlineInfoEncodeErrors) { // that has no ranges. InlineInfo Empty; std::string EmptyErr("attempted to encode invalid InlineInfo object"); - TestInlineInfoEncodeError(llvm::support::little, Empty, EmptyErr); - TestInlineInfoEncodeError(llvm::support::big, Empty, EmptyErr); + TestInlineInfoEncodeError(llvm::endianness::little, Empty, EmptyErr); + TestInlineInfoEncodeError(llvm::endianness::big, Empty, EmptyErr); // Verify that we get an error trying to encode an InlineInfo object that has // a child InlineInfo that has no ranges. InlineInfo ContainsEmpty; ContainsEmpty.Ranges.insert({0x100, 0x200}); ContainsEmpty.Children.push_back(Empty); - TestInlineInfoEncodeError(llvm::support::little, ContainsEmpty, EmptyErr); - TestInlineInfoEncodeError(llvm::support::big, ContainsEmpty, EmptyErr); + TestInlineInfoEncodeError(llvm::endianness::little, ContainsEmpty, EmptyErr); + TestInlineInfoEncodeError(llvm::endianness::big, ContainsEmpty, EmptyErr); // Verify that we get an error trying to encode an InlineInfo object that has // a child whose address range is not contained in the parent address range. @@ -499,17 +500,16 @@ TEST(GSYMTest, TestInlineInfoEncodeErrors) { InlineInfo ChildNotContainedChild; ChildNotContainedChild.Ranges.insert({0x200, 0x300}); ChildNotContained.Children.push_back(ChildNotContainedChild); - TestInlineInfoEncodeError(llvm::support::little, ChildNotContained, + TestInlineInfoEncodeError(llvm::endianness::little, ChildNotContained, ChildNotContainedErr); - TestInlineInfoEncodeError(llvm::support::big, ChildNotContained, + TestInlineInfoEncodeError(llvm::endianness::big, ChildNotContained, ChildNotContainedErr); - } TEST(GSYMTest, TestInlineInfoDecodeErrors) { // Test decoding InlineInfo objects that ensure we report an appropriate // error message. - const llvm::endianness ByteOrder = llvm::support::little; + const llvm::endianness ByteOrder = llvm::endianness::little; SmallString<512> Str; raw_svector_ostream OutStrm(Str); FileWriter FW(OutStrm, ByteOrder); @@ -601,7 +601,7 @@ static void TestFileWriterHelper(llvm::endianness ByteOrder) { std::string Bytes(OutStrm.str()); uint8_t AddressSize = 4; - DataExtractor Data(Bytes, ByteOrder == llvm::support::little, AddressSize); + DataExtractor Data(Bytes, ByteOrder == llvm::endianness::little, AddressSize); uint64_t Offset = 0; EXPECT_EQ(Data.getU8(&Offset), U8); EXPECT_EQ(Data.getU16(&Offset), U16); @@ -617,8 +617,8 @@ static void TestFileWriterHelper(llvm::endianness ByteOrder) { } TEST(GSYMTest, TestFileWriter) { - TestFileWriterHelper(llvm::support::little); - TestFileWriterHelper(llvm::support::big); + TestFileWriterHelper(llvm::endianness::little); + TestFileWriterHelper(llvm::endianness::big); } TEST(GSYMTest, TestAddressRangeEncodeDecode) { @@ -637,7 +637,7 @@ TEST(GSYMTest, TestAddressRangeEncodeDecode) { encodeRange(Range2, FW, BaseAddr); std::string Bytes(OutStrm.str()); uint8_t AddressSize = 4; - DataExtractor Data(Bytes, ByteOrder == llvm::support::little, AddressSize); + DataExtractor Data(Bytes, ByteOrder == llvm::endianness::little, AddressSize); AddressRange DecodedRange1, DecodedRange2; uint64_t Offset = 0; @@ -657,7 +657,7 @@ static void TestAddressRangeEncodeDecodeHelper(const AddressRanges &Ranges, std::string Bytes(OutStrm.str()); uint8_t AddressSize = 4; - DataExtractor Data(Bytes, ByteOrder == llvm::support::little, AddressSize); + DataExtractor Data(Bytes, ByteOrder == llvm::endianness::little, AddressSize); AddressRanges DecodedRanges; uint64_t Offset = 0; @@ -696,7 +696,7 @@ static void TestLineTableHelper(llvm::endianness ByteOrder, ASSERT_FALSE(Err); std::string Bytes(OutStrm.str()); uint8_t AddressSize = 4; - DataExtractor Data(Bytes, ByteOrder == llvm::support::little, AddressSize); + DataExtractor Data(Bytes, ByteOrder == llvm::endianness::little, AddressSize); llvm::Expected Decoded = LineTable::decode(Data, BaseAddr); // Make sure decoding succeeded. ASSERT_TRUE((bool)Decoded); @@ -730,8 +730,8 @@ TEST(GSYMTest, TestLineTable) { ASSERT_EQ(LT[2], Line2); // Test encoding and decoding line tables. - TestLineTableHelper(llvm::support::little, LT); - TestLineTableHelper(llvm::support::big, LT); + TestLineTableHelper(llvm::endianness::little, LT); + TestLineTableHelper(llvm::endianness::big, LT); // Verify the clear method works as expected. LT.clear(); @@ -766,7 +766,7 @@ static void TestLineTableDecodeError(llvm::endianness ByteOrder, StringRef Bytes, const uint64_t BaseAddr, std::string ExpectedErrorMsg) { uint8_t AddressSize = 4; - DataExtractor Data(Bytes, ByteOrder == llvm::support::little, AddressSize); + DataExtractor Data(Bytes, ByteOrder == llvm::endianness::little, AddressSize); llvm::Expected Decoded = LineTable::decode(Data, BaseAddr); // Make sure decoding fails. ASSERT_FALSE((bool)Decoded); @@ -777,7 +777,7 @@ static void TestLineTableDecodeError(llvm::endianness ByteOrder, TEST(GSYMTest, TestLineTableDecodeErrors) { // Test decoding InlineInfo objects that ensure we report an appropriate // error message. - const llvm::endianness ByteOrder = llvm::support::little; + const llvm::endianness ByteOrder = llvm::endianness::little; SmallString<512> Str; raw_svector_ostream OutStrm(Str); FileWriter FW(OutStrm, ByteOrder); @@ -813,7 +813,7 @@ TEST(GSYMTest, TestLineTableDecodeErrors) { TEST(GSYMTest, TestLineTableEncodeErrors) { const uint64_t BaseAddr = 0x1000; const uint32_t FileIdx = 1; - const llvm::endianness ByteOrder = llvm::support::little; + const llvm::endianness ByteOrder = llvm::endianness::little; SmallString<512> Str; raw_svector_ostream OutStrm(Str); FileWriter FW(OutStrm, ByteOrder); @@ -842,7 +842,7 @@ TEST(GSYMTest, TestLineTableEncodeErrors) { static void TestHeaderEncodeError(const Header &H, std::string ExpectedErrorMsg) { - const llvm::endianness ByteOrder = llvm::support::little; + const llvm::endianness ByteOrder = llvm::endianness::little; SmallString<512> Str; raw_svector_ostream OutStrm(Str); FileWriter FW(OutStrm, ByteOrder); @@ -852,9 +852,9 @@ static void TestHeaderEncodeError(const Header &H, static void TestHeaderDecodeError(StringRef Bytes, std::string ExpectedErrorMsg) { - const llvm::endianness ByteOrder = llvm::support::little; + const llvm::endianness ByteOrder = llvm::endianness::little; uint8_t AddressSize = 4; - DataExtractor Data(Bytes, ByteOrder == llvm::support::little, AddressSize); + DataExtractor Data(Bytes, ByteOrder == llvm::endianness::little, AddressSize); llvm::Expected
Decoded = Header::decode(Data); // Make sure decoding fails. ASSERT_FALSE((bool)Decoded); @@ -897,7 +897,7 @@ TEST(GSYMTest, TestHeaderEncodeErrors) { } TEST(GSYMTest, TestHeaderDecodeErrors) { - const llvm::endianness ByteOrder = llvm::support::little; + const llvm::endianness ByteOrder = llvm::endianness::little; SmallString<512> Str; raw_svector_ostream OutStrm(Str); FileWriter FW(OutStrm, ByteOrder); @@ -927,7 +927,7 @@ static void TestHeaderEncodeDecode(const Header &H, llvm::Error Err = H.encode(FW); ASSERT_FALSE(Err); std::string Bytes(OutStrm.str()); - DataExtractor Data(Bytes, ByteOrder == llvm::support::little, AddressSize); + DataExtractor Data(Bytes, ByteOrder == llvm::endianness::little, AddressSize); llvm::Expected
Decoded = Header::decode(Data); // Make sure decoding succeeded. ASSERT_TRUE((bool)Decoded); @@ -936,8 +936,8 @@ static void TestHeaderEncodeDecode(const Header &H, TEST(GSYMTest, TestHeaderEncodeDecode) { Header H; InitHeader(H); - TestHeaderEncodeDecode(H, llvm::support::little); - TestHeaderEncodeDecode(H, llvm::support::big); + TestHeaderEncodeDecode(H, llvm::endianness::little); + TestHeaderEncodeDecode(H, llvm::endianness::big); } static void TestGsymCreatorEncodeError(llvm::endianness ByteOrder, @@ -960,7 +960,7 @@ TEST(GSYMTest, TestGsymCreatorEncodeErrors) { // function infos. We shouldn't be saving a GSYM file in this case since // there is nothing inside of it. GsymCreator GC; - TestGsymCreatorEncodeError(llvm::support::little, GC, + TestGsymCreatorEncodeError(llvm::endianness::little, GC, "no functions to encode"); const uint64_t FuncAddr = 0x1000; const uint64_t FuncSize = 0x100; @@ -968,7 +968,7 @@ TEST(GSYMTest, TestGsymCreatorEncodeErrors) { // Verify we get an error trying to encode a GsymCreator that isn't // finalized. GC.addFunctionInfo(FunctionInfo(FuncAddr, FuncSize, FuncName)); - TestGsymCreatorEncodeError(llvm::support::little, GC, + TestGsymCreatorEncodeError(llvm::endianness::little, GC, "GsymCreator wasn't finalized prior to encoding"); std::string finalizeIssues; raw_string_ostream OS(finalizeIssues); @@ -980,7 +980,7 @@ TEST(GSYMTest, TestGsymCreatorEncodeErrors) { // Verify we get an error trying to encode a GsymCreator with a UUID that is // too long. GC.setUUID(InvalidUUID); - TestGsymCreatorEncodeError(llvm::support::little, GC, + TestGsymCreatorEncodeError(llvm::endianness::little, GC, "invalid UUID size 21"); GC.setUUID(ValidUUID); // Verify errors are propagated when we try to encoding an invalid line @@ -989,7 +989,7 @@ TEST(GSYMTest, TestGsymCreatorEncodeErrors) { FI.OptLineTable = LineTable(); // Invalid line table. return false; // Stop iterating }); - TestGsymCreatorEncodeError(llvm::support::little, GC, + TestGsymCreatorEncodeError(llvm::endianness::little, GC, "attempted to encode invalid LineTable object"); // Verify errors are propagated when we try to encoding an invalid inline // info. @@ -998,7 +998,7 @@ TEST(GSYMTest, TestGsymCreatorEncodeErrors) { FI.Inline = InlineInfo(); // Invalid InlineInfo. return false; // Stop iterating }); - TestGsymCreatorEncodeError(llvm::support::little, GC, + TestGsymCreatorEncodeError(llvm::endianness::little, GC, "attempted to encode invalid InlineInfo object"); } @@ -1046,15 +1046,11 @@ TEST(GSYMTest, TestGsymCreator1ByteAddrOffsets) { GC.addFunctionInfo(FunctionInfo(BaseAddr+0x20, 0x10, Func2Name)); Error Err = GC.finalize(llvm::nulls()); ASSERT_FALSE(Err); - TestEncodeDecode(GC, llvm::support::little, - GSYM_VERSION, - AddrOffSize, + TestEncodeDecode(GC, llvm::endianness::little, GSYM_VERSION, AddrOffSize, BaseAddr, 2, // NumAddresses ArrayRef(UUID)); - TestEncodeDecode(GC, llvm::support::big, - GSYM_VERSION, - AddrOffSize, + TestEncodeDecode(GC, llvm::endianness::big, GSYM_VERSION, AddrOffSize, BaseAddr, 2, // NumAddresses ArrayRef(UUID)); @@ -1072,15 +1068,11 @@ TEST(GSYMTest, TestGsymCreator2ByteAddrOffsets) { GC.addFunctionInfo(FunctionInfo(BaseAddr+0x200, 0x100, Func2Name)); Error Err = GC.finalize(llvm::nulls()); ASSERT_FALSE(Err); - TestEncodeDecode(GC, llvm::support::little, - GSYM_VERSION, - AddrOffSize, + TestEncodeDecode(GC, llvm::endianness::little, GSYM_VERSION, AddrOffSize, BaseAddr, 2, // NumAddresses ArrayRef(UUID)); - TestEncodeDecode(GC, llvm::support::big, - GSYM_VERSION, - AddrOffSize, + TestEncodeDecode(GC, llvm::endianness::big, GSYM_VERSION, AddrOffSize, BaseAddr, 2, // NumAddresses ArrayRef(UUID)); @@ -1098,15 +1090,11 @@ TEST(GSYMTest, TestGsymCreator4ByteAddrOffsets) { GC.addFunctionInfo(FunctionInfo(BaseAddr+0x20000, 0x100, Func2Name)); Error Err = GC.finalize(llvm::nulls()); ASSERT_FALSE(Err); - TestEncodeDecode(GC, llvm::support::little, - GSYM_VERSION, - AddrOffSize, + TestEncodeDecode(GC, llvm::endianness::little, GSYM_VERSION, AddrOffSize, BaseAddr, 2, // NumAddresses ArrayRef(UUID)); - TestEncodeDecode(GC, llvm::support::big, - GSYM_VERSION, - AddrOffSize, + TestEncodeDecode(GC, llvm::endianness::big, GSYM_VERSION, AddrOffSize, BaseAddr, 2, // NumAddresses ArrayRef(UUID)); @@ -1124,15 +1112,11 @@ TEST(GSYMTest, TestGsymCreator8ByteAddrOffsets) { GC.addFunctionInfo(FunctionInfo(BaseAddr+0x100000000, 0x100, Func2Name)); Error Err = GC.finalize(llvm::nulls()); ASSERT_FALSE(Err); - TestEncodeDecode(GC, llvm::support::little, - GSYM_VERSION, - AddrOffSize, + TestEncodeDecode(GC, llvm::endianness::little, GSYM_VERSION, AddrOffSize, BaseAddr, 2, // NumAddresses ArrayRef(UUID)); - TestEncodeDecode(GC, llvm::support::big, - GSYM_VERSION, - AddrOffSize, + TestEncodeDecode(GC, llvm::endianness::big, GSYM_VERSION, AddrOffSize, BaseAddr, 2, // NumAddresses ArrayRef(UUID)); @@ -2449,11 +2433,12 @@ TEST(GSYMTest, TestGsymCreatorMultipleSymbolsWithNoSize) { GC.addFunctionInfo(FunctionInfo(BaseAddr, 0, Func2Name)); Error Err = GC.finalize(llvm::nulls()); ASSERT_FALSE(Err); - TestEncodeDecode(GC, llvm::support::little, GSYM_VERSION, AddrOffSize, + TestEncodeDecode(GC, llvm::endianness::little, GSYM_VERSION, AddrOffSize, BaseAddr, 1, // NumAddresses ArrayRef(UUID)); - TestEncodeDecode(GC, llvm::support::big, GSYM_VERSION, AddrOffSize, BaseAddr, + TestEncodeDecode(GC, llvm::endianness::big, GSYM_VERSION, AddrOffSize, + BaseAddr, 1, // NumAddresses ArrayRef(UUID)); } diff --git a/llvm/unittests/DebugInfo/MSF/MappedBlockStreamTest.cpp b/llvm/unittests/DebugInfo/MSF/MappedBlockStreamTest.cpp index 60fb14dd9135e..3da19b90a28a9 100644 --- a/llvm/unittests/DebugInfo/MSF/MappedBlockStreamTest.cpp +++ b/llvm/unittests/DebugInfo/MSF/MappedBlockStreamTest.cpp @@ -511,7 +511,7 @@ TEST(MappedBlockStreamTest, CreateFpmStream) { constexpr uint32_t NumFileBlocks = 4096 * 4; std::vector MsfBuffer(NumFileBlocks * SB.BlockSize); - MutableBinaryByteStream MsfStream(MsfBuffer, llvm::support::little); + MutableBinaryByteStream MsfStream(MsfBuffer, llvm::endianness::little); SB.NumBlocks = NumFileBlocks; auto FpmStream = diff --git a/llvm/unittests/Support/BinaryStreamTest.cpp b/llvm/unittests/Support/BinaryStreamTest.cpp index 01b49ca65e493..6ceadd6ce1698 100644 --- a/llvm/unittests/Support/BinaryStreamTest.cpp +++ b/llvm/unittests/Support/BinaryStreamTest.cpp @@ -393,7 +393,7 @@ TEST_F(BinaryStreamTest, MutableBinaryByteStreamBounds) { } TEST_F(BinaryStreamTest, AppendingStream) { - AppendingBinaryByteStream Stream(llvm::support::little); + AppendingBinaryByteStream Stream(llvm::endianness::little); EXPECT_EQ(0U, Stream.getLength()); std::vector InputData = {'T', 'e', 's', 't', 'T', 'e', 's', 't'}; @@ -925,7 +925,7 @@ TEST_F(BinaryStreamTest, BinaryItemStream) { uint8_t *Ptr = static_cast(Allocator.Allocate(sizeof(Foo), alignof(Foo))); MutableArrayRef Buffer(Ptr, sizeof(Foo)); - MutableBinaryByteStream Stream(Buffer, llvm::support::big); + MutableBinaryByteStream Stream(Buffer, llvm::endianness::big); BinaryStreamWriter Writer(Stream); ASSERT_THAT_ERROR(Writer.writeObject(F), Succeeded()); Objects.push_back(BinaryItemStreamObject(Buffer)); diff --git a/llvm/unittests/Support/HashBuilderTest.cpp b/llvm/unittests/Support/HashBuilderTest.cpp index 461b7c3b25d89..0aacfcd185ba0 100644 --- a/llvm/unittests/Support/HashBuilderTest.cpp +++ b/llvm/unittests/Support/HashBuilderTest.cpp @@ -26,16 +26,16 @@ struct HasherTAndEndianness { using HasherT = _HasherT; static constexpr llvm::endianness Endianness = _Endianness; }; -using HasherTAndEndiannessToTest = - ::testing::Types, - HasherTAndEndianness, - HasherTAndEndianness, - HasherTAndEndianness, - HasherTAndEndianness, - HasherTAndEndianness, - HasherTAndEndianness, - HasherTAndEndianness, - HasherTAndEndianness>; +using HasherTAndEndiannessToTest = ::testing::Types< + HasherTAndEndianness, + HasherTAndEndianness, + HasherTAndEndianness, + HasherTAndEndianness, + HasherTAndEndianness, + HasherTAndEndianness, + HasherTAndEndianness, + HasherTAndEndianness, + HasherTAndEndianness>; template class HashBuilderTest : public testing::Test {}; TYPED_TEST_SUITE(HashBuilderTest, HasherTAndEndiannessToTest, ); diff --git a/llvm/unittests/Support/YAMLIOTest.cpp b/llvm/unittests/Support/YAMLIOTest.cpp index dc68f945e0902..90c09ed7f79ee 100644 --- a/llvm/unittests/Support/YAMLIOTest.cpp +++ b/llvm/unittests/Support/YAMLIOTest.cpp @@ -550,10 +550,10 @@ TEST(YAMLIO, TestReadWriteBuiltInTypes) { struct EndianTypes { typedef llvm::support::detail::packed_endian_specific_integral< - float, llvm::support::little, llvm::support::unaligned> + float, llvm::endianness::little, llvm::support::unaligned> ulittle_float; typedef llvm::support::detail::packed_endian_specific_integral< - double, llvm::support::little, llvm::support::unaligned> + double, llvm::endianness::little, llvm::support::unaligned> ulittle_double; llvm::support::ulittle64_t u64;