34 changes: 17 additions & 17 deletions llvm/unittests/ExecutionEngine/JITLink/LinkGraphTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ static ArrayRef<char> BlockContent(BlockContentBytes);

TEST(LinkGraphTest, Construction) {
// Check that LinkGraph construction works as expected.
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, support::little,
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, llvm::endianness::little,
getGenericEdgeKindName);
EXPECT_EQ(G.getName(), "foo");
EXPECT_EQ(G.getTargetTriple().str(), "x86_64-apple-darwin");
EXPECT_EQ(G.getPointerSize(), 8U);
EXPECT_EQ(G.getEndianness(), support::little);
EXPECT_EQ(G.getEndianness(), llvm::endianness::little);
EXPECT_TRUE(G.external_symbols().empty());
EXPECT_TRUE(G.absolute_symbols().empty());
EXPECT_TRUE(G.defined_symbols().empty());
Expand All @@ -75,7 +75,7 @@ TEST(LinkGraphTest, Construction) {

TEST(LinkGraphTest, AddressAccess) {
// Check that we can get addresses for blocks, symbols, and edges.
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, support::little,
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, llvm::endianness::little,
getGenericEdgeKindName);

auto &Sec1 =
Expand All @@ -94,7 +94,7 @@ TEST(LinkGraphTest, AddressAccess) {

TEST(LinkGraphTest, SectionEmpty) {
// Check that Section::empty behaves as expected.
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, support::little,
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, llvm::endianness::little,
getGenericEdgeKindName);
auto &Sec1 =
G.createSection("__data.1", orc::MemProt::Read | orc::MemProt::Write);
Expand All @@ -112,7 +112,7 @@ TEST(LinkGraphTest, SectionEmpty) {

TEST(LinkGraphTest, BlockAndSymbolIteration) {
// Check that we can iterate over blocks within Sections and across sections.
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, support::little,
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, llvm::endianness::little,
getGenericEdgeKindName);
auto &Sec1 =
G.createSection("__data.1", orc::MemProt::Read | orc::MemProt::Write);
Expand Down Expand Up @@ -165,7 +165,7 @@ TEST(LinkGraphTest, BlockAndSymbolIteration) {

TEST(LinkGraphTest, ContentAccessAndUpdate) {
// Check that we can make a defined symbol external.
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, support::little,
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, llvm::endianness::little,
getGenericEdgeKindName);
auto &Sec =
G.createSection("__data", orc::MemProt::Read | orc::MemProt::Write);
Expand Down Expand Up @@ -254,7 +254,7 @@ TEST(LinkGraphTest, ContentAccessAndUpdate) {

TEST(LinkGraphTest, MakeExternal) {
// Check that we can make defined and absolute symbols external.
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, support::little,
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, llvm::endianness::little,
getGenericEdgeKindName);
auto &Sec =
G.createSection("__data", orc::MemProt::Read | orc::MemProt::Write);
Expand Down Expand Up @@ -324,7 +324,7 @@ TEST(LinkGraphTest, MakeExternal) {

TEST(LinkGraphTest, MakeAbsolute) {
// Check that we can make defined and external symbols absolute.
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, support::little,
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, llvm::endianness::little,
getGenericEdgeKindName);
auto &Sec =
G.createSection("__data", orc::MemProt::Read | orc::MemProt::Write);
Expand Down Expand Up @@ -393,7 +393,7 @@ TEST(LinkGraphTest, MakeAbsolute) {

TEST(LinkGraphTest, MakeDefined) {
// Check that we can make an external symbol defined.
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, support::little,
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, llvm::endianness::little,
getGenericEdgeKindName);
auto &Sec =
G.createSection("__data", orc::MemProt::Read | orc::MemProt::Write);
Expand Down Expand Up @@ -441,7 +441,7 @@ TEST(LinkGraphTest, MakeDefined) {

TEST(LinkGraphTest, TransferDefinedSymbol) {
// Check that we can transfer a defined symbol from one block to another.
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, support::little,
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, llvm::endianness::little,
getGenericEdgeKindName);
auto &Sec =
G.createSection("__data", orc::MemProt::Read | orc::MemProt::Write);
Expand Down Expand Up @@ -476,7 +476,7 @@ TEST(LinkGraphTest, TransferDefinedSymbol) {
TEST(LinkGraphTest, TransferDefinedSymbolAcrossSections) {
// Check that we can transfer a defined symbol from an existing block in one
// section to another.
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, support::little,
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, llvm::endianness::little,
getGenericEdgeKindName);
auto &Sec1 =
G.createSection("__data.1", orc::MemProt::Read | orc::MemProt::Write);
Expand Down Expand Up @@ -510,7 +510,7 @@ TEST(LinkGraphTest, TransferDefinedSymbolAcrossSections) {
TEST(LinkGraphTest, TransferBlock) {
// Check that we can transfer a block (and all associated symbols) from one
// section to another.
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, support::little,
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, llvm::endianness::little,
getGenericEdgeKindName);
auto &Sec1 =
G.createSection("__data.1", orc::MemProt::Read | orc::MemProt::Write);
Expand Down Expand Up @@ -558,7 +558,7 @@ TEST(LinkGraphTest, TransferBlock) {
TEST(LinkGraphTest, MergeSections) {
// Check that we can transfer a block (and all associated symbols) from one
// section to another.
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, support::little,
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, llvm::endianness::little,
getGenericEdgeKindName);
auto &Sec1 =
G.createSection("__data.1", orc::MemProt::Read | orc::MemProt::Write);
Expand Down Expand Up @@ -644,7 +644,7 @@ TEST(LinkGraphTest, MergeSections) {

TEST(LinkGraphTest, SplitBlock) {
// Check that the LinkGraph::splitBlock test works as expected.
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, support::little,
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, llvm::endianness::little,
getGenericEdgeKindName);
auto &Sec =
G.createSection("__data", orc::MemProt::Read | orc::MemProt::Write);
Expand Down Expand Up @@ -740,7 +740,7 @@ TEST(LinkGraphTest, SplitBlock) {
}

TEST(LinkGraphTest, GraphAllocationMethods) {
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, support::little,
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, llvm::endianness::little,
getGenericEdgeKindName);

// Test allocation of sized, uninitialized buffer.
Expand All @@ -761,7 +761,7 @@ TEST(LinkGraphTest, GraphAllocationMethods) {

TEST(LinkGraphTest, IsCStringBlockTest) {
// Check that the LinkGraph::splitBlock test works as expected.
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, support::little,
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, llvm::endianness::little,
getGenericEdgeKindName);
auto &Sec =
G.createSection("__data", orc::MemProt::Read | orc::MemProt::Write);
Expand All @@ -786,7 +786,7 @@ TEST(LinkGraphTest, IsCStringBlockTest) {

TEST(LinkGraphTest, BasicLayoutHonorsNoAlloc) {
// Check that BasicLayout honors NoAlloc.
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, support::little,
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, llvm::endianness::little,
getGenericEdgeKindName);

// Create a regular section and block.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ using namespace llvm::jitlink;
TEST(MemoryManagerErrorTest, ErrorOnFirstAllocate) {
// Check that we can get addresses for blocks, symbols, and edges.
auto G = std::make_unique<LinkGraph>("foo", Triple("x86_64-apple-darwin"), 8,
support::little, getGenericEdgeKindName);
llvm::endianness::little,
getGenericEdgeKindName);

ArrayRef<char> Content = "hello, world!";
auto &Sec =
Expand Down
12 changes: 6 additions & 6 deletions llvm/unittests/ExecutionEngine/JITLink/StubsTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ GenerateStub(LinkGraph &G, size_t PointerSize, Edge::Kind PointerEdgeKind) {
TEST(StubsTest, StubsGeneration_x86_64) {
const char PointerJumpStubContent[6] = {
static_cast<char>(0xFFu), 0x25, 0x00, 0x00, 0x00, 0x00};
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, support::little,
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, llvm::endianness::little,
getGenericEdgeKindName);
auto [PointerSym, StubSym] = GenerateStub(G, 8U, x86_64::Pointer64);

Expand All @@ -80,7 +80,7 @@ TEST(StubsTest, StubsGeneration_aarch64) {
0x10, 0x02, 0x40, (char)0xf9u, // LDR x16, [x16, <imm>@pageoff12]
0x00, 0x02, 0x1f, (char)0xd6u // BR x16
};
LinkGraph G("foo", Triple("aarch64-linux-gnu"), 8, support::little,
LinkGraph G("foo", Triple("aarch64-linux-gnu"), 8, llvm::endianness::little,
getGenericEdgeKindName);
auto [PointerSym, StubSym] = GenerateStub(G, 8U, aarch64::Pointer64);

Expand All @@ -100,8 +100,8 @@ TEST(StubsTest, StubsGeneration_aarch64) {
TEST(StubsTest, StubsGeneration_i386) {
const char PointerJumpStubContent[6] = {
static_cast<char>(0xFFu), 0x25, 0x00, 0x00, 0x00, 0x00};
LinkGraph G("foo", Triple("i386-unknown-linux-gnu"), 4, support::little,
getGenericEdgeKindName);
LinkGraph G("foo", Triple("i386-unknown-linux-gnu"), 4,
llvm::endianness::little, getGenericEdgeKindName);
auto [PointerSym, StubSym] = GenerateStub(G, 4U, i386::Pointer32);

EXPECT_EQ(std::distance(StubSym.getBlock().edges().begin(),
Expand Down Expand Up @@ -129,7 +129,7 @@ TEST(StubsTest, StubsGeneration_loongarch32) {
0x00,
0x4c // jr $t8
};
LinkGraph G("foo", Triple("loongarch32"), 4, support::little,
LinkGraph G("foo", Triple("loongarch32"), 4, llvm::endianness::little,
getGenericEdgeKindName);
auto [PointerSym, StubSym] = GenerateStub(G, 4U, loongarch::Pointer32);

Expand Down Expand Up @@ -161,7 +161,7 @@ TEST(StubsTest, StubsGeneration_loongarch64) {
0x00,
0x4c // jr $t8
};
LinkGraph G("foo", Triple("loongarch64"), 8, support::little,
LinkGraph G("foo", Triple("loongarch64"), 8, llvm::endianness::little,
getGenericEdgeKindName);
auto [PointerSym, StubSym] = GenerateStub(G, 8U, loongarch::Pointer64);

Expand Down
18 changes: 9 additions & 9 deletions llvm/unittests/ExecutionEngine/Orc/ObjectLinkingLayerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ class ObjectLinkingLayerTest : public testing::Test {
};

TEST_F(ObjectLinkingLayerTest, AddLinkGraph) {
auto G =
std::make_unique<LinkGraph>("foo", Triple("x86_64-apple-darwin"), 8,
support::little, x86_64::getEdgeKindName);
auto G = std::make_unique<LinkGraph>("foo", Triple("x86_64-apple-darwin"), 8,
llvm::endianness::little,
x86_64::getEdgeKindName);

auto &Sec1 = G->createSection("__data", MemProt::Read | MemProt::Write);
auto &B1 = G->createContentBlock(Sec1, BlockContent,
Expand Down Expand Up @@ -104,9 +104,9 @@ TEST_F(ObjectLinkingLayerTest, ClaimLateDefinedWeakSymbols) {

ObjLinkingLayer.addPlugin(std::make_unique<TestPlugin>());

auto G =
std::make_unique<LinkGraph>("foo", Triple("x86_64-apple-darwin"), 8,
support::little, x86_64::getEdgeKindName);
auto G = std::make_unique<LinkGraph>("foo", Triple("x86_64-apple-darwin"), 8,
llvm::endianness::little,
x86_64::getEdgeKindName);

auto &DataSec = G->createSection("__data", MemProt::Read | MemProt::Write);
auto &DataBlock = G->createContentBlock(DataSec, BlockContent,
Expand Down Expand Up @@ -158,9 +158,9 @@ TEST_F(ObjectLinkingLayerTest, HandleErrorDuringPostAllocationPass) {

ObjLinkingLayer.addPlugin(std::make_unique<TestPlugin>());

auto G =
std::make_unique<LinkGraph>("foo", Triple("x86_64-apple-darwin"), 8,
support::little, x86_64::getEdgeKindName);
auto G = std::make_unique<LinkGraph>("foo", Triple("x86_64-apple-darwin"), 8,
llvm::endianness::little,
x86_64::getEdgeKindName);

auto &DataSec = G->createSection("__data", MemProt::Read | MemProt::Write);
auto &DataBlock = G->createContentBlock(DataSec, BlockContent,
Expand Down
4 changes: 2 additions & 2 deletions llvm/unittests/MC/StringTableBuilderTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ TEST(StringTableBuilderTest, BasicWinCOFF) {

std::string Expected;

ExpectedSize =
support::endian::byte_swap<uint32_t, support::little>(ExpectedSize);
ExpectedSize = support::endian::byte_swap<uint32_t, llvm::endianness::little>(
ExpectedSize);
Expected.append((const char*)&ExpectedSize, 4);
Expected += "pygmy hippopotamus";
Expected += '\x00';
Expand Down
6 changes: 3 additions & 3 deletions llvm/unittests/ProfileData/InstrProfTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -844,13 +844,13 @@ TEST_P(MaybeSparseInstrProfTest, get_icall_data_read_write_big_endian) {
Writer.addRecord({"callee3", 0x1235, {3, 4}}, Err);

// Set big endian output.
Writer.setValueProfDataEndianness(support::big);
Writer.setValueProfDataEndianness(llvm::endianness::big);

auto Profile = Writer.writeBuffer();
readProfile(std::move(Profile));

// Set big endian input.
Reader->setValueProfDataEndianness(support::big);
Reader->setValueProfDataEndianness(llvm::endianness::big);

Expected<InstrProfRecord> R = Reader->getInstrProfRecord("caller", 0x1234);
EXPECT_THAT_ERROR(R.takeError(), Succeeded());
Expand All @@ -867,7 +867,7 @@ TEST_P(MaybeSparseInstrProfTest, get_icall_data_read_write_big_endian) {
ASSERT_EQ(StringRef((const char *)VD[2].Value, 7), StringRef("callee1"));

// Restore little endian default:
Writer.setValueProfDataEndianness(support::little);
Writer.setValueProfDataEndianness(llvm::endianness::little);
}

TEST_P(MaybeSparseInstrProfTest, get_icall_data_merge1) {
Expand Down
4 changes: 2 additions & 2 deletions llvm/unittests/Support/ARMAttributeParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ bool testBuildAttr(unsigned Tag, unsigned Value,
reinterpret_cast<const uint8_t*>(OS.str().c_str()), OS.str().size());

ARMAttributeParser Parser;
cantFail(Parser.parse(Bytes, support::little));
cantFail(Parser.parse(Bytes, llvm::endianness::little));

std::optional<unsigned> Attr = Parser.getAttributeValue(ExpectedTag);
return Attr && *Attr == ExpectedValue;
}

void testParseError(ArrayRef<uint8_t> bytes, const char *msg) {
ARMAttributeParser parser;
Error e = parser.parse(bytes, support::little);
Error e = parser.parse(bytes, llvm::endianness::little);
EXPECT_STREQ(toString(std::move(e)).c_str(), msg);
}

Expand Down
8 changes: 4 additions & 4 deletions llvm/unittests/Support/BinaryStreamTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ TEST_F(BinaryStreamTest, StreamRefBounds) {

TEST_F(BinaryStreamTest, StreamRefDynamicSize) {
StringRef Strings[] = {"1", "2", "3", "4"};
AppendingBinaryByteStream Stream(support::little);
AppendingBinaryByteStream Stream(llvm::endianness::little);

BinaryStreamWriter Writer(Stream);
BinaryStreamReader Reader(Stream);
Expand Down Expand Up @@ -320,7 +320,7 @@ TEST_F(BinaryStreamTest, DropOperations) {
initializeInput(InputData, 1);

ArrayRef<uint8_t> Result;
BinaryStreamRef Original(InputData, support::little);
BinaryStreamRef Original(InputData, llvm::endianness::little);
ASSERT_EQ(InputData.size(), Original.getLength());

EXPECT_THAT_ERROR(Original.readBytes(0, InputData.size(), Result),
Expand Down Expand Up @@ -835,7 +835,7 @@ TEST_F(BinaryStreamTest, StreamWriterPadToAlignment) {
// This test may seem excessive but it is checking for past bugs and corner
// cases by making sure that the stream is allowed to grow and that
// both multiple pad chunks and single chunk extensions work.
AppendingBinaryByteStream Stream(support::little);
AppendingBinaryByteStream Stream(llvm::endianness::little);
BinaryStreamWriter Writer(Stream);

// Offset 0: '0'
Expand Down Expand Up @@ -874,7 +874,7 @@ TEST_F(BinaryStreamTest, StreamWriterPadToAlignment) {

TEST_F(BinaryStreamTest, StreamWriterAppend) {
StringRef Strings[] = {"First", "Second", "Third", "Fourth"};
AppendingBinaryByteStream Stream(support::little);
AppendingBinaryByteStream Stream(llvm::endianness::little);
BinaryStreamWriter Writer(Stream);

for (auto &Str : Strings) {
Expand Down
6 changes: 3 additions & 3 deletions llvm/unittests/Support/CSKYAttributeParserTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static bool testAttributeInt(unsigned Tag, unsigned Value, unsigned ExpectedTag,
OS.str().size());

CSKYAttributeParser Parser;
cantFail(Parser.parse(Bytes, support::little));
cantFail(Parser.parse(Bytes, llvm::endianness::little));

std::optional<unsigned> Attr = Parser.getAttributeValue(ExpectedTag);
return Attr && *Attr == ExpectedValue;
Expand All @@ -98,7 +98,7 @@ static bool testAttributeString(unsigned Tag, const char *Value,
OS.str().size());

CSKYAttributeParser Parser;
cantFail(Parser.parse(Bytes, support::little));
cantFail(Parser.parse(Bytes, llvm::endianness::little));

std::optional<StringRef> Attr = Parser.getAttributeString(ExpectedTag);
return Attr && *Attr == ExpectedValue;
Expand All @@ -113,7 +113,7 @@ static void testParseError(unsigned Tag, unsigned Value, const char *msg) {
OS.str().size());

CSKYAttributeParser Parser;
Error e = Parser.parse(Bytes, support::little);
Error e = Parser.parse(Bytes, llvm::endianness::little);
EXPECT_STREQ(toString(std::move(e)).c_str(), msg);
}

Expand Down
2 changes: 1 addition & 1 deletion llvm/unittests/Support/ELFAttributeParserTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AttributeHeaderParser : public ELFAttributeParser {

static void testParseError(ArrayRef<uint8_t> bytes, const char *msg) {
AttributeHeaderParser parser;
Error e = parser.parse(bytes, support::little);
Error e = parser.parse(bytes, llvm::endianness::little);
EXPECT_STREQ(toString(std::move(e)).c_str(), msg);
}

Expand Down
2 changes: 1 addition & 1 deletion llvm/unittests/Support/RISCVAttributeParserTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static bool testAttribute(unsigned Tag, unsigned Value, unsigned ExpectedTag,
OS.str().size());

RISCVAttributeParser Parser;
cantFail(Parser.parse(Bytes, support::little));
cantFail(Parser.parse(Bytes, llvm::endianness::little));

std::optional<unsigned> Attr = Parser.getAttributeValue(ExpectedTag);
return Attr && *Attr == ExpectedValue;
Expand Down