[llvm/unittests] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
This commit is contained in:
parent
b25362816d
commit
b6a01caa64
|
@ -196,7 +196,7 @@ MATCHER(Failed, "") { return !arg.Success(); }
|
||||||
|
|
||||||
template <typename InfoT>
|
template <typename InfoT>
|
||||||
testing::Matcher<const detail::ErrorHolder &> Failed() {
|
testing::Matcher<const detail::ErrorHolder &> Failed() {
|
||||||
return MakeMatcher(new detail::ErrorMatchesMono<InfoT>(None));
|
return MakeMatcher(new detail::ErrorMatchesMono<InfoT>(std::nullopt));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename InfoT, typename M>
|
template <typename InfoT, typename M>
|
||||||
|
|
|
@ -37,15 +37,15 @@ Annotations::Annotations(llvm::StringRef Text) {
|
||||||
All.push_back(
|
All.push_back(
|
||||||
{Code.size(), size_t(-1), Name.value_or(""), Payload.value_or("")});
|
{Code.size(), size_t(-1), Name.value_or(""), Payload.value_or("")});
|
||||||
Points[Name.value_or("")].push_back(All.size() - 1);
|
Points[Name.value_or("")].push_back(All.size() - 1);
|
||||||
Name = llvm::None;
|
Name = std::nullopt;
|
||||||
Payload = llvm::None;
|
Payload = std::nullopt;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (Text.consume_front("[[")) {
|
if (Text.consume_front("[[")) {
|
||||||
OpenRanges.push_back(
|
OpenRanges.push_back(
|
||||||
{Code.size(), size_t(-1), Name.value_or(""), Payload.value_or("")});
|
{Code.size(), size_t(-1), Name.value_or(""), Payload.value_or("")});
|
||||||
Name = llvm::None;
|
Name = std::nullopt;
|
||||||
Payload = llvm::None;
|
Payload = std::nullopt;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Require(!Name, "$name should be followed by ^ or [[");
|
Require(!Name, "$name should be followed by ^ or [[");
|
||||||
|
|
|
@ -2932,10 +2932,10 @@ TEST(APIntTest, MultiplicativeInverseExaustive) {
|
||||||
|
|
||||||
TEST(APIntTest, GetMostSignificantDifferentBit) {
|
TEST(APIntTest, GetMostSignificantDifferentBit) {
|
||||||
EXPECT_EQ(APIntOps::GetMostSignificantDifferentBit(APInt(8, 0), APInt(8, 0)),
|
EXPECT_EQ(APIntOps::GetMostSignificantDifferentBit(APInt(8, 0), APInt(8, 0)),
|
||||||
llvm::None);
|
std::nullopt);
|
||||||
EXPECT_EQ(
|
EXPECT_EQ(
|
||||||
APIntOps::GetMostSignificantDifferentBit(APInt(8, 42), APInt(8, 42)),
|
APIntOps::GetMostSignificantDifferentBit(APInt(8, 42), APInt(8, 42)),
|
||||||
llvm::None);
|
std::nullopt);
|
||||||
EXPECT_EQ(*APIntOps::GetMostSignificantDifferentBit(APInt(8, 0), APInt(8, 1)),
|
EXPECT_EQ(*APIntOps::GetMostSignificantDifferentBit(APInt(8, 0), APInt(8, 1)),
|
||||||
0u);
|
0u);
|
||||||
EXPECT_EQ(*APIntOps::GetMostSignificantDifferentBit(APInt(8, 0), APInt(8, 2)),
|
EXPECT_EQ(*APIntOps::GetMostSignificantDifferentBit(APInt(8, 0), APInt(8, 2)),
|
||||||
|
@ -2945,7 +2945,7 @@ TEST(APIntTest, GetMostSignificantDifferentBit) {
|
||||||
EXPECT_EQ(*APIntOps::GetMostSignificantDifferentBit(APInt(8, 1), APInt(8, 0)),
|
EXPECT_EQ(*APIntOps::GetMostSignificantDifferentBit(APInt(8, 1), APInt(8, 0)),
|
||||||
0u);
|
0u);
|
||||||
EXPECT_EQ(APIntOps::GetMostSignificantDifferentBit(APInt(8, 1), APInt(8, 1)),
|
EXPECT_EQ(APIntOps::GetMostSignificantDifferentBit(APInt(8, 1), APInt(8, 1)),
|
||||||
llvm::None);
|
std::nullopt);
|
||||||
EXPECT_EQ(*APIntOps::GetMostSignificantDifferentBit(APInt(8, 1), APInt(8, 2)),
|
EXPECT_EQ(*APIntOps::GetMostSignificantDifferentBit(APInt(8, 1), APInt(8, 2)),
|
||||||
1u);
|
1u);
|
||||||
EXPECT_EQ(*APIntOps::GetMostSignificantDifferentBit(APInt(8, 1), APInt(8, 3)),
|
EXPECT_EQ(*APIntOps::GetMostSignificantDifferentBit(APInt(8, 1), APInt(8, 3)),
|
||||||
|
@ -2960,7 +2960,7 @@ TEST(APIntTest, GetMostSignificantDifferentBitExaustive) {
|
||||||
[](const APInt &V0, const APInt &V1) -> llvm::Optional<unsigned> {
|
[](const APInt &V0, const APInt &V1) -> llvm::Optional<unsigned> {
|
||||||
assert(V0.getBitWidth() == V1.getBitWidth() && "Must have same bitwidth");
|
assert(V0.getBitWidth() == V1.getBitWidth() && "Must have same bitwidth");
|
||||||
if (V0 == V1)
|
if (V0 == V1)
|
||||||
return llvm::None; // Bitwise identical.
|
return std::nullopt; // Bitwise identical.
|
||||||
// There is a mismatch. Let's find the most significant different bit.
|
// There is a mismatch. Let's find the most significant different bit.
|
||||||
for (int Bit = V0.getBitWidth() - 1; Bit >= 0; --Bit) {
|
for (int Bit = V0.getBitWidth() - 1; Bit >= 0; --Bit) {
|
||||||
if (V0[Bit] == V1[Bit])
|
if (V0[Bit] == V1[Bit])
|
||||||
|
|
|
@ -481,7 +481,7 @@ TEST(ZipIteratorTest, ZipLongestBasic) {
|
||||||
const vector<tuple<Optional<unsigned>, Optional<StringRef>>> expected{
|
const vector<tuple<Optional<unsigned>, Optional<StringRef>>> expected{
|
||||||
make_tuple(3, StringRef("2")), make_tuple(1, StringRef("7")),
|
make_tuple(3, StringRef("2")), make_tuple(1, StringRef("7")),
|
||||||
make_tuple(4, StringRef("1")), make_tuple(1, StringRef("8")),
|
make_tuple(4, StringRef("1")), make_tuple(1, StringRef("8")),
|
||||||
make_tuple(5, None), make_tuple(9, None)};
|
make_tuple(5, std::nullopt), make_tuple(9, std::nullopt)};
|
||||||
size_t iters = 0;
|
size_t iters = 0;
|
||||||
for (auto tup : zip_longest(pi, e)) {
|
for (auto tup : zip_longest(pi, e)) {
|
||||||
EXPECT_EQ(tup, expected[iters]);
|
EXPECT_EQ(tup, expected[iters]);
|
||||||
|
@ -495,7 +495,7 @@ TEST(ZipIteratorTest, ZipLongestBasic) {
|
||||||
const vector<tuple<Optional<StringRef>, Optional<unsigned>>> expected{
|
const vector<tuple<Optional<StringRef>, Optional<unsigned>>> expected{
|
||||||
make_tuple(StringRef("2"), 3), make_tuple(StringRef("7"), 1),
|
make_tuple(StringRef("2"), 3), make_tuple(StringRef("7"), 1),
|
||||||
make_tuple(StringRef("1"), 4), make_tuple(StringRef("8"), 1),
|
make_tuple(StringRef("1"), 4), make_tuple(StringRef("8"), 1),
|
||||||
make_tuple(None, 5), make_tuple(None, 9)};
|
make_tuple(std::nullopt, 5), make_tuple(std::nullopt, 9)};
|
||||||
size_t iters = 0;
|
size_t iters = 0;
|
||||||
for (auto tup : zip_longest(e, pi)) {
|
for (auto tup : zip_longest(e, pi)) {
|
||||||
EXPECT_EQ(tup, expected[iters]);
|
EXPECT_EQ(tup, expected[iters]);
|
||||||
|
|
|
@ -680,12 +680,12 @@ void CheckRelation(const Optional<T> &Lhs, const Optional<T> &Rhs,
|
||||||
if (Lhs)
|
if (Lhs)
|
||||||
EXPECT_EQ(Expected, OperatorT::apply(*Lhs, Rhs));
|
EXPECT_EQ(Expected, OperatorT::apply(*Lhs, Rhs));
|
||||||
else
|
else
|
||||||
EXPECT_EQ(Expected, OperatorT::apply(None, Rhs));
|
EXPECT_EQ(Expected, OperatorT::apply(std::nullopt, Rhs));
|
||||||
|
|
||||||
if (Rhs)
|
if (Rhs)
|
||||||
EXPECT_EQ(Expected, OperatorT::apply(Lhs, *Rhs));
|
EXPECT_EQ(Expected, OperatorT::apply(Lhs, *Rhs));
|
||||||
else
|
else
|
||||||
EXPECT_EQ(Expected, OperatorT::apply(Lhs, None));
|
EXPECT_EQ(Expected, OperatorT::apply(Lhs, std::nullopt));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct EqualityMock {};
|
struct EqualityMock {};
|
||||||
|
@ -800,7 +800,7 @@ TEST(OptionalTest, StreamOperator) {
|
||||||
};
|
};
|
||||||
EXPECT_EQ("ComparableAndStreamable",
|
EXPECT_EQ("ComparableAndStreamable",
|
||||||
to_string(ComparableAndStreamable::get()));
|
to_string(ComparableAndStreamable::get()));
|
||||||
EXPECT_EQ("None", to_string(None));
|
EXPECT_EQ("None", to_string(std::nullopt));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Comparable {
|
struct Comparable {
|
||||||
|
|
|
@ -192,17 +192,17 @@ TEST_F(AliasAnalysisTest, getModRefInfo) {
|
||||||
|
|
||||||
// Check basic results
|
// Check basic results
|
||||||
EXPECT_EQ(AA.getModRefInfo(Store1, MemoryLocation()), ModRefInfo::Mod);
|
EXPECT_EQ(AA.getModRefInfo(Store1, MemoryLocation()), ModRefInfo::Mod);
|
||||||
EXPECT_EQ(AA.getModRefInfo(Store1, None), ModRefInfo::Mod);
|
EXPECT_EQ(AA.getModRefInfo(Store1, std::nullopt), ModRefInfo::Mod);
|
||||||
EXPECT_EQ(AA.getModRefInfo(Load1, MemoryLocation()), ModRefInfo::Ref);
|
EXPECT_EQ(AA.getModRefInfo(Load1, MemoryLocation()), ModRefInfo::Ref);
|
||||||
EXPECT_EQ(AA.getModRefInfo(Load1, None), ModRefInfo::Ref);
|
EXPECT_EQ(AA.getModRefInfo(Load1, std::nullopt), ModRefInfo::Ref);
|
||||||
EXPECT_EQ(AA.getModRefInfo(Add1, MemoryLocation()), ModRefInfo::NoModRef);
|
EXPECT_EQ(AA.getModRefInfo(Add1, MemoryLocation()), ModRefInfo::NoModRef);
|
||||||
EXPECT_EQ(AA.getModRefInfo(Add1, None), ModRefInfo::NoModRef);
|
EXPECT_EQ(AA.getModRefInfo(Add1, std::nullopt), ModRefInfo::NoModRef);
|
||||||
EXPECT_EQ(AA.getModRefInfo(VAArg1, MemoryLocation()), ModRefInfo::ModRef);
|
EXPECT_EQ(AA.getModRefInfo(VAArg1, MemoryLocation()), ModRefInfo::ModRef);
|
||||||
EXPECT_EQ(AA.getModRefInfo(VAArg1, None), ModRefInfo::ModRef);
|
EXPECT_EQ(AA.getModRefInfo(VAArg1, std::nullopt), ModRefInfo::ModRef);
|
||||||
EXPECT_EQ(AA.getModRefInfo(CmpXChg1, MemoryLocation()), ModRefInfo::ModRef);
|
EXPECT_EQ(AA.getModRefInfo(CmpXChg1, MemoryLocation()), ModRefInfo::ModRef);
|
||||||
EXPECT_EQ(AA.getModRefInfo(CmpXChg1, None), ModRefInfo::ModRef);
|
EXPECT_EQ(AA.getModRefInfo(CmpXChg1, std::nullopt), ModRefInfo::ModRef);
|
||||||
EXPECT_EQ(AA.getModRefInfo(AtomicRMW, MemoryLocation()), ModRefInfo::ModRef);
|
EXPECT_EQ(AA.getModRefInfo(AtomicRMW, MemoryLocation()), ModRefInfo::ModRef);
|
||||||
EXPECT_EQ(AA.getModRefInfo(AtomicRMW, None), ModRefInfo::ModRef);
|
EXPECT_EQ(AA.getModRefInfo(AtomicRMW, std::nullopt), ModRefInfo::ModRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Instruction *getInstructionByName(Function &F, StringRef Name) {
|
static Instruction *getInstructionByName(Function &F, StringRef Name) {
|
||||||
|
|
|
@ -271,7 +271,7 @@ TEST(LoopInfoTest, CanonicalLoop) {
|
||||||
EXPECT_NE(L, nullptr);
|
EXPECT_NE(L, nullptr);
|
||||||
|
|
||||||
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
||||||
EXPECT_NE(Bounds, None);
|
EXPECT_NE(Bounds, std::nullopt);
|
||||||
ConstantInt *InitialIVValue =
|
ConstantInt *InitialIVValue =
|
||||||
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
||||||
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
||||||
|
@ -330,7 +330,7 @@ TEST(LoopInfoTest, LoopWithInverseGuardSuccs) {
|
||||||
EXPECT_NE(L, nullptr);
|
EXPECT_NE(L, nullptr);
|
||||||
|
|
||||||
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
||||||
EXPECT_NE(Bounds, None);
|
EXPECT_NE(Bounds, std::nullopt);
|
||||||
ConstantInt *InitialIVValue =
|
ConstantInt *InitialIVValue =
|
||||||
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
||||||
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
||||||
|
@ -389,7 +389,7 @@ TEST(LoopInfoTest, LoopWithSwappedGuardCmp) {
|
||||||
EXPECT_NE(L, nullptr);
|
EXPECT_NE(L, nullptr);
|
||||||
|
|
||||||
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
||||||
EXPECT_NE(Bounds, None);
|
EXPECT_NE(Bounds, std::nullopt);
|
||||||
ConstantInt *InitialIVValue =
|
ConstantInt *InitialIVValue =
|
||||||
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
||||||
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
||||||
|
@ -448,7 +448,7 @@ TEST(LoopInfoTest, LoopWithInverseLatchSuccs) {
|
||||||
EXPECT_NE(L, nullptr);
|
EXPECT_NE(L, nullptr);
|
||||||
|
|
||||||
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
||||||
EXPECT_NE(Bounds, None);
|
EXPECT_NE(Bounds, std::nullopt);
|
||||||
ConstantInt *InitialIVValue =
|
ConstantInt *InitialIVValue =
|
||||||
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
||||||
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
||||||
|
@ -507,7 +507,7 @@ TEST(LoopInfoTest, LoopWithLatchCmpNE) {
|
||||||
EXPECT_NE(L, nullptr);
|
EXPECT_NE(L, nullptr);
|
||||||
|
|
||||||
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
||||||
EXPECT_NE(Bounds, None);
|
EXPECT_NE(Bounds, std::nullopt);
|
||||||
ConstantInt *InitialIVValue =
|
ConstantInt *InitialIVValue =
|
||||||
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
||||||
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
||||||
|
@ -567,7 +567,7 @@ TEST(LoopInfoTest, LoopWithGuardCmpSLE) {
|
||||||
EXPECT_NE(L, nullptr);
|
EXPECT_NE(L, nullptr);
|
||||||
|
|
||||||
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
||||||
EXPECT_NE(Bounds, None);
|
EXPECT_NE(Bounds, std::nullopt);
|
||||||
ConstantInt *InitialIVValue =
|
ConstantInt *InitialIVValue =
|
||||||
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
||||||
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
||||||
|
@ -626,7 +626,7 @@ TEST(LoopInfoTest, LoopNonConstantStep) {
|
||||||
EXPECT_NE(L, nullptr);
|
EXPECT_NE(L, nullptr);
|
||||||
|
|
||||||
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
||||||
EXPECT_NE(Bounds, None);
|
EXPECT_NE(Bounds, std::nullopt);
|
||||||
ConstantInt *InitialIVValue =
|
ConstantInt *InitialIVValue =
|
||||||
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
||||||
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
||||||
|
@ -682,7 +682,7 @@ TEST(LoopInfoTest, LoopUnsignedBounds) {
|
||||||
EXPECT_NE(L, nullptr);
|
EXPECT_NE(L, nullptr);
|
||||||
|
|
||||||
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
||||||
EXPECT_NE(Bounds, None);
|
EXPECT_NE(Bounds, std::nullopt);
|
||||||
ConstantInt *InitialIVValue =
|
ConstantInt *InitialIVValue =
|
||||||
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
||||||
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
||||||
|
@ -741,7 +741,7 @@ TEST(LoopInfoTest, DecreasingLoop) {
|
||||||
EXPECT_NE(L, nullptr);
|
EXPECT_NE(L, nullptr);
|
||||||
|
|
||||||
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
||||||
EXPECT_NE(Bounds, None);
|
EXPECT_NE(Bounds, std::nullopt);
|
||||||
EXPECT_EQ(Bounds->getInitialIVValue().getName(), "ub");
|
EXPECT_EQ(Bounds->getInitialIVValue().getName(), "ub");
|
||||||
EXPECT_EQ(Bounds->getStepInst().getName(), "inc");
|
EXPECT_EQ(Bounds->getStepInst().getName(), "inc");
|
||||||
ConstantInt *StepValue =
|
ConstantInt *StepValue =
|
||||||
|
@ -801,7 +801,7 @@ TEST(LoopInfoTest, CannotFindDirection) {
|
||||||
EXPECT_NE(L, nullptr);
|
EXPECT_NE(L, nullptr);
|
||||||
|
|
||||||
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
||||||
EXPECT_NE(Bounds, None);
|
EXPECT_NE(Bounds, std::nullopt);
|
||||||
ConstantInt *InitialIVValue =
|
ConstantInt *InitialIVValue =
|
||||||
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
||||||
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
||||||
|
@ -861,7 +861,7 @@ TEST(LoopInfoTest, ZextIndVar) {
|
||||||
EXPECT_NE(L, nullptr);
|
EXPECT_NE(L, nullptr);
|
||||||
|
|
||||||
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
||||||
EXPECT_NE(Bounds, None);
|
EXPECT_NE(Bounds, std::nullopt);
|
||||||
ConstantInt *InitialIVValue =
|
ConstantInt *InitialIVValue =
|
||||||
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
||||||
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
||||||
|
@ -922,7 +922,7 @@ TEST(LoopInfoTest, MultiExitingLoop) {
|
||||||
EXPECT_NE(L, nullptr);
|
EXPECT_NE(L, nullptr);
|
||||||
|
|
||||||
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
||||||
EXPECT_NE(Bounds, None);
|
EXPECT_NE(Bounds, std::nullopt);
|
||||||
ConstantInt *InitialIVValue =
|
ConstantInt *InitialIVValue =
|
||||||
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
||||||
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
||||||
|
@ -982,7 +982,7 @@ TEST(LoopInfoTest, MultiExitLoop) {
|
||||||
EXPECT_NE(L, nullptr);
|
EXPECT_NE(L, nullptr);
|
||||||
|
|
||||||
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
||||||
EXPECT_NE(Bounds, None);
|
EXPECT_NE(Bounds, std::nullopt);
|
||||||
ConstantInt *InitialIVValue =
|
ConstantInt *InitialIVValue =
|
||||||
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
||||||
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
||||||
|
@ -1034,7 +1034,7 @@ TEST(LoopInfoTest, UnguardedLoop) {
|
||||||
EXPECT_NE(L, nullptr);
|
EXPECT_NE(L, nullptr);
|
||||||
|
|
||||||
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
||||||
EXPECT_NE(Bounds, None);
|
EXPECT_NE(Bounds, std::nullopt);
|
||||||
ConstantInt *InitialIVValue =
|
ConstantInt *InitialIVValue =
|
||||||
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
||||||
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
||||||
|
@ -1092,7 +1092,7 @@ TEST(LoopInfoTest, UnguardedLoopWithControlFlow) {
|
||||||
EXPECT_NE(L, nullptr);
|
EXPECT_NE(L, nullptr);
|
||||||
|
|
||||||
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
||||||
EXPECT_NE(Bounds, None);
|
EXPECT_NE(Bounds, std::nullopt);
|
||||||
ConstantInt *InitialIVValue =
|
ConstantInt *InitialIVValue =
|
||||||
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
||||||
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
||||||
|
@ -1163,7 +1163,7 @@ TEST(LoopInfoTest, LoopNest) {
|
||||||
EXPECT_NE(L, nullptr);
|
EXPECT_NE(L, nullptr);
|
||||||
|
|
||||||
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
||||||
EXPECT_NE(Bounds, None);
|
EXPECT_NE(Bounds, std::nullopt);
|
||||||
ConstantInt *InitialIVValue =
|
ConstantInt *InitialIVValue =
|
||||||
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
||||||
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
||||||
|
@ -1189,7 +1189,7 @@ TEST(LoopInfoTest, LoopNest) {
|
||||||
EXPECT_NE(L, nullptr);
|
EXPECT_NE(L, nullptr);
|
||||||
|
|
||||||
Optional<Loop::LoopBounds> InnerBounds = L->getBounds(SE);
|
Optional<Loop::LoopBounds> InnerBounds = L->getBounds(SE);
|
||||||
EXPECT_NE(InnerBounds, None);
|
EXPECT_NE(InnerBounds, std::nullopt);
|
||||||
InitialIVValue =
|
InitialIVValue =
|
||||||
dyn_cast<ConstantInt>(&InnerBounds->getInitialIVValue());
|
dyn_cast<ConstantInt>(&InnerBounds->getInitialIVValue());
|
||||||
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
||||||
|
@ -1256,7 +1256,7 @@ TEST(LoopInfoTest, AuxiliaryIV) {
|
||||||
EXPECT_NE(L, nullptr);
|
EXPECT_NE(L, nullptr);
|
||||||
|
|
||||||
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
|
||||||
EXPECT_NE(Bounds, None);
|
EXPECT_NE(Bounds, std::nullopt);
|
||||||
ConstantInt *InitialIVValue =
|
ConstantInt *InitialIVValue =
|
||||||
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
|
||||||
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
|
||||||
|
|
|
@ -29,7 +29,8 @@ TEST(AllocSize, AllocationBuiltinsTest) {
|
||||||
FunctionType::get(Type::getInt8PtrTy(Context), {ArgTy}, false),
|
FunctionType::get(Type::getInt8PtrTy(Context), {ArgTy}, false),
|
||||||
GlobalValue::ExternalLinkage, "F", &M);
|
GlobalValue::ExternalLinkage, "F", &M);
|
||||||
|
|
||||||
AllocSizeFn->addFnAttr(Attribute::getWithAllocSizeArgs(Context, 1, None));
|
AllocSizeFn->addFnAttr(
|
||||||
|
Attribute::getWithAllocSizeArgs(Context, 1, std::nullopt));
|
||||||
|
|
||||||
// 100 is arbitrary.
|
// 100 is arbitrary.
|
||||||
std::unique_ptr<CallInst> Caller(
|
std::unique_ptr<CallInst> Caller(
|
||||||
|
|
|
@ -1151,7 +1151,7 @@ TEST_F(ScalarEvolutionsTest, SCEVComputeConstantDifference) {
|
||||||
auto diff = [&SE](const SCEV *LHS, const SCEV *RHS) -> Optional<int> {
|
auto diff = [&SE](const SCEV *LHS, const SCEV *RHS) -> Optional<int> {
|
||||||
auto ConstantDiffOrNone = computeConstantDifference(SE, LHS, RHS);
|
auto ConstantDiffOrNone = computeConstantDifference(SE, LHS, RHS);
|
||||||
if (!ConstantDiffOrNone)
|
if (!ConstantDiffOrNone)
|
||||||
return None;
|
return std::nullopt;
|
||||||
|
|
||||||
auto ExtDiff = ConstantDiffOrNone->getSExtValue();
|
auto ExtDiff = ConstantDiffOrNone->getSExtValue();
|
||||||
int Diff = ExtDiff;
|
int Diff = ExtDiff;
|
||||||
|
@ -1170,9 +1170,9 @@ TEST_F(ScalarEvolutionsTest, SCEVComputeConstantDifference) {
|
||||||
EXPECT_EQ(diff(ScevIV, ScevIVNext), -1);
|
EXPECT_EQ(diff(ScevIV, ScevIVNext), -1);
|
||||||
EXPECT_EQ(diff(ScevIVNext, ScevIV), 1);
|
EXPECT_EQ(diff(ScevIVNext, ScevIV), 1);
|
||||||
EXPECT_EQ(diff(ScevIVNext, ScevIVNext), 0);
|
EXPECT_EQ(diff(ScevIVNext, ScevIVNext), 0);
|
||||||
EXPECT_EQ(diff(ScevV0, ScevIV), None);
|
EXPECT_EQ(diff(ScevV0, ScevIV), std::nullopt);
|
||||||
EXPECT_EQ(diff(ScevIVNext, ScevV3), None);
|
EXPECT_EQ(diff(ScevIVNext, ScevV3), std::nullopt);
|
||||||
EXPECT_EQ(diff(ScevYY, ScevV3), None);
|
EXPECT_EQ(diff(ScevYY, ScevV3), std::nullopt);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1323,7 +1323,7 @@ TEST_F(ValueTrackingTest, IsImpliedConditionAnd) {
|
||||||
const DataLayout &DL = M->getDataLayout();
|
const DataLayout &DL = M->getDataLayout();
|
||||||
EXPECT_EQ(isImpliedCondition(A, A2, DL), true);
|
EXPECT_EQ(isImpliedCondition(A, A2, DL), true);
|
||||||
EXPECT_EQ(isImpliedCondition(A, A3, DL), false);
|
EXPECT_EQ(isImpliedCondition(A, A3, DL), false);
|
||||||
EXPECT_EQ(isImpliedCondition(A, A4, DL), None);
|
EXPECT_EQ(isImpliedCondition(A, A4, DL), std::nullopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ValueTrackingTest, IsImpliedConditionAnd2) {
|
TEST_F(ValueTrackingTest, IsImpliedConditionAnd2) {
|
||||||
|
@ -1342,7 +1342,7 @@ TEST_F(ValueTrackingTest, IsImpliedConditionAnd2) {
|
||||||
const DataLayout &DL = M->getDataLayout();
|
const DataLayout &DL = M->getDataLayout();
|
||||||
EXPECT_EQ(isImpliedCondition(A, A2, DL), true);
|
EXPECT_EQ(isImpliedCondition(A, A2, DL), true);
|
||||||
EXPECT_EQ(isImpliedCondition(A, A3, DL), false);
|
EXPECT_EQ(isImpliedCondition(A, A3, DL), false);
|
||||||
EXPECT_EQ(isImpliedCondition(A, A4, DL), None);
|
EXPECT_EQ(isImpliedCondition(A, A4, DL), std::nullopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ValueTrackingTest, IsImpliedConditionAndVec) {
|
TEST_F(ValueTrackingTest, IsImpliedConditionAndVec) {
|
||||||
|
@ -1373,7 +1373,7 @@ TEST_F(ValueTrackingTest, IsImpliedConditionOr) {
|
||||||
const DataLayout &DL = M->getDataLayout();
|
const DataLayout &DL = M->getDataLayout();
|
||||||
EXPECT_EQ(isImpliedCondition(A, A2, DL, false), false);
|
EXPECT_EQ(isImpliedCondition(A, A2, DL, false), false);
|
||||||
EXPECT_EQ(isImpliedCondition(A, A3, DL, false), true);
|
EXPECT_EQ(isImpliedCondition(A, A3, DL, false), true);
|
||||||
EXPECT_EQ(isImpliedCondition(A, A4, DL, false), None);
|
EXPECT_EQ(isImpliedCondition(A, A4, DL, false), std::nullopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ValueTrackingTest, IsImpliedConditionOr2) {
|
TEST_F(ValueTrackingTest, IsImpliedConditionOr2) {
|
||||||
|
@ -1392,7 +1392,7 @@ TEST_F(ValueTrackingTest, IsImpliedConditionOr2) {
|
||||||
const DataLayout &DL = M->getDataLayout();
|
const DataLayout &DL = M->getDataLayout();
|
||||||
EXPECT_EQ(isImpliedCondition(A, A2, DL, false), false);
|
EXPECT_EQ(isImpliedCondition(A, A2, DL, false), false);
|
||||||
EXPECT_EQ(isImpliedCondition(A, A3, DL, false), true);
|
EXPECT_EQ(isImpliedCondition(A, A3, DL, false), true);
|
||||||
EXPECT_EQ(isImpliedCondition(A, A4, DL, false), None);
|
EXPECT_EQ(isImpliedCondition(A, A4, DL, false), std::nullopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ComputeKnownBitsTest, KnownNonZeroShift) {
|
TEST_F(ComputeKnownBitsTest, KnownNonZeroShift) {
|
||||||
|
|
|
@ -41,8 +41,8 @@ protected:
|
||||||
|
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
|
TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
|
||||||
T->createTargetMachine("AArch64", "", "+sve", Options, None, None,
|
T->createTargetMachine("AArch64", "", "+sve", Options, std::nullopt,
|
||||||
CodeGenOpt::Aggressive)));
|
std::nullopt, CodeGenOpt::Aggressive)));
|
||||||
if (!TM)
|
if (!TM)
|
||||||
GTEST_SKIP();
|
GTEST_SKIP();
|
||||||
|
|
||||||
|
@ -594,7 +594,7 @@ TEST_F(AArch64SelectionDAGTest, ReplaceAllUsesWith) {
|
||||||
EXPECT_FALSE(DAG->getHeapAllocSite(N2.getNode()));
|
EXPECT_FALSE(DAG->getHeapAllocSite(N2.getNode()));
|
||||||
EXPECT_FALSE(DAG->getNoMergeSiteInfo(N2.getNode()));
|
EXPECT_FALSE(DAG->getNoMergeSiteInfo(N2.getNode()));
|
||||||
EXPECT_FALSE(DAG->getPCSections(N2.getNode()));
|
EXPECT_FALSE(DAG->getPCSections(N2.getNode()));
|
||||||
MDNode *MD = MDNode::get(Context, None);
|
MDNode *MD = MDNode::get(Context, std::nullopt);
|
||||||
DAG->addHeapAllocSite(N2.getNode(), MD);
|
DAG->addHeapAllocSite(N2.getNode(), MD);
|
||||||
DAG->addNoMergeSiteInfo(N2.getNode(), true);
|
DAG->addNoMergeSiteInfo(N2.getNode(), true);
|
||||||
DAG->addPCSections(N2.getNode(), MD);
|
DAG->addPCSections(N2.getNode(), MD);
|
||||||
|
|
|
@ -58,7 +58,7 @@ protected:
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
TM = std::unique_ptr<LLVMTargetMachine>(
|
TM = std::unique_ptr<LLVMTargetMachine>(
|
||||||
static_cast<LLVMTargetMachine *>(T->createTargetMachine(
|
static_cast<LLVMTargetMachine *>(T->createTargetMachine(
|
||||||
"amdgcn--amdpal", "gfx1010", "", Options, None)));
|
"amdgcn--amdpal", "gfx1010", "", Options, std::nullopt)));
|
||||||
if (!TM)
|
if (!TM)
|
||||||
GTEST_SKIP();
|
GTEST_SKIP();
|
||||||
|
|
||||||
|
|
|
@ -38,9 +38,9 @@ AArch64GISelMITest::createTargetMachine() const {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
return std::unique_ptr<LLVMTargetMachine>(
|
return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
|
||||||
static_cast<LLVMTargetMachine *>(T->createTargetMachine(
|
T->createTargetMachine("AArch64", "", "", Options, std::nullopt,
|
||||||
"AArch64", "", "", Options, None, None, CodeGenOpt::Aggressive)));
|
std::nullopt, CodeGenOpt::Aggressive)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AArch64GISelMITest::getTargetTestModuleString(SmallString<512> &S,
|
void AArch64GISelMITest::getTargetTestModuleString(SmallString<512> &S,
|
||||||
|
@ -76,10 +76,10 @@ AMDGPUGISelMITest::createTargetMachine() const {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
return std::unique_ptr<LLVMTargetMachine>(
|
return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
|
||||||
static_cast<LLVMTargetMachine *>(T->createTargetMachine(
|
T->createTargetMachine("amdgcn-amd-amdhsa", "gfx900", "", Options,
|
||||||
"amdgcn-amd-amdhsa", "gfx900", "", Options, None, None,
|
std::nullopt, std::nullopt,
|
||||||
CodeGenOpt::Aggressive)));
|
CodeGenOpt::Aggressive)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMDGPUGISelMITest::getTargetTestModuleString(
|
void AMDGPUGISelMITest::getTargetTestModuleString(
|
||||||
|
|
|
@ -79,9 +79,9 @@ public:
|
||||||
GTEST_SKIP();
|
GTEST_SKIP();
|
||||||
|
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
Machine = std::unique_ptr<TargetMachine>(
|
Machine = std::unique_ptr<TargetMachine>(T->createTargetMachine(
|
||||||
T->createTargetMachine(Triple::normalize("x86_64--"), "", "", Options,
|
Triple::normalize("x86_64--"), "", "", Options, std::nullopt,
|
||||||
None, None, CodeGenOpt::Aggressive));
|
std::nullopt, CodeGenOpt::Aggressive));
|
||||||
|
|
||||||
auto Type = FunctionType::get(Type::getVoidTy(Ctx), false);
|
auto Type = FunctionType::get(Type::getVoidTy(Ctx), false);
|
||||||
auto F =
|
auto F =
|
||||||
|
@ -100,7 +100,8 @@ public:
|
||||||
OurFile = DIB.createFile("xyzzy.c", "/cave");
|
OurFile = DIB.createFile("xyzzy.c", "/cave");
|
||||||
OurCU =
|
OurCU =
|
||||||
DIB.createCompileUnit(dwarf::DW_LANG_C99, OurFile, "nou", false, "", 0);
|
DIB.createCompileUnit(dwarf::DW_LANG_C99, OurFile, "nou", false, "", 0);
|
||||||
auto OurSubT = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
|
auto OurSubT =
|
||||||
|
DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
|
||||||
OurFunc =
|
OurFunc =
|
||||||
DIB.createFunction(OurCU, "bees", "", OurFile, 1, OurSubT, 1,
|
DIB.createFunction(OurCU, "bees", "", OurFile, 1, OurSubT, 1,
|
||||||
DINode::FlagZero, DISubprogram::SPFlagDefinition);
|
DINode::FlagZero, DISubprogram::SPFlagDefinition);
|
||||||
|
@ -1814,7 +1815,7 @@ TEST_F(InstrRefLDVTest, pickVPHILocDiamond) {
|
||||||
DbgOpID RaxPHIInBlk3ID = addValueDbgOp(RaxPHIInBlk3);
|
DbgOpID RaxPHIInBlk3ID = addValueDbgOp(RaxPHIInBlk3);
|
||||||
DbgOpID ConstZeroID = addConstDbgOp(MachineOperand::CreateImm(0));
|
DbgOpID ConstZeroID = addConstDbgOp(MachineOperand::CreateImm(0));
|
||||||
|
|
||||||
DebugVariable Var(FuncVariable, None, nullptr);
|
DebugVariable Var(FuncVariable, std::nullopt, nullptr);
|
||||||
DbgValueProperties EmptyProps(EmptyExpr, false, false);
|
DbgValueProperties EmptyProps(EmptyExpr, false, false);
|
||||||
DIExpression *TwoOpExpr =
|
DIExpression *TwoOpExpr =
|
||||||
DIExpression::get(Ctx, {dwarf::DW_OP_LLVM_arg, 0, dwarf::DW_OP_LLVM_arg,
|
DIExpression::get(Ctx, {dwarf::DW_OP_LLVM_arg, 0, dwarf::DW_OP_LLVM_arg,
|
||||||
|
@ -2008,7 +2009,7 @@ TEST_F(InstrRefLDVTest, pickVPHILocLoops) {
|
||||||
DbgOpID RspPHIInBlk1ID = addValueDbgOp(RspPHIInBlk1);
|
DbgOpID RspPHIInBlk1ID = addValueDbgOp(RspPHIInBlk1);
|
||||||
DbgOpID RaxPHIInBlk1ID = addValueDbgOp(RaxPHIInBlk1);
|
DbgOpID RaxPHIInBlk1ID = addValueDbgOp(RaxPHIInBlk1);
|
||||||
|
|
||||||
DebugVariable Var(FuncVariable, None, nullptr);
|
DebugVariable Var(FuncVariable, std::nullopt, nullptr);
|
||||||
DbgValueProperties EmptyProps(EmptyExpr, false, false);
|
DbgValueProperties EmptyProps(EmptyExpr, false, false);
|
||||||
DIExpression *TwoOpExpr =
|
DIExpression *TwoOpExpr =
|
||||||
DIExpression::get(Ctx, {dwarf::DW_OP_LLVM_arg, 0, dwarf::DW_OP_LLVM_arg,
|
DIExpression::get(Ctx, {dwarf::DW_OP_LLVM_arg, 0, dwarf::DW_OP_LLVM_arg,
|
||||||
|
@ -2143,7 +2144,7 @@ TEST_F(InstrRefLDVTest, pickVPHILocBadlyNestedLoops) {
|
||||||
addValueDbgOp(RaxPHIInBlk1);
|
addValueDbgOp(RaxPHIInBlk1);
|
||||||
DbgOpID RbxPHIInBlk1ID = addValueDbgOp(RbxPHIInBlk1);
|
DbgOpID RbxPHIInBlk1ID = addValueDbgOp(RbxPHIInBlk1);
|
||||||
|
|
||||||
DebugVariable Var(FuncVariable, None, nullptr);
|
DebugVariable Var(FuncVariable, std::nullopt, nullptr);
|
||||||
DbgValueProperties EmptyProps(EmptyExpr, false, false);
|
DbgValueProperties EmptyProps(EmptyExpr, false, false);
|
||||||
SmallVector<DbgValue, 32> VLiveOuts;
|
SmallVector<DbgValue, 32> VLiveOuts;
|
||||||
VLiveOuts.resize(5, DbgValue(EmptyProps, DbgValue::Undef));
|
VLiveOuts.resize(5, DbgValue(EmptyProps, DbgValue::Undef));
|
||||||
|
@ -2277,7 +2278,7 @@ TEST_F(InstrRefLDVTest, vlocJoinDiamond) {
|
||||||
DbgOpID LiveInRspID = DbgOpID(false, 0);
|
DbgOpID LiveInRspID = DbgOpID(false, 0);
|
||||||
DbgOpID LiveInRaxID = DbgOpID(false, 1);
|
DbgOpID LiveInRaxID = DbgOpID(false, 1);
|
||||||
|
|
||||||
DebugVariable Var(FuncVariable, None, nullptr);
|
DebugVariable Var(FuncVariable, std::nullopt, nullptr);
|
||||||
DbgValueProperties EmptyProps(EmptyExpr, false, false);
|
DbgValueProperties EmptyProps(EmptyExpr, false, false);
|
||||||
SmallVector<DbgValue, 32> VLiveOuts;
|
SmallVector<DbgValue, 32> VLiveOuts;
|
||||||
VLiveOuts.resize(4, DbgValue(EmptyProps, DbgValue::Undef));
|
VLiveOuts.resize(4, DbgValue(EmptyProps, DbgValue::Undef));
|
||||||
|
@ -2461,7 +2462,7 @@ TEST_F(InstrRefLDVTest, vlocJoinLoops) {
|
||||||
DbgOpID LiveInRspID = DbgOpID(false, 0);
|
DbgOpID LiveInRspID = DbgOpID(false, 0);
|
||||||
DbgOpID LiveInRaxID = DbgOpID(false, 1);
|
DbgOpID LiveInRaxID = DbgOpID(false, 1);
|
||||||
|
|
||||||
DebugVariable Var(FuncVariable, None, nullptr);
|
DebugVariable Var(FuncVariable, std::nullopt, nullptr);
|
||||||
DbgValueProperties EmptyProps(EmptyExpr, false, false);
|
DbgValueProperties EmptyProps(EmptyExpr, false, false);
|
||||||
SmallVector<DbgValue, 32> VLiveOuts;
|
SmallVector<DbgValue, 32> VLiveOuts;
|
||||||
VLiveOuts.resize(3, DbgValue(EmptyProps, DbgValue::Undef));
|
VLiveOuts.resize(3, DbgValue(EmptyProps, DbgValue::Undef));
|
||||||
|
@ -2562,7 +2563,7 @@ TEST_F(InstrRefLDVTest, vlocJoinBadlyNestedLoops) {
|
||||||
DbgOpID LiveInRaxID = DbgOpID(false, 1);
|
DbgOpID LiveInRaxID = DbgOpID(false, 1);
|
||||||
DbgOpID LiveInRbxID = DbgOpID(false, 2);
|
DbgOpID LiveInRbxID = DbgOpID(false, 2);
|
||||||
|
|
||||||
DebugVariable Var(FuncVariable, None, nullptr);
|
DebugVariable Var(FuncVariable, std::nullopt, nullptr);
|
||||||
DbgValueProperties EmptyProps(EmptyExpr, false, false);
|
DbgValueProperties EmptyProps(EmptyExpr, false, false);
|
||||||
SmallVector<DbgValue, 32> VLiveOuts;
|
SmallVector<DbgValue, 32> VLiveOuts;
|
||||||
VLiveOuts.resize(5, DbgValue(EmptyProps, DbgValue::Undef));
|
VLiveOuts.resize(5, DbgValue(EmptyProps, DbgValue::Undef));
|
||||||
|
@ -2648,7 +2649,7 @@ TEST_F(InstrRefLDVTest, VLocSingleBlock) {
|
||||||
DbgOpID LiveInRspID = addValueDbgOp(LiveInRsp);
|
DbgOpID LiveInRspID = addValueDbgOp(LiveInRsp);
|
||||||
MInLocs[0][0] = MOutLocs[0][0] = LiveInRsp;
|
MInLocs[0][0] = MOutLocs[0][0] = LiveInRsp;
|
||||||
|
|
||||||
DebugVariable Var(FuncVariable, None, nullptr);
|
DebugVariable Var(FuncVariable, std::nullopt, nullptr);
|
||||||
DbgValueProperties EmptyProps(EmptyExpr, false, false);
|
DbgValueProperties EmptyProps(EmptyExpr, false, false);
|
||||||
|
|
||||||
SmallSet<DebugVariable, 4> AllVars;
|
SmallSet<DebugVariable, 4> AllVars;
|
||||||
|
@ -2711,7 +2712,7 @@ TEST_F(InstrRefLDVTest, VLocDiamondBlocks) {
|
||||||
initValueArray(MInLocs, 4, 2);
|
initValueArray(MInLocs, 4, 2);
|
||||||
initValueArray(MOutLocs, 4, 2);
|
initValueArray(MOutLocs, 4, 2);
|
||||||
|
|
||||||
DebugVariable Var(FuncVariable, None, nullptr);
|
DebugVariable Var(FuncVariable, std::nullopt, nullptr);
|
||||||
DbgValueProperties EmptyProps(EmptyExpr, false, false);
|
DbgValueProperties EmptyProps(EmptyExpr, false, false);
|
||||||
|
|
||||||
SmallSet<DebugVariable, 4> AllVars;
|
SmallSet<DebugVariable, 4> AllVars;
|
||||||
|
@ -2933,7 +2934,7 @@ TEST_F(InstrRefLDVTest, VLocSimpleLoop) {
|
||||||
initValueArray(MInLocs, 3, 2);
|
initValueArray(MInLocs, 3, 2);
|
||||||
initValueArray(MOutLocs, 3, 2);
|
initValueArray(MOutLocs, 3, 2);
|
||||||
|
|
||||||
DebugVariable Var(FuncVariable, None, nullptr);
|
DebugVariable Var(FuncVariable, std::nullopt, nullptr);
|
||||||
DbgValueProperties EmptyProps(EmptyExpr, false, false);
|
DbgValueProperties EmptyProps(EmptyExpr, false, false);
|
||||||
DIExpression *TwoOpExpr =
|
DIExpression *TwoOpExpr =
|
||||||
DIExpression::get(Ctx, {dwarf::DW_OP_LLVM_arg, 0, dwarf::DW_OP_LLVM_arg,
|
DIExpression::get(Ctx, {dwarf::DW_OP_LLVM_arg, 0, dwarf::DW_OP_LLVM_arg,
|
||||||
|
@ -3212,7 +3213,7 @@ TEST_F(InstrRefLDVTest, VLocNestedLoop) {
|
||||||
initValueArray(MInLocs, 5, 2);
|
initValueArray(MInLocs, 5, 2);
|
||||||
initValueArray(MOutLocs, 5, 2);
|
initValueArray(MOutLocs, 5, 2);
|
||||||
|
|
||||||
DebugVariable Var(FuncVariable, None, nullptr);
|
DebugVariable Var(FuncVariable, std::nullopt, nullptr);
|
||||||
DbgValueProperties EmptyProps(EmptyExpr, false, false);
|
DbgValueProperties EmptyProps(EmptyExpr, false, false);
|
||||||
|
|
||||||
SmallSet<DebugVariable, 4> AllVars;
|
SmallSet<DebugVariable, 4> AllVars;
|
||||||
|
|
|
@ -102,7 +102,8 @@ public:
|
||||||
OurFile = DIB.createFile("xyzzy.c", "/cave");
|
OurFile = DIB.createFile("xyzzy.c", "/cave");
|
||||||
OurCU =
|
OurCU =
|
||||||
DIB.createCompileUnit(dwarf::DW_LANG_C99, OurFile, "nou", false, "", 0);
|
DIB.createCompileUnit(dwarf::DW_LANG_C99, OurFile, "nou", false, "", 0);
|
||||||
auto OurSubT = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
|
auto OurSubT =
|
||||||
|
DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
|
||||||
OurFunc =
|
OurFunc =
|
||||||
DIB.createFunction(OurCU, "bees", "", OurFile, 1, OurSubT, 1,
|
DIB.createFunction(OurCU, "bees", "", OurFile, 1, OurSubT, 1,
|
||||||
DINode::FlagZero, DISubprogram::SPFlagDefinition);
|
DINode::FlagZero, DISubprogram::SPFlagDefinition);
|
||||||
|
|
|
@ -32,8 +32,8 @@ public:
|
||||||
getCalleeSavedRegs(const MachineFunction *MF) const override {
|
getCalleeSavedRegs(const MachineFunction *MF) const override {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
ArrayRef<const uint32_t *> getRegMasks() const override { return None; }
|
ArrayRef<const uint32_t *> getRegMasks() const override { return std::nullopt; }
|
||||||
ArrayRef<const char *> getRegMaskNames() const override { return None; }
|
ArrayRef<const char *> getRegMaskNames() const override { return std::nullopt; }
|
||||||
BitVector getReservedRegs(const MachineFunction &MF) const override {
|
BitVector getReservedRegs(const MachineFunction &MF) const override {
|
||||||
return BitVector();
|
return BitVector();
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,8 +271,8 @@ TEST(MachineInstrExtraInfo, AddExtraInfo) {
|
||||||
MMOs.push_back(MMO);
|
MMOs.push_back(MMO);
|
||||||
MCSymbol *Sym1 = MC->createTempSymbol("pre_label", false);
|
MCSymbol *Sym1 = MC->createTempSymbol("pre_label", false);
|
||||||
MCSymbol *Sym2 = MC->createTempSymbol("post_label", false);
|
MCSymbol *Sym2 = MC->createTempSymbol("post_label", false);
|
||||||
MDNode *HAM = MDNode::getDistinct(Ctx, None);
|
MDNode *HAM = MDNode::getDistinct(Ctx, std::nullopt);
|
||||||
MDNode *PCS = MDNode::getDistinct(Ctx, None);
|
MDNode *PCS = MDNode::getDistinct(Ctx, std::nullopt);
|
||||||
|
|
||||||
ASSERT_TRUE(MI->memoperands_empty());
|
ASSERT_TRUE(MI->memoperands_empty());
|
||||||
ASSERT_FALSE(MI->getPreInstrSymbol());
|
ASSERT_FALSE(MI->getPreInstrSymbol());
|
||||||
|
@ -331,8 +331,8 @@ TEST(MachineInstrExtraInfo, ChangeExtraInfo) {
|
||||||
MMOs.push_back(MMO);
|
MMOs.push_back(MMO);
|
||||||
MCSymbol *Sym1 = MC->createTempSymbol("pre_label", false);
|
MCSymbol *Sym1 = MC->createTempSymbol("pre_label", false);
|
||||||
MCSymbol *Sym2 = MC->createTempSymbol("post_label", false);
|
MCSymbol *Sym2 = MC->createTempSymbol("post_label", false);
|
||||||
MDNode *HAM = MDNode::getDistinct(Ctx, None);
|
MDNode *HAM = MDNode::getDistinct(Ctx, std::nullopt);
|
||||||
MDNode *PCS = MDNode::getDistinct(Ctx, None);
|
MDNode *PCS = MDNode::getDistinct(Ctx, std::nullopt);
|
||||||
|
|
||||||
MI->setMemRefs(*MF, MMOs);
|
MI->setMemRefs(*MF, MMOs);
|
||||||
MI->setPreInstrSymbol(*MF, Sym1);
|
MI->setPreInstrSymbol(*MF, Sym1);
|
||||||
|
@ -373,8 +373,8 @@ TEST(MachineInstrExtraInfo, RemoveExtraInfo) {
|
||||||
MMOs.push_back(MMO);
|
MMOs.push_back(MMO);
|
||||||
MCSymbol *Sym1 = MC->createTempSymbol("pre_label", false);
|
MCSymbol *Sym1 = MC->createTempSymbol("pre_label", false);
|
||||||
MCSymbol *Sym2 = MC->createTempSymbol("post_label", false);
|
MCSymbol *Sym2 = MC->createTempSymbol("post_label", false);
|
||||||
MDNode *HAM = MDNode::getDistinct(Ctx, None);
|
MDNode *HAM = MDNode::getDistinct(Ctx, std::nullopt);
|
||||||
MDNode *PCS = MDNode::getDistinct(Ctx, None);
|
MDNode *PCS = MDNode::getDistinct(Ctx, std::nullopt);
|
||||||
|
|
||||||
MI->setMemRefs(*MF, MMOs);
|
MI->setMemRefs(*MF, MMOs);
|
||||||
MI->setPreInstrSymbol(*MF, Sym1);
|
MI->setPreInstrSymbol(*MF, Sym1);
|
||||||
|
@ -451,8 +451,8 @@ MATCHER_P(HasMIMetadata, MIMD, "") {
|
||||||
|
|
||||||
TEST(MachineInstrBuilder, BuildMI) {
|
TEST(MachineInstrBuilder, BuildMI) {
|
||||||
LLVMContext Ctx;
|
LLVMContext Ctx;
|
||||||
MDNode *PCS = MDNode::getDistinct(Ctx, None);
|
MDNode *PCS = MDNode::getDistinct(Ctx, std::nullopt);
|
||||||
MDNode *DI = MDNode::getDistinct(Ctx, None);
|
MDNode *DI = MDNode::getDistinct(Ctx, std::nullopt);
|
||||||
DebugLoc DL(DI);
|
DebugLoc DL(DI);
|
||||||
MIMetadata MIMD(DL, PCS);
|
MIMetadata MIMD(DL, PCS);
|
||||||
EXPECT_EQ(MIMD.getDL(), DL);
|
EXPECT_EQ(MIMD.getDL(), DL);
|
||||||
|
|
|
@ -197,8 +197,8 @@ public:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
TM.reset(TheTarget->createTargetMachine(TripleName, "", "",
|
TM.reset(TheTarget->createTargetMachine(TripleName, "", "", Options,
|
||||||
Options, None));
|
std::nullopt));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,8 @@ protected:
|
||||||
|
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
|
TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
|
||||||
T->createTargetMachine("AArch64", "", "+sve", Options, None, None,
|
T->createTargetMachine("AArch64", "", "+sve", Options, std::nullopt,
|
||||||
CodeGenOpt::Aggressive)));
|
std::nullopt, CodeGenOpt::Aggressive)));
|
||||||
if (!TM)
|
if (!TM)
|
||||||
GTEST_SKIP();
|
GTEST_SKIP();
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,9 @@ std::unique_ptr<TargetMachine> createTargetMachine(bool EnableIPRA) {
|
||||||
|
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
Options.EnableIPRA = EnableIPRA;
|
Options.EnableIPRA = EnableIPRA;
|
||||||
return std::unique_ptr<TargetMachine>(T->createTargetMachine(
|
return std::unique_ptr<TargetMachine>(
|
||||||
"X86", "", "", Options, None, None, CodeGenOpt::Aggressive));
|
T->createTargetMachine("X86", "", "", Options, std::nullopt, std::nullopt,
|
||||||
|
CodeGenOpt::Aggressive));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef std::function<void(bool)> TargetOptionsTest;
|
typedef std::function<void(bool)> TargetOptionsTest;
|
||||||
|
|
|
@ -50,7 +50,7 @@ llvm::Error TestAsmPrinter::init(const Target *TheTarget, StringRef TripleName,
|
||||||
uint16_t DwarfVersion,
|
uint16_t DwarfVersion,
|
||||||
dwarf::DwarfFormat DwarfFormat) {
|
dwarf::DwarfFormat DwarfFormat) {
|
||||||
TM.reset(TheTarget->createTargetMachine(TripleName, "", "", TargetOptions(),
|
TM.reset(TheTarget->createTargetMachine(TripleName, "", "", TargetOptions(),
|
||||||
None));
|
std::nullopt));
|
||||||
if (!TM)
|
if (!TM)
|
||||||
return make_error<StringError>("no target machine for target " + TripleName,
|
return make_error<StringError>("no target machine for target " + TripleName,
|
||||||
inconvertibleErrorCode());
|
inconvertibleErrorCode());
|
||||||
|
|
|
@ -32,8 +32,8 @@ dwarf::CIE createCIE(bool IsDWARF64, uint64_t Offset, uint64_t Length) {
|
||||||
/*AugmentationData=*/StringRef(),
|
/*AugmentationData=*/StringRef(),
|
||||||
/*FDEPointerEncoding=*/dwarf::DW_EH_PE_absptr,
|
/*FDEPointerEncoding=*/dwarf::DW_EH_PE_absptr,
|
||||||
/*LSDAPointerEncoding=*/dwarf::DW_EH_PE_omit,
|
/*LSDAPointerEncoding=*/dwarf::DW_EH_PE_omit,
|
||||||
/*Personality=*/None,
|
/*Personality=*/std::nullopt,
|
||||||
/*PersonalityEnc=*/None,
|
/*PersonalityEnc=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ TEST(DWARFDebugFrame, DumpDWARF64FDE) {
|
||||||
/*InitialLocation=*/0x5555abcdabcd,
|
/*InitialLocation=*/0x5555abcdabcd,
|
||||||
/*AddressRange=*/0x111111111111,
|
/*AddressRange=*/0x111111111111,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
expectDumpResult(TestFDE, /*IsEH=*/false,
|
expectDumpResult(TestFDE, /*IsEH=*/false,
|
||||||
"3333abcdabcd 00004444abcdabcd 00001111abcdabcd FDE "
|
"3333abcdabcd 00004444abcdabcd 00001111abcdabcd FDE "
|
||||||
|
@ -116,7 +116,7 @@ TEST(DWARFDebugFrame, DumpEH64FDE) {
|
||||||
/*InitialLocation=*/0x4444abcdabcd,
|
/*InitialLocation=*/0x4444abcdabcd,
|
||||||
/*AddressRange=*/0x111111111111,
|
/*AddressRange=*/0x111111111111,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
expectDumpResult(TestFDE, /*IsEH=*/true,
|
expectDumpResult(TestFDE, /*IsEH=*/true,
|
||||||
"1111abcdabcd 00002222abcdabcd 0033abcd FDE "
|
"1111abcdabcd 00002222abcdabcd 0033abcd FDE "
|
||||||
|
@ -124,7 +124,7 @@ TEST(DWARFDebugFrame, DumpEH64FDE) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static Error parseCFI(dwarf::CIE &C, ArrayRef<uint8_t> Instructions,
|
static Error parseCFI(dwarf::CIE &C, ArrayRef<uint8_t> Instructions,
|
||||||
Optional<uint64_t> Size = None) {
|
Optional<uint64_t> Size = std::nullopt) {
|
||||||
DWARFDataExtractor Data(Instructions, /*IsLittleEndian=*/true,
|
DWARFDataExtractor Data(Instructions, /*IsLittleEndian=*/true,
|
||||||
/*AddressSize=*/8);
|
/*AddressSize=*/8);
|
||||||
uint64_t Offset = 0;
|
uint64_t Offset = 0;
|
||||||
|
@ -478,7 +478,7 @@ TEST(DWARFDebugFrame, UnwindTableEmptyRows) {
|
||||||
/*InitialLocation=*/0x1000,
|
/*InitialLocation=*/0x1000,
|
||||||
/*AddressRange=*/0x1000,
|
/*AddressRange=*/0x1000,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
|
|
||||||
// Having an empty instructions list is fine.
|
// Having an empty instructions list is fine.
|
||||||
|
@ -517,7 +517,7 @@ TEST(DWARFDebugFrame, UnwindTableEmptyRows_NOPs) {
|
||||||
/*InitialLocation=*/0x1000,
|
/*InitialLocation=*/0x1000,
|
||||||
/*AddressRange=*/0x1000,
|
/*AddressRange=*/0x1000,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
|
|
||||||
// Make an FDE that has only DW_CFA_nop instructions.
|
// Make an FDE that has only DW_CFA_nop instructions.
|
||||||
|
@ -543,7 +543,7 @@ TEST(DWARFDebugFrame, UnwindTableErrorNonAscendingFDERows) {
|
||||||
/*InitialLocation=*/0x1000,
|
/*InitialLocation=*/0x1000,
|
||||||
/*AddressRange=*/0x1000,
|
/*AddressRange=*/0x1000,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
|
|
||||||
// Make a CIE that has a valid CFA definition.
|
// Make a CIE that has a valid CFA definition.
|
||||||
|
@ -585,7 +585,7 @@ TEST(DWARFDebugFrame, UnwindTableError_DW_CFA_restore_state) {
|
||||||
/*InitialLocation=*/0x1000,
|
/*InitialLocation=*/0x1000,
|
||||||
/*AddressRange=*/0x1000,
|
/*AddressRange=*/0x1000,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
|
|
||||||
// Make a CIE that has a valid CFA definition.
|
// Make a CIE that has a valid CFA definition.
|
||||||
|
@ -620,7 +620,7 @@ TEST(DWARFDebugFrame, UnwindTableError_DW_CFA_GNU_window_save) {
|
||||||
/*InitialLocation=*/0x1000,
|
/*InitialLocation=*/0x1000,
|
||||||
/*AddressRange=*/0x1000,
|
/*AddressRange=*/0x1000,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
|
|
||||||
// Make a CIE that has a valid CFA definition.
|
// Make a CIE that has a valid CFA definition.
|
||||||
|
@ -656,7 +656,7 @@ TEST(DWARFDebugFrame, UnwindTableError_DW_CFA_def_cfa_offset) {
|
||||||
/*InitialLocation=*/0x1000,
|
/*InitialLocation=*/0x1000,
|
||||||
/*AddressRange=*/0x1000,
|
/*AddressRange=*/0x1000,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
|
|
||||||
// Make a CIE that has an invalid CFA definition. We do this so we can try
|
// Make a CIE that has an invalid CFA definition. We do this so we can try
|
||||||
|
@ -691,7 +691,7 @@ TEST(DWARFDebugFrame, UnwindTableDefCFAOffsetSFCFAError) {
|
||||||
/*InitialLocation=*/0x1000,
|
/*InitialLocation=*/0x1000,
|
||||||
/*AddressRange=*/0x1000,
|
/*AddressRange=*/0x1000,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
|
|
||||||
// Make a CIE that has an invalid CFA definition. We do this so we can try
|
// Make a CIE that has an invalid CFA definition. We do this so we can try
|
||||||
|
@ -726,7 +726,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_def_cfa_register) {
|
||||||
/*InitialLocation=*/0x1000,
|
/*InitialLocation=*/0x1000,
|
||||||
/*AddressRange=*/0x1000,
|
/*AddressRange=*/0x1000,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
|
|
||||||
// Make a CIE that has only defines the CFA register with no offset. Some
|
// Make a CIE that has only defines the CFA register with no offset. Some
|
||||||
|
@ -766,7 +766,7 @@ TEST(DWARFDebugFrame, UnwindTableRowPushingOpcodes) {
|
||||||
/*InitialLocation=*/0x1000,
|
/*InitialLocation=*/0x1000,
|
||||||
/*AddressRange=*/0x1000,
|
/*AddressRange=*/0x1000,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
|
|
||||||
// Make a CIE that has a valid CFA definition and a single register unwind
|
// Make a CIE that has a valid CFA definition and a single register unwind
|
||||||
|
@ -854,7 +854,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_restore) {
|
||||||
/*InitialLocation=*/0x1000,
|
/*InitialLocation=*/0x1000,
|
||||||
/*AddressRange=*/0x1000,
|
/*AddressRange=*/0x1000,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
|
|
||||||
// Make a CIE that has a valid CFA definition and a single register unwind
|
// Make a CIE that has a valid CFA definition and a single register unwind
|
||||||
|
@ -917,7 +917,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_restore_extended) {
|
||||||
/*InitialLocation=*/0x1000,
|
/*InitialLocation=*/0x1000,
|
||||||
/*AddressRange=*/0x1000,
|
/*AddressRange=*/0x1000,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
|
|
||||||
// Make a CIE that has a valid CFA definition and a single register unwind
|
// Make a CIE that has a valid CFA definition and a single register unwind
|
||||||
|
@ -981,7 +981,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_offset) {
|
||||||
/*InitialLocation=*/0x1000,
|
/*InitialLocation=*/0x1000,
|
||||||
/*AddressRange=*/0x1000,
|
/*AddressRange=*/0x1000,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
|
|
||||||
// Make a CIE that has a valid CFA definition and a single register unwind
|
// Make a CIE that has a valid CFA definition and a single register unwind
|
||||||
|
@ -1037,7 +1037,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_val_offset) {
|
||||||
/*InitialLocation=*/0x1000,
|
/*InitialLocation=*/0x1000,
|
||||||
/*AddressRange=*/0x1000,
|
/*AddressRange=*/0x1000,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
|
|
||||||
// Make a CIE that has a valid CFA definition and a single register unwind
|
// Make a CIE that has a valid CFA definition and a single register unwind
|
||||||
|
@ -1088,7 +1088,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_nop) {
|
||||||
/*InitialLocation=*/0x1000,
|
/*InitialLocation=*/0x1000,
|
||||||
/*AddressRange=*/0x1000,
|
/*AddressRange=*/0x1000,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
|
|
||||||
// Make a CIE that has a valid CFA definition and a single register unwind
|
// Make a CIE that has a valid CFA definition and a single register unwind
|
||||||
|
@ -1134,7 +1134,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_remember_state) {
|
||||||
/*InitialLocation=*/0x1000,
|
/*InitialLocation=*/0x1000,
|
||||||
/*AddressRange=*/0x1000,
|
/*AddressRange=*/0x1000,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
|
|
||||||
// Make a CIE that has a valid CFA definition and a single register unwind
|
// Make a CIE that has a valid CFA definition and a single register unwind
|
||||||
|
@ -1231,7 +1231,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_undefined) {
|
||||||
/*InitialLocation=*/0x1000,
|
/*InitialLocation=*/0x1000,
|
||||||
/*AddressRange=*/0x1000,
|
/*AddressRange=*/0x1000,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
|
|
||||||
// Make a CIE that has a valid CFA definition and a single register unwind
|
// Make a CIE that has a valid CFA definition and a single register unwind
|
||||||
|
@ -1276,7 +1276,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_same_value) {
|
||||||
/*InitialLocation=*/0x1000,
|
/*InitialLocation=*/0x1000,
|
||||||
/*AddressRange=*/0x1000,
|
/*AddressRange=*/0x1000,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
|
|
||||||
// Make a CIE that has a valid CFA definition and a single register unwind
|
// Make a CIE that has a valid CFA definition and a single register unwind
|
||||||
|
@ -1320,7 +1320,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_register) {
|
||||||
/*InitialLocation=*/0x1000,
|
/*InitialLocation=*/0x1000,
|
||||||
/*AddressRange=*/0x1000,
|
/*AddressRange=*/0x1000,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
|
|
||||||
// Make a CIE that has a valid CFA definition and a single register unwind
|
// Make a CIE that has a valid CFA definition and a single register unwind
|
||||||
|
@ -1366,7 +1366,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_expression) {
|
||||||
/*InitialLocation=*/0x1000,
|
/*InitialLocation=*/0x1000,
|
||||||
/*AddressRange=*/0x1000,
|
/*AddressRange=*/0x1000,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
|
|
||||||
// Make a CIE that has a valid CFA definition and a single register unwind
|
// Make a CIE that has a valid CFA definition and a single register unwind
|
||||||
|
@ -1418,7 +1418,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_val_expression) {
|
||||||
/*InitialLocation=*/0x1000,
|
/*InitialLocation=*/0x1000,
|
||||||
/*AddressRange=*/0x1000,
|
/*AddressRange=*/0x1000,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
|
|
||||||
// Make a CIE that has a valid CFA definition and a single register unwind
|
// Make a CIE that has a valid CFA definition and a single register unwind
|
||||||
|
@ -1471,7 +1471,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_def_cfa) {
|
||||||
/*InitialLocation=*/0x1000,
|
/*InitialLocation=*/0x1000,
|
||||||
/*AddressRange=*/0x1000,
|
/*AddressRange=*/0x1000,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
|
|
||||||
// Make a CIE that has a valid CFA definition and a single register unwind
|
// Make a CIE that has a valid CFA definition and a single register unwind
|
||||||
|
@ -1567,7 +1567,7 @@ TEST(DWARFDebugFrame, UnwindTable_DW_CFA_LLVM_def_aspace_cfa) {
|
||||||
/*InitialLocation=*/0x1000,
|
/*InitialLocation=*/0x1000,
|
||||||
/*AddressRange=*/0x1000,
|
/*AddressRange=*/0x1000,
|
||||||
/*Cie=*/&TestCIE,
|
/*Cie=*/&TestCIE,
|
||||||
/*LSDAAddress=*/None,
|
/*LSDAAddress=*/std::nullopt,
|
||||||
/*Arch=*/Triple::x86_64);
|
/*Arch=*/Triple::x86_64);
|
||||||
|
|
||||||
// Make a CIE that has a valid CFA definition and a single register unwind
|
// Make a CIE that has a valid CFA definition and a single register unwind
|
||||||
|
|
|
@ -80,9 +80,9 @@ TEST(DWARFDie, getLocations) {
|
||||||
HasValue(testing::ElementsAre(DWARFLocationExpression{
|
HasValue(testing::ElementsAre(DWARFLocationExpression{
|
||||||
DWARFAddressRange{1, 3}, {}})));
|
DWARFAddressRange{1, 3}, {}})));
|
||||||
|
|
||||||
EXPECT_THAT_EXPECTED(
|
EXPECT_THAT_EXPECTED(Die.getLocations(DW_AT_data_member_location),
|
||||||
Die.getLocations(DW_AT_data_member_location),
|
HasValue(testing::ElementsAre(
|
||||||
HasValue(testing::ElementsAre(DWARFLocationExpression{None, {0x47}})));
|
DWARFLocationExpression{std::nullopt, {0x47}})));
|
||||||
|
|
||||||
EXPECT_THAT_EXPECTED(
|
EXPECT_THAT_EXPECTED(
|
||||||
Die.getLocations(DW_AT_vtable_elem_location),
|
Die.getLocations(DW_AT_vtable_elem_location),
|
||||||
|
|
|
@ -159,7 +159,7 @@ void DWARFExpressionCopyBytesTest::parseCFIsAndCheckExpression(
|
||||||
return Instr;
|
return Instr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return None;
|
return std::nullopt;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<DWARFContext> Ctx = DWARFContext::create(E);
|
std::unique_ptr<DWARFContext> Ctx = DWARFContext::create(E);
|
||||||
|
|
|
@ -14,8 +14,8 @@ using namespace llvm;
|
||||||
using object::SectionedAddress;
|
using object::SectionedAddress;
|
||||||
|
|
||||||
TEST(DWARFLocationExpression, Equality) {
|
TEST(DWARFLocationExpression, Equality) {
|
||||||
EXPECT_EQ((DWARFLocationExpression{None, {}}),
|
EXPECT_EQ((DWARFLocationExpression{std::nullopt, {}}),
|
||||||
(DWARFLocationExpression{None, {}}));
|
(DWARFLocationExpression{std::nullopt, {}}));
|
||||||
EXPECT_NE((DWARFLocationExpression{DWARFAddressRange{1, 47}, {}}),
|
EXPECT_NE((DWARFLocationExpression{DWARFAddressRange{1, 47}, {}}),
|
||||||
(DWARFLocationExpression{DWARFAddressRange{1, 48}, {}}));
|
(DWARFLocationExpression{DWARFAddressRange{1, 48}, {}}));
|
||||||
EXPECT_NE((DWARFLocationExpression{DWARFAddressRange{1, 47}, {}}),
|
EXPECT_NE((DWARFLocationExpression{DWARFAddressRange{1, 47}, {}}),
|
||||||
|
@ -23,7 +23,8 @@ TEST(DWARFLocationExpression, Equality) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DWARFLocationExpression, StreamingOperator) {
|
TEST(DWARFLocationExpression, StreamingOperator) {
|
||||||
EXPECT_EQ("None: 1, 2", to_string(DWARFLocationExpression{None, {1, 2}}));
|
EXPECT_EQ("None: 1, 2",
|
||||||
|
to_string(DWARFLocationExpression{std::nullopt, {1, 2}}));
|
||||||
EXPECT_EQ(
|
EXPECT_EQ(
|
||||||
"[0x0000000000000042, 0x0000000000000047): 1",
|
"[0x0000000000000042, 0x0000000000000047): 1",
|
||||||
to_string(DWARFLocationExpression{DWARFAddressRange{0x42, 0x47}, {1}}));
|
to_string(DWARFLocationExpression{DWARFAddressRange{0x42, 0x47}, {1}}));
|
||||||
|
|
|
@ -454,7 +454,7 @@ llvm::Error dwarfgen::Generator::init(Triple TheTriple, uint16_t V) {
|
||||||
inconvertibleErrorCode());
|
inconvertibleErrorCode());
|
||||||
|
|
||||||
TM.reset(TheTarget->createTargetMachine(TripleName, "", "", TargetOptions(),
|
TM.reset(TheTarget->createTargetMachine(TripleName, "", "", TargetOptions(),
|
||||||
None));
|
std::nullopt));
|
||||||
if (!TM)
|
if (!TM)
|
||||||
return make_error<StringError>("no target machine for target " + TripleName,
|
return make_error<StringError>("no target machine for target " + TripleName,
|
||||||
inconvertibleErrorCode());
|
inconvertibleErrorCode());
|
||||||
|
|
|
@ -980,7 +980,7 @@ TEST(GSYMTest, TestGsymCreatorEncodeErrors) {
|
||||||
// Verify errors are propagated when we try to encoding an invalid inline
|
// Verify errors are propagated when we try to encoding an invalid inline
|
||||||
// info.
|
// info.
|
||||||
GC.forEachFunctionInfo([](FunctionInfo &FI) -> bool {
|
GC.forEachFunctionInfo([](FunctionInfo &FI) -> bool {
|
||||||
FI.OptLineTable = llvm::None;
|
FI.OptLineTable = std::nullopt;
|
||||||
FI.Inline = InlineInfo(); // Invalid InlineInfo.
|
FI.Inline = InlineInfo(); // Invalid InlineInfo.
|
||||||
return false; // Stop iterating
|
return false; // Stop iterating
|
||||||
});
|
});
|
||||||
|
|
|
@ -30,67 +30,69 @@ Matcher<MarkupNode> isNode(StringRef Text, StringRef Tag = "",
|
||||||
Field("Fields", &MarkupNode::Fields, Fields));
|
Field("Fields", &MarkupNode::Fields, Fields));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(SymbolizerMarkup, NoLines) { EXPECT_EQ(MarkupParser{}.nextNode(), None); }
|
TEST(SymbolizerMarkup, NoLines) {
|
||||||
|
EXPECT_EQ(MarkupParser{}.nextNode(), std::nullopt);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(SymbolizerMarkup, LinesWithoutMarkup) {
|
TEST(SymbolizerMarkup, LinesWithoutMarkup) {
|
||||||
MarkupParser Parser;
|
MarkupParser Parser;
|
||||||
|
|
||||||
Parser.parseLine("text");
|
Parser.parseLine("text");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("text")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("text")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("discarded");
|
Parser.parseLine("discarded");
|
||||||
Parser.parseLine("kept");
|
Parser.parseLine("kept");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("kept")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("kept")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("text\n");
|
Parser.parseLine("text\n");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("text\n")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("text\n")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("text\r\n");
|
Parser.parseLine("text\r\n");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("text\r\n")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("text\r\n")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("{{{");
|
Parser.parseLine("{{{");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("{{{}}");
|
Parser.parseLine("{{{}}");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{}}")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{}}")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("{{}}}");
|
Parser.parseLine("{{}}}");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{}}}")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{}}}")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("{{{}}}");
|
Parser.parseLine("{{{}}}");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{}}}")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{}}}")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("{{{:field}}}");
|
Parser.parseLine("{{{:field}}}");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{:field}}}")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{:field}}}")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("{{{tag:");
|
Parser.parseLine("{{{tag:");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tag:")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tag:")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("{{{tag:field}}");
|
Parser.parseLine("{{{tag:field}}");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tag:field}}")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tag:field}}")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("a\033[2mb");
|
Parser.parseLine("a\033[2mb");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("a\033[2mb")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("a\033[2mb")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("a\033[38mb");
|
Parser.parseLine("a\033[38mb");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("a\033[38mb")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("a\033[38mb")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("a\033[4mb");
|
Parser.parseLine("a\033[4mb");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("a\033[4mb")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("a\033[4mb")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(SymbolizerMarkup, LinesWithMarkup) {
|
TEST(SymbolizerMarkup, LinesWithMarkup) {
|
||||||
|
@ -98,30 +100,30 @@ TEST(SymbolizerMarkup, LinesWithMarkup) {
|
||||||
|
|
||||||
Parser.parseLine("{{{tag}}}");
|
Parser.parseLine("{{{tag}}}");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tag}}}", "tag")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tag}}}", "tag")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("{{{tag:f1:f2:f3}}}");
|
Parser.parseLine("{{{tag:f1:f2:f3}}}");
|
||||||
EXPECT_THAT(Parser.nextNode(),
|
EXPECT_THAT(Parser.nextNode(),
|
||||||
testing::Optional(isNode("{{{tag:f1:f2:f3}}}", "tag",
|
testing::Optional(isNode("{{{tag:f1:f2:f3}}}", "tag",
|
||||||
ElementsAre("f1", "f2", "f3"))));
|
ElementsAre("f1", "f2", "f3"))));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("{{{tag:}}}");
|
Parser.parseLine("{{{tag:}}}");
|
||||||
EXPECT_THAT(Parser.nextNode(),
|
EXPECT_THAT(Parser.nextNode(),
|
||||||
testing::Optional(isNode("{{{tag:}}}", "tag", ElementsAre(""))));
|
testing::Optional(isNode("{{{tag:}}}", "tag", ElementsAre(""))));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("{{{tag:}}");
|
Parser.parseLine("{{{tag:}}");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tag:}}")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tag:}}")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("{{{t2g}}}");
|
Parser.parseLine("{{{t2g}}}");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{t2g}}}", "t2g")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{t2g}}}", "t2g")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("{{{tAg}}}");
|
Parser.parseLine("{{{tAg}}}");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tAg}}}", "tAg")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tAg}}}", "tAg")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("a{{{b}}}c{{{d}}}e");
|
Parser.parseLine("a{{{b}}}c{{{d}}}e");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("a")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("a")));
|
||||||
|
@ -129,12 +131,12 @@ TEST(SymbolizerMarkup, LinesWithMarkup) {
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("c")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("c")));
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{d}}}", "d")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{d}}}", "d")));
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("e")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("e")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("{{{}}}{{{tag}}}");
|
Parser.parseLine("{{{}}}{{{tag}}}");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{}}}")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{}}}")));
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tag}}}", "tag")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tag}}}", "tag")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("\033[0mA\033[1mB\033[30mC\033[37m");
|
Parser.parseLine("\033[0mA\033[1mB\033[30mC\033[37m");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("\033[0m")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("\033[0m")));
|
||||||
|
@ -144,13 +146,13 @@ TEST(SymbolizerMarkup, LinesWithMarkup) {
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("\033[30m")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("\033[30m")));
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("C")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("C")));
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("\033[37m")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("\033[37m")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("{{{tag:\033[0m}}}");
|
Parser.parseLine("{{{tag:\033[0m}}}");
|
||||||
EXPECT_THAT(Parser.nextNode(),
|
EXPECT_THAT(Parser.nextNode(),
|
||||||
testing::Optional(
|
testing::Optional(
|
||||||
isNode("{{{tag:\033[0m}}}", "tag", ElementsAre("\033[0m"))));
|
isNode("{{{tag:\033[0m}}}", "tag", ElementsAre("\033[0m"))));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(SymbolizerMarkup, MultilineElements) {
|
TEST(SymbolizerMarkup, MultilineElements) {
|
||||||
|
@ -158,64 +160,64 @@ TEST(SymbolizerMarkup, MultilineElements) {
|
||||||
|
|
||||||
Parser.parseLine("{{{tag:");
|
Parser.parseLine("{{{tag:");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tag:")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tag:")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("{{{first:");
|
Parser.parseLine("{{{first:");
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
Parser.parseLine("}}}{{{second:");
|
Parser.parseLine("}}}{{{second:");
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
Parser.nextNode(),
|
Parser.nextNode(),
|
||||||
testing::Optional(isNode("{{{first:}}}", "first", ElementsAre(""))));
|
testing::Optional(isNode("{{{first:}}}", "first", ElementsAre(""))));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
Parser.parseLine("}}}");
|
Parser.parseLine("}}}");
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
Parser.nextNode(),
|
Parser.nextNode(),
|
||||||
testing::Optional(isNode("{{{second:}}}", "second", ElementsAre(""))));
|
testing::Optional(isNode("{{{second:}}}", "second", ElementsAre(""))));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("{{{before{{{first:");
|
Parser.parseLine("{{{before{{{first:");
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{before")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{before")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
Parser.parseLine("line");
|
Parser.parseLine("line");
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
Parser.parseLine("}}}after");
|
Parser.parseLine("}}}after");
|
||||||
EXPECT_THAT(Parser.nextNode(),
|
EXPECT_THAT(Parser.nextNode(),
|
||||||
testing::Optional(
|
testing::Optional(
|
||||||
isNode("{{{first:line}}}", "first", ElementsAre("line"))));
|
isNode("{{{first:line}}}", "first", ElementsAre("line"))));
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("after")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("after")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("{{{first:");
|
Parser.parseLine("{{{first:");
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
Parser.flush();
|
Parser.flush();
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{first:")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{first:")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("{{{first:\n");
|
Parser.parseLine("{{{first:\n");
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
Parser.parseLine("}}}\n");
|
Parser.parseLine("}}}\n");
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
Parser.nextNode(),
|
Parser.nextNode(),
|
||||||
testing::Optional(isNode("{{{first:\n}}}", "first", ElementsAre("\n"))));
|
testing::Optional(isNode("{{{first:\n}}}", "first", ElementsAre("\n"))));
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("\n")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("\n")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("{{{first:\r\n");
|
Parser.parseLine("{{{first:\r\n");
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
Parser.parseLine("}}}\r\n");
|
Parser.parseLine("}}}\r\n");
|
||||||
EXPECT_THAT(Parser.nextNode(),
|
EXPECT_THAT(Parser.nextNode(),
|
||||||
testing::Optional(
|
testing::Optional(
|
||||||
isNode("{{{first:\r\n}}}", "first", ElementsAre("\r\n"))));
|
isNode("{{{first:\r\n}}}", "first", ElementsAre("\r\n"))));
|
||||||
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("\r\n")));
|
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("\r\n")));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
|
|
||||||
Parser.parseLine("{{{first:");
|
Parser.parseLine("{{{first:");
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
Parser.parseLine("\033[0m}}}");
|
Parser.parseLine("\033[0m}}}");
|
||||||
EXPECT_THAT(Parser.nextNode(),
|
EXPECT_THAT(Parser.nextNode(),
|
||||||
testing::Optional(isNode("{{{first:\033[0m}}}", "first",
|
testing::Optional(isNode("{{{first:\033[0m}}}", "first",
|
||||||
ElementsAre("\033[0m"))));
|
ElementsAre("\033[0m"))));
|
||||||
EXPECT_THAT(Parser.nextNode(), None);
|
EXPECT_THAT(Parser.nextNode(), std::nullopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -438,7 +438,7 @@ TEST(LinkGraphTest, TransferDefinedSymbol) {
|
||||||
EXPECT_EQ(S1.getSize(), 64U) << "Size was not updated";
|
EXPECT_EQ(S1.getSize(), 64U) << "Size was not updated";
|
||||||
|
|
||||||
// Transfer with non-zero offset, implicit truncation.
|
// Transfer with non-zero offset, implicit truncation.
|
||||||
G.transferDefinedSymbol(S1, B3, 16, None);
|
G.transferDefinedSymbol(S1, B3, 16, std::nullopt);
|
||||||
|
|
||||||
EXPECT_EQ(&S1.getBlock(), &B3) << "Block was not updated";
|
EXPECT_EQ(&S1.getBlock(), &B3) << "Block was not updated";
|
||||||
EXPECT_EQ(S1.getOffset(), 16U) << "Offset was not updated";
|
EXPECT_EQ(S1.getOffset(), 16U) << "Offset was not updated";
|
||||||
|
|
|
@ -26,8 +26,8 @@ TEST(ExecutionUtilsTest, JITTargetMachineBuilder) {
|
||||||
|
|
||||||
// Test API by performing a bunch of no-ops.
|
// Test API by performing a bunch of no-ops.
|
||||||
JTMB.setCPU("");
|
JTMB.setCPU("");
|
||||||
JTMB.setRelocationModel(None);
|
JTMB.setRelocationModel(std::nullopt);
|
||||||
JTMB.setCodeModel(None);
|
JTMB.setCodeModel(std::nullopt);
|
||||||
JTMB.setCodeGenOptLevel(CodeGenOpt::None);
|
JTMB.setCodeGenOptLevel(CodeGenOpt::None);
|
||||||
JTMB.addFeatures(std::vector<std::string>());
|
JTMB.addFeatures(std::vector<std::string>());
|
||||||
SubtargetFeatures &STF = JTMB.getFeatures();
|
SubtargetFeatures &STF = JTMB.getFeatures();
|
||||||
|
|
|
@ -169,11 +169,12 @@ protected:
|
||||||
BB = BasicBlock::Create(Ctx, "", F);
|
BB = BasicBlock::Create(Ctx, "", F);
|
||||||
|
|
||||||
DIBuilder DIB(*M);
|
DIBuilder DIB(*M);
|
||||||
auto File = DIB.createFile("test.dbg", "/src", llvm::None,
|
auto File = DIB.createFile("test.dbg", "/src", std::nullopt,
|
||||||
Optional<StringRef>("/src/test.dbg"));
|
Optional<StringRef>("/src/test.dbg"));
|
||||||
auto CU =
|
auto CU =
|
||||||
DIB.createCompileUnit(dwarf::DW_LANG_C, File, "llvm-C", true, "", 0);
|
DIB.createCompileUnit(dwarf::DW_LANG_C, File, "llvm-C", true, "", 0);
|
||||||
auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
|
auto Type =
|
||||||
|
DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
|
||||||
auto SP = DIB.createFunction(
|
auto SP = DIB.createFunction(
|
||||||
CU, "foo", "", File, 1, Type, 1, DINode::FlagZero,
|
CU, "foo", "", File, 1, Type, 1, DINode::FlagZero,
|
||||||
DISubprogram::SPFlagDefinition | DISubprogram::SPFlagOptimized);
|
DISubprogram::SPFlagDefinition | DISubprogram::SPFlagOptimized);
|
||||||
|
@ -4127,7 +4128,7 @@ sumAtomicReduction(OpenMPIRBuilder::InsertPointTy IP, Type *Ty, Value *LHS,
|
||||||
Value *RHS) {
|
Value *RHS) {
|
||||||
IRBuilder<> Builder(IP.getBlock(), IP.getPoint());
|
IRBuilder<> Builder(IP.getBlock(), IP.getPoint());
|
||||||
Value *Partial = Builder.CreateLoad(Ty, RHS, "red.partial");
|
Value *Partial = Builder.CreateLoad(Ty, RHS, "red.partial");
|
||||||
Builder.CreateAtomicRMW(AtomicRMWInst::FAdd, LHS, Partial, None,
|
Builder.CreateAtomicRMW(AtomicRMWInst::FAdd, LHS, Partial, std::nullopt,
|
||||||
AtomicOrdering::Monotonic);
|
AtomicOrdering::Monotonic);
|
||||||
return Builder.saveIP();
|
return Builder.saveIP();
|
||||||
}
|
}
|
||||||
|
@ -4145,7 +4146,7 @@ xorAtomicReduction(OpenMPIRBuilder::InsertPointTy IP, Type *Ty, Value *LHS,
|
||||||
Value *RHS) {
|
Value *RHS) {
|
||||||
IRBuilder<> Builder(IP.getBlock(), IP.getPoint());
|
IRBuilder<> Builder(IP.getBlock(), IP.getPoint());
|
||||||
Value *Partial = Builder.CreateLoad(Ty, RHS, "red.partial");
|
Value *Partial = Builder.CreateLoad(Ty, RHS, "red.partial");
|
||||||
Builder.CreateAtomicRMW(AtomicRMWInst::Xor, LHS, Partial, None,
|
Builder.CreateAtomicRMW(AtomicRMWInst::Xor, LHS, Partial, std::nullopt,
|
||||||
AtomicOrdering::Monotonic);
|
AtomicOrdering::Monotonic);
|
||||||
return Builder.saveIP();
|
return Builder.saveIP();
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ TEST(Attributes, RemoveAlign) {
|
||||||
EXPECT_TRUE(AS.hasAttribute(Attribute::ReadOnly));
|
EXPECT_TRUE(AS.hasAttribute(Attribute::ReadOnly));
|
||||||
AS = AttributeSet::get(C, B_align_readonly);
|
AS = AttributeSet::get(C, B_align_readonly);
|
||||||
AS = AS.removeAttributes(C, B_align);
|
AS = AS.removeAttributes(C, B_align);
|
||||||
EXPECT_TRUE(AS.getAlignment() == None);
|
EXPECT_TRUE(AS.getAlignment() == std::nullopt);
|
||||||
EXPECT_TRUE(AS.hasAttribute(Attribute::ReadOnly));
|
EXPECT_TRUE(AS.hasAttribute(Attribute::ReadOnly));
|
||||||
|
|
||||||
AttributeList AL;
|
AttributeList AL;
|
||||||
|
|
|
@ -128,13 +128,13 @@ void CFGBuilder::buildCFG(const std::vector<Arc> &NewArcs) {
|
||||||
|
|
||||||
Optional<CFGBuilder::Update> CFGBuilder::getNextUpdate() const {
|
Optional<CFGBuilder::Update> CFGBuilder::getNextUpdate() const {
|
||||||
if (UpdateIdx == Updates.size())
|
if (UpdateIdx == Updates.size())
|
||||||
return None;
|
return std::nullopt;
|
||||||
return Updates[UpdateIdx];
|
return Updates[UpdateIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CFGBuilder::Update> CFGBuilder::applyUpdate() {
|
Optional<CFGBuilder::Update> CFGBuilder::applyUpdate() {
|
||||||
if (UpdateIdx == Updates.size())
|
if (UpdateIdx == Updates.size())
|
||||||
return None;
|
return std::nullopt;
|
||||||
Update NextUpdate = Updates[UpdateIdx++];
|
Update NextUpdate = Updates[UpdateIdx++];
|
||||||
if (NextUpdate.Action == ActionKind::Insert)
|
if (NextUpdate.Action == ActionKind::Insert)
|
||||||
connect(NextUpdate.Edge);
|
connect(NextUpdate.Edge);
|
||||||
|
|
|
@ -777,7 +777,7 @@ TEST_F(ConstantRangeTest, AddWithNoWrap) {
|
||||||
bool IsOverflow;
|
bool IsOverflow;
|
||||||
APInt Res = N1.sadd_ov(N2, IsOverflow);
|
APInt Res = N1.sadd_ov(N2, IsOverflow);
|
||||||
if (IsOverflow)
|
if (IsOverflow)
|
||||||
return None;
|
return std::nullopt;
|
||||||
return Res;
|
return Res;
|
||||||
},
|
},
|
||||||
PreferSmallest,
|
PreferSmallest,
|
||||||
|
@ -831,7 +831,7 @@ TEST_F(ConstantRangeTest, AddWithNoWrap) {
|
||||||
bool IsOverflow;
|
bool IsOverflow;
|
||||||
APInt Res = N1.uadd_ov(N2, IsOverflow);
|
APInt Res = N1.uadd_ov(N2, IsOverflow);
|
||||||
if (IsOverflow)
|
if (IsOverflow)
|
||||||
return None;
|
return std::nullopt;
|
||||||
return Res;
|
return Res;
|
||||||
},
|
},
|
||||||
PreferSmallest,
|
PreferSmallest,
|
||||||
|
@ -872,7 +872,7 @@ TEST_F(ConstantRangeTest, AddWithNoWrap) {
|
||||||
APInt Res1 = N1.uadd_ov(N2, IsOverflow1);
|
APInt Res1 = N1.uadd_ov(N2, IsOverflow1);
|
||||||
APInt Res2 = N1.sadd_ov(N2, IsOverflow2);
|
APInt Res2 = N1.sadd_ov(N2, IsOverflow2);
|
||||||
if (IsOverflow1 || IsOverflow2)
|
if (IsOverflow1 || IsOverflow2)
|
||||||
return None;
|
return std::nullopt;
|
||||||
assert(Res1 == Res2 && "Addition results differ?");
|
assert(Res1 == Res2 && "Addition results differ?");
|
||||||
return Res1;
|
return Res1;
|
||||||
},
|
},
|
||||||
|
@ -920,7 +920,7 @@ TEST_F(ConstantRangeTest, SubWithNoWrap) {
|
||||||
bool IsOverflow;
|
bool IsOverflow;
|
||||||
APInt Res = N1.ssub_ov(N2, IsOverflow);
|
APInt Res = N1.ssub_ov(N2, IsOverflow);
|
||||||
if (IsOverflow)
|
if (IsOverflow)
|
||||||
return None;
|
return std::nullopt;
|
||||||
return Res;
|
return Res;
|
||||||
},
|
},
|
||||||
PreferSmallest,
|
PreferSmallest,
|
||||||
|
@ -933,7 +933,7 @@ TEST_F(ConstantRangeTest, SubWithNoWrap) {
|
||||||
bool IsOverflow;
|
bool IsOverflow;
|
||||||
APInt Res = N1.usub_ov(N2, IsOverflow);
|
APInt Res = N1.usub_ov(N2, IsOverflow);
|
||||||
if (IsOverflow)
|
if (IsOverflow)
|
||||||
return None;
|
return std::nullopt;
|
||||||
return Res;
|
return Res;
|
||||||
},
|
},
|
||||||
PreferSmallest,
|
PreferSmallest,
|
||||||
|
@ -947,7 +947,7 @@ TEST_F(ConstantRangeTest, SubWithNoWrap) {
|
||||||
APInt Res1 = N1.usub_ov(N2, IsOverflow1);
|
APInt Res1 = N1.usub_ov(N2, IsOverflow1);
|
||||||
APInt Res2 = N1.ssub_ov(N2, IsOverflow2);
|
APInt Res2 = N1.ssub_ov(N2, IsOverflow2);
|
||||||
if (IsOverflow1 || IsOverflow2)
|
if (IsOverflow1 || IsOverflow2)
|
||||||
return None;
|
return std::nullopt;
|
||||||
assert(Res1 == Res2 && "Subtraction results differ?");
|
assert(Res1 == Res2 && "Subtraction results differ?");
|
||||||
return Res1;
|
return Res1;
|
||||||
},
|
},
|
||||||
|
@ -1248,7 +1248,7 @@ TEST_F(ConstantRangeTest, URem) {
|
||||||
},
|
},
|
||||||
[](const APInt &N1, const APInt &N2) -> Optional<APInt> {
|
[](const APInt &N1, const APInt &N2) -> Optional<APInt> {
|
||||||
if (N2.isZero())
|
if (N2.isZero())
|
||||||
return None;
|
return std::nullopt;
|
||||||
return N1.urem(N2);
|
return N1.urem(N2);
|
||||||
},
|
},
|
||||||
PreferSmallest,
|
PreferSmallest,
|
||||||
|
@ -1324,7 +1324,7 @@ TEST_F(ConstantRangeTest, SRem) {
|
||||||
},
|
},
|
||||||
[](const APInt &N1, const APInt &N2) -> Optional<APInt> {
|
[](const APInt &N1, const APInt &N2) -> Optional<APInt> {
|
||||||
if (N2.isZero())
|
if (N2.isZero())
|
||||||
return None;
|
return std::nullopt;
|
||||||
return N1.srem(N2);
|
return N1.srem(N2);
|
||||||
},
|
},
|
||||||
PreferSmallest,
|
PreferSmallest,
|
||||||
|
@ -1362,7 +1362,7 @@ TEST_F(ConstantRangeTest, Shl) {
|
||||||
},
|
},
|
||||||
[](const APInt &N1, const APInt &N2) -> Optional<APInt> {
|
[](const APInt &N1, const APInt &N2) -> Optional<APInt> {
|
||||||
if (N2.uge(N2.getBitWidth()))
|
if (N2.uge(N2.getBitWidth()))
|
||||||
return None;
|
return std::nullopt;
|
||||||
return N1.shl(N2);
|
return N1.shl(N2);
|
||||||
},
|
},
|
||||||
PreferSmallestUnsigned,
|
PreferSmallestUnsigned,
|
||||||
|
@ -2398,7 +2398,7 @@ TEST_F(ConstantRangeTest, Abs) {
|
||||||
[](const ConstantRange &CR) { return CR.abs(/*IntMinIsPoison=*/true); },
|
[](const ConstantRange &CR) { return CR.abs(/*IntMinIsPoison=*/true); },
|
||||||
[](const APInt &N) -> Optional<APInt> {
|
[](const APInt &N) -> Optional<APInt> {
|
||||||
if (N.isMinSignedValue())
|
if (N.isMinSignedValue())
|
||||||
return None;
|
return std::nullopt;
|
||||||
return N.abs();
|
return N.abs();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -500,7 +500,7 @@ TEST(ConstantsTest, BitcastToGEP) {
|
||||||
|
|
||||||
bool foldFuncPtrAndConstToNull(LLVMContext &Context, Module *TheModule,
|
bool foldFuncPtrAndConstToNull(LLVMContext &Context, Module *TheModule,
|
||||||
uint64_t AndValue,
|
uint64_t AndValue,
|
||||||
MaybeAlign FunctionAlign = llvm::None) {
|
MaybeAlign FunctionAlign = std::nullopt) {
|
||||||
Type *VoidType(Type::getVoidTy(Context));
|
Type *VoidType(Type::getVoidTy(Context));
|
||||||
FunctionType *FuncType(FunctionType::get(VoidType, false));
|
FunctionType *FuncType(FunctionType::get(VoidType, false));
|
||||||
Function *Func(
|
Function *Func(
|
||||||
|
|
|
@ -436,7 +436,7 @@ TEST_F(IRBuilderTest, ConstrainedFPFunctionCall) {
|
||||||
// Now call the empty constrained FP function.
|
// Now call the empty constrained FP function.
|
||||||
Builder.setIsFPConstrained(true);
|
Builder.setIsFPConstrained(true);
|
||||||
Builder.setConstrainedFPFunctionAttr();
|
Builder.setConstrainedFPFunctionAttr();
|
||||||
CallInst *FCall = Builder.CreateCall(Callee, None);
|
CallInst *FCall = Builder.CreateCall(Callee, std::nullopt);
|
||||||
|
|
||||||
// Check the attributes to verify the strictfp attribute is on the call.
|
// Check the attributes to verify the strictfp attribute is on the call.
|
||||||
EXPECT_TRUE(
|
EXPECT_TRUE(
|
||||||
|
@ -696,24 +696,24 @@ TEST_F(IRBuilderTest, FastMathFlags) {
|
||||||
auto Callee =
|
auto Callee =
|
||||||
Function::Create(CalleeTy, Function::ExternalLinkage, "", M.get());
|
Function::Create(CalleeTy, Function::ExternalLinkage, "", M.get());
|
||||||
|
|
||||||
FCall = Builder.CreateCall(Callee, None);
|
FCall = Builder.CreateCall(Callee, std::nullopt);
|
||||||
EXPECT_FALSE(FCall->hasNoNaNs());
|
EXPECT_FALSE(FCall->hasNoNaNs());
|
||||||
|
|
||||||
Function *V =
|
Function *V =
|
||||||
Function::Create(CalleeTy, Function::ExternalLinkage, "", M.get());
|
Function::Create(CalleeTy, Function::ExternalLinkage, "", M.get());
|
||||||
FCall = Builder.CreateCall(V, None);
|
FCall = Builder.CreateCall(V, std::nullopt);
|
||||||
EXPECT_FALSE(FCall->hasNoNaNs());
|
EXPECT_FALSE(FCall->hasNoNaNs());
|
||||||
|
|
||||||
FMF.clear();
|
FMF.clear();
|
||||||
FMF.setNoNaNs();
|
FMF.setNoNaNs();
|
||||||
Builder.setFastMathFlags(FMF);
|
Builder.setFastMathFlags(FMF);
|
||||||
|
|
||||||
FCall = Builder.CreateCall(Callee, None);
|
FCall = Builder.CreateCall(Callee, std::nullopt);
|
||||||
EXPECT_TRUE(Builder.getFastMathFlags().any());
|
EXPECT_TRUE(Builder.getFastMathFlags().any());
|
||||||
EXPECT_TRUE(Builder.getFastMathFlags().NoNaNs);
|
EXPECT_TRUE(Builder.getFastMathFlags().NoNaNs);
|
||||||
EXPECT_TRUE(FCall->hasNoNaNs());
|
EXPECT_TRUE(FCall->hasNoNaNs());
|
||||||
|
|
||||||
FCall = Builder.CreateCall(V, None);
|
FCall = Builder.CreateCall(V, std::nullopt);
|
||||||
EXPECT_TRUE(Builder.getFastMathFlags().any());
|
EXPECT_TRUE(Builder.getFastMathFlags().any());
|
||||||
EXPECT_TRUE(Builder.getFastMathFlags().NoNaNs);
|
EXPECT_TRUE(Builder.getFastMathFlags().NoNaNs);
|
||||||
EXPECT_TRUE(FCall->hasNoNaNs());
|
EXPECT_TRUE(FCall->hasNoNaNs());
|
||||||
|
@ -825,7 +825,7 @@ TEST_F(IRBuilderTest, createFunction) {
|
||||||
auto File = DIB.createFile("error.swift", "/");
|
auto File = DIB.createFile("error.swift", "/");
|
||||||
auto CU =
|
auto CU =
|
||||||
DIB.createCompileUnit(dwarf::DW_LANG_Swift, File, "swiftc", true, "", 0);
|
DIB.createCompileUnit(dwarf::DW_LANG_Swift, File, "swiftc", true, "", 0);
|
||||||
auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
|
auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
|
||||||
auto NoErr = DIB.createFunction(
|
auto NoErr = DIB.createFunction(
|
||||||
CU, "noerr", "", File, 1, Type, 1, DINode::FlagZero,
|
CU, "noerr", "", File, 1, Type, 1, DINode::FlagZero,
|
||||||
DISubprogram::SPFlagDefinition | DISubprogram::SPFlagOptimized);
|
DISubprogram::SPFlagDefinition | DISubprogram::SPFlagOptimized);
|
||||||
|
@ -847,7 +847,7 @@ TEST_F(IRBuilderTest, DIBuilder) {
|
||||||
auto CU = DIB.createCompileUnit(dwarf::DW_LANG_Cobol74,
|
auto CU = DIB.createCompileUnit(dwarf::DW_LANG_Cobol74,
|
||||||
DIB.createFile("F.CBL", "/"), "llvm-cobol74",
|
DIB.createFile("F.CBL", "/"), "llvm-cobol74",
|
||||||
true, "", 0);
|
true, "", 0);
|
||||||
auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
|
auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
|
||||||
auto SP = DIB.createFunction(
|
auto SP = DIB.createFunction(
|
||||||
CU, "foo", "", File, 1, Type, 1, DINode::FlagZero,
|
CU, "foo", "", File, 1, Type, 1, DINode::FlagZero,
|
||||||
DISubprogram::SPFlagDefinition | DISubprogram::SPFlagOptimized);
|
DISubprogram::SPFlagDefinition | DISubprogram::SPFlagOptimized);
|
||||||
|
@ -869,7 +869,7 @@ TEST_F(IRBuilderTest, createArtificialSubprogram) {
|
||||||
auto CU = DIB.createCompileUnit(dwarf::DW_LANG_C, File, "clang",
|
auto CU = DIB.createCompileUnit(dwarf::DW_LANG_C, File, "clang",
|
||||||
/*isOptimized=*/true, /*Flags=*/"",
|
/*isOptimized=*/true, /*Flags=*/"",
|
||||||
/*Runtime Version=*/0);
|
/*Runtime Version=*/0);
|
||||||
auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
|
auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
|
||||||
auto SP = DIB.createFunction(
|
auto SP = DIB.createFunction(
|
||||||
CU, "foo", /*LinkageName=*/"", File,
|
CU, "foo", /*LinkageName=*/"", File,
|
||||||
/*LineNo=*/1, Type, /*ScopeLine=*/2, DINode::FlagZero,
|
/*LineNo=*/1, Type, /*ScopeLine=*/2, DINode::FlagZero,
|
||||||
|
@ -1038,7 +1038,8 @@ TEST_F(IRBuilderTest, DebugLoc) {
|
||||||
auto CU = DIB.createCompileUnit(dwarf::DW_LANG_C_plus_plus_11,
|
auto CU = DIB.createCompileUnit(dwarf::DW_LANG_C_plus_plus_11,
|
||||||
DIB.createFile("tmp.cpp", "/"), "", true, "",
|
DIB.createFile("tmp.cpp", "/"), "", true, "",
|
||||||
0);
|
0);
|
||||||
auto SPType = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
|
auto SPType =
|
||||||
|
DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
|
||||||
auto SP =
|
auto SP =
|
||||||
DIB.createFunction(CU, "foo", "foo", File, 1, SPType, 1, DINode::FlagZero,
|
DIB.createFunction(CU, "foo", "foo", File, 1, SPType, 1, DINode::FlagZero,
|
||||||
DISubprogram::SPFlagDefinition);
|
DISubprogram::SPFlagDefinition);
|
||||||
|
@ -1052,13 +1053,13 @@ TEST_F(IRBuilderTest, DebugLoc) {
|
||||||
IRBuilder<> Builder(Ctx);
|
IRBuilder<> Builder(Ctx);
|
||||||
Builder.SetInsertPoint(Br);
|
Builder.SetInsertPoint(Br);
|
||||||
EXPECT_EQ(DL1, Builder.getCurrentDebugLocation());
|
EXPECT_EQ(DL1, Builder.getCurrentDebugLocation());
|
||||||
auto Call1 = Builder.CreateCall(Callee, None);
|
auto Call1 = Builder.CreateCall(Callee, std::nullopt);
|
||||||
EXPECT_EQ(DL1, Call1->getDebugLoc());
|
EXPECT_EQ(DL1, Call1->getDebugLoc());
|
||||||
|
|
||||||
Call1->setDebugLoc(DL2);
|
Call1->setDebugLoc(DL2);
|
||||||
Builder.SetInsertPoint(Call1->getParent(), Call1->getIterator());
|
Builder.SetInsertPoint(Call1->getParent(), Call1->getIterator());
|
||||||
EXPECT_EQ(DL2, Builder.getCurrentDebugLocation());
|
EXPECT_EQ(DL2, Builder.getCurrentDebugLocation());
|
||||||
auto Call2 = Builder.CreateCall(Callee, None);
|
auto Call2 = Builder.CreateCall(Callee, std::nullopt);
|
||||||
EXPECT_EQ(DL2, Call2->getDebugLoc());
|
EXPECT_EQ(DL2, Call2->getDebugLoc());
|
||||||
|
|
||||||
DIB.finalize();
|
DIB.finalize();
|
||||||
|
@ -1071,7 +1072,7 @@ TEST_F(IRBuilderTest, DIImportedEntity) {
|
||||||
auto CU = DIB.createCompileUnit(dwarf::DW_LANG_Cobol74,
|
auto CU = DIB.createCompileUnit(dwarf::DW_LANG_Cobol74,
|
||||||
F, "llvm-cobol74",
|
F, "llvm-cobol74",
|
||||||
true, "", 0);
|
true, "", 0);
|
||||||
MDTuple *Elements = MDTuple::getDistinct(Ctx, None);
|
MDTuple *Elements = MDTuple::getDistinct(Ctx, std::nullopt);
|
||||||
|
|
||||||
DIB.createImportedDeclaration(CU, nullptr, F, 1);
|
DIB.createImportedDeclaration(CU, nullptr, F, 1);
|
||||||
DIB.createImportedDeclaration(CU, nullptr, F, 1);
|
DIB.createImportedDeclaration(CU, nullptr, F, 1);
|
||||||
|
|
|
@ -752,7 +752,7 @@ TEST(InstructionsTest, AlterCallBundles) {
|
||||||
AttrBuilder AB(C);
|
AttrBuilder AB(C);
|
||||||
AB.addAttribute(Attribute::Cold);
|
AB.addAttribute(Attribute::Cold);
|
||||||
Call->setAttributes(AttributeList::get(C, AttributeList::FunctionIndex, AB));
|
Call->setAttributes(AttributeList::get(C, AttributeList::FunctionIndex, AB));
|
||||||
Call->setDebugLoc(DebugLoc(MDNode::get(C, None)));
|
Call->setDebugLoc(DebugLoc(MDNode::get(C, std::nullopt)));
|
||||||
|
|
||||||
OperandBundleDef NewBundle("after", ConstantInt::get(Int32Ty, 7));
|
OperandBundleDef NewBundle("after", ConstantInt::get(Int32Ty, 7));
|
||||||
std::unique_ptr<CallInst> Clone(CallInst::Create(Call.get(), NewBundle));
|
std::unique_ptr<CallInst> Clone(CallInst::Create(Call.get(), NewBundle));
|
||||||
|
@ -782,7 +782,7 @@ TEST(InstructionsTest, AlterInvokeBundles) {
|
||||||
AB.addAttribute(Attribute::Cold);
|
AB.addAttribute(Attribute::Cold);
|
||||||
Invoke->setAttributes(
|
Invoke->setAttributes(
|
||||||
AttributeList::get(C, AttributeList::FunctionIndex, AB));
|
AttributeList::get(C, AttributeList::FunctionIndex, AB));
|
||||||
Invoke->setDebugLoc(DebugLoc(MDNode::get(C, None)));
|
Invoke->setDebugLoc(DebugLoc(MDNode::get(C, std::nullopt)));
|
||||||
|
|
||||||
OperandBundleDef NewBundle("after", ConstantInt::get(Int32Ty, 7));
|
OperandBundleDef NewBundle("after", ConstantInt::get(Int32Ty, 7));
|
||||||
std::unique_ptr<InvokeInst> Clone(
|
std::unique_ptr<InvokeInst> Clone(
|
||||||
|
|
|
@ -72,14 +72,14 @@ protected:
|
||||||
Module M;
|
Module M;
|
||||||
int Counter;
|
int Counter;
|
||||||
|
|
||||||
MDNode *getNode() { return MDNode::get(Context, None); }
|
MDNode *getNode() { return MDNode::get(Context, std::nullopt); }
|
||||||
MDNode *getNode(Metadata *MD) { return MDNode::get(Context, MD); }
|
MDNode *getNode(Metadata *MD) { return MDNode::get(Context, MD); }
|
||||||
MDNode *getNode(Metadata *MD1, Metadata *MD2) {
|
MDNode *getNode(Metadata *MD1, Metadata *MD2) {
|
||||||
Metadata *MDs[] = {MD1, MD2};
|
Metadata *MDs[] = {MD1, MD2};
|
||||||
return MDNode::get(Context, MDs);
|
return MDNode::get(Context, MDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
MDTuple *getTuple() { return MDTuple::getDistinct(Context, None); }
|
MDTuple *getTuple() { return MDTuple::getDistinct(Context, std::nullopt); }
|
||||||
DISubroutineType *getSubroutineType() {
|
DISubroutineType *getSubroutineType() {
|
||||||
return DISubroutineType::getDistinct(Context, DINode::FlagZero, 0,
|
return DISubroutineType::getDistinct(Context, DINode::FlagZero, 0,
|
||||||
getNode(nullptr));
|
getNode(nullptr));
|
||||||
|
@ -105,7 +105,7 @@ protected:
|
||||||
DIType *getDerivedType() {
|
DIType *getDerivedType() {
|
||||||
return DIDerivedType::getDistinct(
|
return DIDerivedType::getDistinct(
|
||||||
Context, dwarf::DW_TAG_pointer_type, "", nullptr, 0, nullptr,
|
Context, dwarf::DW_TAG_pointer_type, "", nullptr, 0, nullptr,
|
||||||
getBasicType("basictype"), 1, 2, 0, None, DINode::FlagZero);
|
getBasicType("basictype"), 1, 2, 0, std::nullopt, DINode::FlagZero);
|
||||||
}
|
}
|
||||||
Constant *getConstant() {
|
Constant *getConstant() {
|
||||||
return ConstantInt::get(Type::getInt32Ty(Context), Counter++);
|
return ConstantInt::get(Type::getInt32Ty(Context), Counter++);
|
||||||
|
@ -120,7 +120,7 @@ protected:
|
||||||
}
|
}
|
||||||
Function *getFunction(StringRef Name) {
|
Function *getFunction(StringRef Name) {
|
||||||
return Function::Create(
|
return Function::Create(
|
||||||
FunctionType::get(Type::getVoidTy(Context), None, false),
|
FunctionType::get(Type::getVoidTy(Context), std::nullopt, false),
|
||||||
Function::ExternalLinkage, Name, M);
|
Function::ExternalLinkage, Name, M);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -226,7 +226,7 @@ TEST_F(MDNodeTest, SelfReference) {
|
||||||
// !0 = !{!0}
|
// !0 = !{!0}
|
||||||
// !1 = !{!0}
|
// !1 = !{!0}
|
||||||
{
|
{
|
||||||
auto Temp = MDNode::getTemporary(Context, None);
|
auto Temp = MDNode::getTemporary(Context, std::nullopt);
|
||||||
Metadata *Args[] = {Temp.get()};
|
Metadata *Args[] = {Temp.get()};
|
||||||
MDNode *Self = MDNode::get(Context, Args);
|
MDNode *Self = MDNode::get(Context, Args);
|
||||||
Self->replaceOperandWith(0, Self);
|
Self->replaceOperandWith(0, Self);
|
||||||
|
@ -244,8 +244,8 @@ TEST_F(MDNodeTest, SelfReference) {
|
||||||
// !0 = !{!0, !{}}
|
// !0 = !{!0, !{}}
|
||||||
// !1 = !{!0, !{}}
|
// !1 = !{!0, !{}}
|
||||||
{
|
{
|
||||||
auto Temp = MDNode::getTemporary(Context, None);
|
auto Temp = MDNode::getTemporary(Context, std::nullopt);
|
||||||
Metadata *Args[] = {Temp.get(), MDNode::get(Context, None)};
|
Metadata *Args[] = {Temp.get(), MDNode::get(Context, std::nullopt)};
|
||||||
MDNode *Self = MDNode::get(Context, Args);
|
MDNode *Self = MDNode::get(Context, Args);
|
||||||
Self->replaceOperandWith(0, Self);
|
Self->replaceOperandWith(0, Self);
|
||||||
ASSERT_EQ(Self, Self->getOperand(0));
|
ASSERT_EQ(Self, Self->getOperand(0));
|
||||||
|
@ -354,8 +354,8 @@ TEST_F(MDNodeTest, PrintFromFunction) {
|
||||||
auto *BB1 = BasicBlock::Create(Context, "entry", F1);
|
auto *BB1 = BasicBlock::Create(Context, "entry", F1);
|
||||||
auto *R0 = ReturnInst::Create(Context, BB0);
|
auto *R0 = ReturnInst::Create(Context, BB0);
|
||||||
auto *R1 = ReturnInst::Create(Context, BB1);
|
auto *R1 = ReturnInst::Create(Context, BB1);
|
||||||
auto *N0 = MDNode::getDistinct(Context, None);
|
auto *N0 = MDNode::getDistinct(Context, std::nullopt);
|
||||||
auto *N1 = MDNode::getDistinct(Context, None);
|
auto *N1 = MDNode::getDistinct(Context, std::nullopt);
|
||||||
R0->setMetadata("md", N0);
|
R0->setMetadata("md", N0);
|
||||||
R1->setMetadata("md", N1);
|
R1->setMetadata("md", N1);
|
||||||
|
|
||||||
|
@ -380,8 +380,8 @@ TEST_F(MDNodeTest, PrintFromMetadataAsValue) {
|
||||||
auto *F1 = Function::Create(FTy, GlobalValue::ExternalLinkage, "F1", &M);
|
auto *F1 = Function::Create(FTy, GlobalValue::ExternalLinkage, "F1", &M);
|
||||||
auto *BB0 = BasicBlock::Create(Context, "entry", F0);
|
auto *BB0 = BasicBlock::Create(Context, "entry", F0);
|
||||||
auto *BB1 = BasicBlock::Create(Context, "entry", F1);
|
auto *BB1 = BasicBlock::Create(Context, "entry", F1);
|
||||||
auto *N0 = MDNode::getDistinct(Context, None);
|
auto *N0 = MDNode::getDistinct(Context, std::nullopt);
|
||||||
auto *N1 = MDNode::getDistinct(Context, None);
|
auto *N1 = MDNode::getDistinct(Context, std::nullopt);
|
||||||
auto *MAV0 = MetadataAsValue::get(Context, N0);
|
auto *MAV0 = MetadataAsValue::get(Context, N0);
|
||||||
auto *MAV1 = MetadataAsValue::get(Context, N1);
|
auto *MAV1 = MetadataAsValue::get(Context, N1);
|
||||||
CallInst::Create(Intrinsic, MAV0, "", BB0);
|
CallInst::Create(Intrinsic, MAV0, "", BB0);
|
||||||
|
@ -415,7 +415,7 @@ TEST_F(MDNodeTest, PrintWithDroppedCallOperand) {
|
||||||
CI0->dropAllReferences();
|
CI0->dropAllReferences();
|
||||||
|
|
||||||
auto *R0 = ReturnInst::Create(Context, BB0);
|
auto *R0 = ReturnInst::Create(Context, BB0);
|
||||||
auto *N0 = MDNode::getDistinct(Context, None);
|
auto *N0 = MDNode::getDistinct(Context, std::nullopt);
|
||||||
R0->setMetadata("md", N0);
|
R0->setMetadata("md", N0);
|
||||||
|
|
||||||
// Printing the metadata node would previously result in a failed assertion
|
// Printing the metadata node would previously result in a failed assertion
|
||||||
|
@ -460,7 +460,7 @@ TEST_F(MDNodeTest, PrintTree) {
|
||||||
auto *StructTy = cast<DICompositeType>(getCompositeType());
|
auto *StructTy = cast<DICompositeType>(getCompositeType());
|
||||||
DIType *PointerTy = DIDerivedType::getDistinct(
|
DIType *PointerTy = DIDerivedType::getDistinct(
|
||||||
Context, dwarf::DW_TAG_pointer_type, "", nullptr, 0, nullptr, StructTy,
|
Context, dwarf::DW_TAG_pointer_type, "", nullptr, 0, nullptr, StructTy,
|
||||||
1, 2, 0, None, DINode::FlagZero);
|
1, 2, 0, std::nullopt, DINode::FlagZero);
|
||||||
StructTy->replaceElements(MDTuple::get(Context, PointerTy));
|
StructTy->replaceElements(MDTuple::get(Context, PointerTy));
|
||||||
|
|
||||||
auto *Var = DILocalVariable::get(Context, Scope, "foo", File,
|
auto *Var = DILocalVariable::get(Context, Scope, "foo", File,
|
||||||
|
@ -488,7 +488,7 @@ TEST_F(MDNodeTest, PrintTree) {
|
||||||
|
|
||||||
TEST_F(MDNodeTest, NullOperand) {
|
TEST_F(MDNodeTest, NullOperand) {
|
||||||
// metadata !{}
|
// metadata !{}
|
||||||
MDNode *Empty = MDNode::get(Context, None);
|
MDNode *Empty = MDNode::get(Context, std::nullopt);
|
||||||
|
|
||||||
// metadata !{metadata !{}}
|
// metadata !{metadata !{}}
|
||||||
Metadata *Ops[] = {Empty};
|
Metadata *Ops[] = {Empty};
|
||||||
|
@ -508,7 +508,7 @@ TEST_F(MDNodeTest, NullOperand) {
|
||||||
|
|
||||||
TEST_F(MDNodeTest, DistinctOnUniquingCollision) {
|
TEST_F(MDNodeTest, DistinctOnUniquingCollision) {
|
||||||
// !{}
|
// !{}
|
||||||
MDNode *Empty = MDNode::get(Context, None);
|
MDNode *Empty = MDNode::get(Context, std::nullopt);
|
||||||
ASSERT_TRUE(Empty->isResolved());
|
ASSERT_TRUE(Empty->isResolved());
|
||||||
EXPECT_FALSE(Empty->isDistinct());
|
EXPECT_FALSE(Empty->isDistinct());
|
||||||
|
|
||||||
|
@ -535,7 +535,7 @@ TEST_F(MDNodeTest, DistinctOnUniquingCollision) {
|
||||||
|
|
||||||
TEST_F(MDNodeTest, UniquedOnDeletedOperand) {
|
TEST_F(MDNodeTest, UniquedOnDeletedOperand) {
|
||||||
// temp !{}
|
// temp !{}
|
||||||
TempMDTuple T = MDTuple::getTemporary(Context, None);
|
TempMDTuple T = MDTuple::getTemporary(Context, std::nullopt);
|
||||||
|
|
||||||
// !{temp !{}}
|
// !{temp !{}}
|
||||||
Metadata *Ops[] = {T.get()};
|
Metadata *Ops[] = {T.get()};
|
||||||
|
@ -569,14 +569,14 @@ TEST_F(MDNodeTest, DistinctOnDeletedValueOperand) {
|
||||||
|
|
||||||
TEST_F(MDNodeTest, getDistinct) {
|
TEST_F(MDNodeTest, getDistinct) {
|
||||||
// !{}
|
// !{}
|
||||||
MDNode *Empty = MDNode::get(Context, None);
|
MDNode *Empty = MDNode::get(Context, std::nullopt);
|
||||||
ASSERT_TRUE(Empty->isResolved());
|
ASSERT_TRUE(Empty->isResolved());
|
||||||
ASSERT_FALSE(Empty->isDistinct());
|
ASSERT_FALSE(Empty->isDistinct());
|
||||||
ASSERT_EQ(Empty, MDNode::get(Context, None));
|
ASSERT_EQ(Empty, MDNode::get(Context, std::nullopt));
|
||||||
|
|
||||||
// distinct !{}
|
// distinct !{}
|
||||||
MDNode *Distinct1 = MDNode::getDistinct(Context, None);
|
MDNode *Distinct1 = MDNode::getDistinct(Context, std::nullopt);
|
||||||
MDNode *Distinct2 = MDNode::getDistinct(Context, None);
|
MDNode *Distinct2 = MDNode::getDistinct(Context, std::nullopt);
|
||||||
EXPECT_TRUE(Distinct1->isResolved());
|
EXPECT_TRUE(Distinct1->isResolved());
|
||||||
EXPECT_TRUE(Distinct2->isDistinct());
|
EXPECT_TRUE(Distinct2->isDistinct());
|
||||||
EXPECT_NE(Empty, Distinct1);
|
EXPECT_NE(Empty, Distinct1);
|
||||||
|
@ -584,31 +584,31 @@ TEST_F(MDNodeTest, getDistinct) {
|
||||||
EXPECT_NE(Distinct1, Distinct2);
|
EXPECT_NE(Distinct1, Distinct2);
|
||||||
|
|
||||||
// !{}
|
// !{}
|
||||||
ASSERT_EQ(Empty, MDNode::get(Context, None));
|
ASSERT_EQ(Empty, MDNode::get(Context, std::nullopt));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MDNodeTest, isUniqued) {
|
TEST_F(MDNodeTest, isUniqued) {
|
||||||
MDNode *U = MDTuple::get(Context, None);
|
MDNode *U = MDTuple::get(Context, std::nullopt);
|
||||||
MDNode *D = MDTuple::getDistinct(Context, None);
|
MDNode *D = MDTuple::getDistinct(Context, std::nullopt);
|
||||||
auto T = MDTuple::getTemporary(Context, None);
|
auto T = MDTuple::getTemporary(Context, std::nullopt);
|
||||||
EXPECT_TRUE(U->isUniqued());
|
EXPECT_TRUE(U->isUniqued());
|
||||||
EXPECT_FALSE(D->isUniqued());
|
EXPECT_FALSE(D->isUniqued());
|
||||||
EXPECT_FALSE(T->isUniqued());
|
EXPECT_FALSE(T->isUniqued());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MDNodeTest, isDistinct) {
|
TEST_F(MDNodeTest, isDistinct) {
|
||||||
MDNode *U = MDTuple::get(Context, None);
|
MDNode *U = MDTuple::get(Context, std::nullopt);
|
||||||
MDNode *D = MDTuple::getDistinct(Context, None);
|
MDNode *D = MDTuple::getDistinct(Context, std::nullopt);
|
||||||
auto T = MDTuple::getTemporary(Context, None);
|
auto T = MDTuple::getTemporary(Context, std::nullopt);
|
||||||
EXPECT_FALSE(U->isDistinct());
|
EXPECT_FALSE(U->isDistinct());
|
||||||
EXPECT_TRUE(D->isDistinct());
|
EXPECT_TRUE(D->isDistinct());
|
||||||
EXPECT_FALSE(T->isDistinct());
|
EXPECT_FALSE(T->isDistinct());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MDNodeTest, isTemporary) {
|
TEST_F(MDNodeTest, isTemporary) {
|
||||||
MDNode *U = MDTuple::get(Context, None);
|
MDNode *U = MDTuple::get(Context, std::nullopt);
|
||||||
MDNode *D = MDTuple::getDistinct(Context, None);
|
MDNode *D = MDTuple::getDistinct(Context, std::nullopt);
|
||||||
auto T = MDTuple::getTemporary(Context, None);
|
auto T = MDTuple::getTemporary(Context, std::nullopt);
|
||||||
EXPECT_FALSE(U->isTemporary());
|
EXPECT_FALSE(U->isTemporary());
|
||||||
EXPECT_FALSE(D->isTemporary());
|
EXPECT_FALSE(D->isTemporary());
|
||||||
EXPECT_TRUE(T->isTemporary());
|
EXPECT_TRUE(T->isTemporary());
|
||||||
|
@ -616,7 +616,7 @@ TEST_F(MDNodeTest, isTemporary) {
|
||||||
|
|
||||||
TEST_F(MDNodeTest, getDistinctWithUnresolvedOperands) {
|
TEST_F(MDNodeTest, getDistinctWithUnresolvedOperands) {
|
||||||
// temporary !{}
|
// temporary !{}
|
||||||
auto Temp = MDTuple::getTemporary(Context, None);
|
auto Temp = MDTuple::getTemporary(Context, std::nullopt);
|
||||||
ASSERT_FALSE(Temp->isResolved());
|
ASSERT_FALSE(Temp->isResolved());
|
||||||
|
|
||||||
// distinct !{temporary !{}}
|
// distinct !{temporary !{}}
|
||||||
|
@ -626,17 +626,17 @@ TEST_F(MDNodeTest, getDistinctWithUnresolvedOperands) {
|
||||||
EXPECT_EQ(Temp.get(), Distinct->getOperand(0));
|
EXPECT_EQ(Temp.get(), Distinct->getOperand(0));
|
||||||
|
|
||||||
// temporary !{} => !{}
|
// temporary !{} => !{}
|
||||||
MDNode *Empty = MDNode::get(Context, None);
|
MDNode *Empty = MDNode::get(Context, std::nullopt);
|
||||||
Temp->replaceAllUsesWith(Empty);
|
Temp->replaceAllUsesWith(Empty);
|
||||||
EXPECT_EQ(Empty, Distinct->getOperand(0));
|
EXPECT_EQ(Empty, Distinct->getOperand(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MDNodeTest, handleChangedOperandRecursion) {
|
TEST_F(MDNodeTest, handleChangedOperandRecursion) {
|
||||||
// !0 = !{}
|
// !0 = !{}
|
||||||
MDNode *N0 = MDNode::get(Context, None);
|
MDNode *N0 = MDNode::get(Context, std::nullopt);
|
||||||
|
|
||||||
// !1 = !{!3, null}
|
// !1 = !{!3, null}
|
||||||
auto Temp3 = MDTuple::getTemporary(Context, None);
|
auto Temp3 = MDTuple::getTemporary(Context, std::nullopt);
|
||||||
Metadata *Ops1[] = {Temp3.get(), nullptr};
|
Metadata *Ops1[] = {Temp3.get(), nullptr};
|
||||||
MDNode *N1 = MDNode::get(Context, Ops1);
|
MDNode *N1 = MDNode::get(Context, Ops1);
|
||||||
|
|
||||||
|
@ -700,7 +700,7 @@ TEST_F(MDNodeTest, replaceResolvedOperand) {
|
||||||
// a global value that gets RAUW'ed.
|
// a global value that gets RAUW'ed.
|
||||||
//
|
//
|
||||||
// Use a temporary node to keep N from being resolved.
|
// Use a temporary node to keep N from being resolved.
|
||||||
auto Temp = MDTuple::getTemporary(Context, None);
|
auto Temp = MDTuple::getTemporary(Context, std::nullopt);
|
||||||
Metadata *Ops[] = {nullptr, Temp.get()};
|
Metadata *Ops[] = {nullptr, Temp.get()};
|
||||||
|
|
||||||
MDNode *Empty = MDTuple::get(Context, ArrayRef<Metadata *>());
|
MDNode *Empty = MDTuple::get(Context, ArrayRef<Metadata *>());
|
||||||
|
@ -721,7 +721,7 @@ TEST_F(MDNodeTest, replaceResolvedOperand) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MDNodeTest, replaceWithUniqued) {
|
TEST_F(MDNodeTest, replaceWithUniqued) {
|
||||||
auto *Empty = MDTuple::get(Context, None);
|
auto *Empty = MDTuple::get(Context, std::nullopt);
|
||||||
MDTuple *FirstUniqued;
|
MDTuple *FirstUniqued;
|
||||||
{
|
{
|
||||||
Metadata *Ops[] = {Empty};
|
Metadata *Ops[] = {Empty};
|
||||||
|
@ -747,7 +747,7 @@ TEST_F(MDNodeTest, replaceWithUniqued) {
|
||||||
EXPECT_EQ(FirstUniqued, Uniqued);
|
EXPECT_EQ(FirstUniqued, Uniqued);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto Unresolved = MDTuple::getTemporary(Context, None);
|
auto Unresolved = MDTuple::getTemporary(Context, std::nullopt);
|
||||||
Metadata *Ops[] = {Unresolved.get()};
|
Metadata *Ops[] = {Unresolved.get()};
|
||||||
auto Temp = MDTuple::getTemporary(Context, Ops);
|
auto Temp = MDTuple::getTemporary(Context, Ops);
|
||||||
EXPECT_TRUE(Temp->isTemporary());
|
EXPECT_TRUE(Temp->isTemporary());
|
||||||
|
@ -769,7 +769,7 @@ TEST_F(MDNodeTest, replaceWithUniqued) {
|
||||||
|
|
||||||
TEST_F(MDNodeTest, replaceWithUniquedResolvingOperand) {
|
TEST_F(MDNodeTest, replaceWithUniquedResolvingOperand) {
|
||||||
// temp !{}
|
// temp !{}
|
||||||
MDTuple *Op = MDTuple::getTemporary(Context, None).release();
|
MDTuple *Op = MDTuple::getTemporary(Context, std::nullopt).release();
|
||||||
EXPECT_FALSE(Op->isResolved());
|
EXPECT_FALSE(Op->isResolved());
|
||||||
|
|
||||||
// temp !{temp !{}}
|
// temp !{temp !{}}
|
||||||
|
@ -836,7 +836,7 @@ TEST_F(MDNodeTest, replaceWithUniquedChangedOperand) {
|
||||||
|
|
||||||
TEST_F(MDNodeTest, replaceWithDistinct) {
|
TEST_F(MDNodeTest, replaceWithDistinct) {
|
||||||
{
|
{
|
||||||
auto *Empty = MDTuple::get(Context, None);
|
auto *Empty = MDTuple::get(Context, std::nullopt);
|
||||||
Metadata *Ops[] = {Empty};
|
Metadata *Ops[] = {Empty};
|
||||||
auto Temp = MDTuple::getTemporary(Context, Ops);
|
auto Temp = MDTuple::getTemporary(Context, Ops);
|
||||||
EXPECT_TRUE(Temp->isTemporary());
|
EXPECT_TRUE(Temp->isTemporary());
|
||||||
|
@ -849,7 +849,7 @@ TEST_F(MDNodeTest, replaceWithDistinct) {
|
||||||
EXPECT_EQ(Current, Distinct);
|
EXPECT_EQ(Current, Distinct);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto Unresolved = MDTuple::getTemporary(Context, None);
|
auto Unresolved = MDTuple::getTemporary(Context, std::nullopt);
|
||||||
Metadata *Ops[] = {Unresolved.get()};
|
Metadata *Ops[] = {Unresolved.get()};
|
||||||
auto Temp = MDTuple::getTemporary(Context, Ops);
|
auto Temp = MDTuple::getTemporary(Context, Ops);
|
||||||
EXPECT_TRUE(Temp->isTemporary());
|
EXPECT_TRUE(Temp->isTemporary());
|
||||||
|
@ -908,7 +908,7 @@ TEST_F(MDNodeTest, deleteTemporaryWithTrackingRef) {
|
||||||
TrackingMDRef Ref;
|
TrackingMDRef Ref;
|
||||||
EXPECT_EQ(nullptr, Ref.get());
|
EXPECT_EQ(nullptr, Ref.get());
|
||||||
{
|
{
|
||||||
auto Temp = MDTuple::getTemporary(Context, None);
|
auto Temp = MDTuple::getTemporary(Context, std::nullopt);
|
||||||
Ref.reset(Temp.get());
|
Ref.reset(Temp.get());
|
||||||
EXPECT_EQ(Temp.get(), Ref.get());
|
EXPECT_EQ(Temp.get(), Ref.get());
|
||||||
}
|
}
|
||||||
|
@ -1100,14 +1100,14 @@ TEST_F(DILocationTest, getDistinct) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DILocationTest, getTemporary) {
|
TEST_F(DILocationTest, getTemporary) {
|
||||||
MDNode *N = MDNode::get(Context, None);
|
MDNode *N = MDNode::get(Context, std::nullopt);
|
||||||
auto L = DILocation::getTemporary(Context, 2, 7, N);
|
auto L = DILocation::getTemporary(Context, 2, 7, N);
|
||||||
EXPECT_TRUE(L->isTemporary());
|
EXPECT_TRUE(L->isTemporary());
|
||||||
EXPECT_FALSE(L->isResolved());
|
EXPECT_FALSE(L->isResolved());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DILocationTest, cloneTemporary) {
|
TEST_F(DILocationTest, cloneTemporary) {
|
||||||
MDNode *N = MDNode::get(Context, None);
|
MDNode *N = MDNode::get(Context, std::nullopt);
|
||||||
auto L = DILocation::getTemporary(Context, 2, 7, N);
|
auto L = DILocation::getTemporary(Context, 2, 7, N);
|
||||||
EXPECT_TRUE(L->isTemporary());
|
EXPECT_TRUE(L->isTemporary());
|
||||||
auto L2 = L->clone();
|
auto L2 = L->clone();
|
||||||
|
@ -1163,15 +1163,14 @@ TEST_F(DILocationTest, discriminatorEncoding) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DILocationTest, discriminatorEncodingNegativeTests) {
|
TEST_F(DILocationTest, discriminatorEncodingNegativeTests) {
|
||||||
EXPECT_EQ(None, DILocation::encodeDiscriminator(0, 0, 0x1000));
|
EXPECT_EQ(std::nullopt, DILocation::encodeDiscriminator(0, 0, 0x1000));
|
||||||
EXPECT_EQ(None, DILocation::encodeDiscriminator(0x1000, 0, 0));
|
EXPECT_EQ(std::nullopt, DILocation::encodeDiscriminator(0x1000, 0, 0));
|
||||||
EXPECT_EQ(None, DILocation::encodeDiscriminator(0, 0x1000, 0));
|
EXPECT_EQ(std::nullopt, DILocation::encodeDiscriminator(0, 0x1000, 0));
|
||||||
EXPECT_EQ(None, DILocation::encodeDiscriminator(0, 0, 0x1000));
|
EXPECT_EQ(std::nullopt, DILocation::encodeDiscriminator(0, 0, 0x1000));
|
||||||
EXPECT_EQ(None, DILocation::encodeDiscriminator(0x1ff, 0x1ff, 8));
|
EXPECT_EQ(std::nullopt, DILocation::encodeDiscriminator(0x1ff, 0x1ff, 8));
|
||||||
EXPECT_EQ(None,
|
EXPECT_EQ(std::nullopt, DILocation::encodeDiscriminator(
|
||||||
DILocation::encodeDiscriminator(std::numeric_limits<uint32_t>::max(),
|
std::numeric_limits<uint32_t>::max(),
|
||||||
std::numeric_limits<uint32_t>::max(),
|
std::numeric_limits<uint32_t>::max(), 0));
|
||||||
0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DILocationTest, discriminatorSpecialCases) {
|
TEST_F(DILocationTest, discriminatorSpecialCases) {
|
||||||
|
@ -1215,8 +1214,8 @@ TEST_F(DILocationTest, discriminatorSpecialCases) {
|
||||||
->getDuplicationFactor());
|
->getDuplicationFactor());
|
||||||
|
|
||||||
// Check we return None for unencodable cases.
|
// Check we return None for unencodable cases.
|
||||||
EXPECT_EQ(None, L4->cloneWithBaseDiscriminator(0x1000));
|
EXPECT_EQ(std::nullopt, L4->cloneWithBaseDiscriminator(0x1000));
|
||||||
EXPECT_EQ(None, L4->cloneByMultiplyingDuplicationFactor(0x1000));
|
EXPECT_EQ(std::nullopt, L4->cloneByMultiplyingDuplicationFactor(0x1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1224,7 +1223,7 @@ typedef MetadataTest GenericDINodeTest;
|
||||||
|
|
||||||
TEST_F(GenericDINodeTest, get) {
|
TEST_F(GenericDINodeTest, get) {
|
||||||
StringRef Header = "header";
|
StringRef Header = "header";
|
||||||
auto *Empty = MDNode::get(Context, None);
|
auto *Empty = MDNode::get(Context, std::nullopt);
|
||||||
Metadata *Ops1[] = {Empty};
|
Metadata *Ops1[] = {Empty};
|
||||||
auto *N = GenericDINode::get(Context, 15, Header, Ops1);
|
auto *N = GenericDINode::get(Context, 15, Header, Ops1);
|
||||||
EXPECT_EQ(15u, N->getTag());
|
EXPECT_EQ(15u, N->getTag());
|
||||||
|
@ -1260,7 +1259,7 @@ TEST_F(GenericDINodeTest, get) {
|
||||||
|
|
||||||
TEST_F(GenericDINodeTest, getEmptyHeader) {
|
TEST_F(GenericDINodeTest, getEmptyHeader) {
|
||||||
// Canonicalize !"" to null.
|
// Canonicalize !"" to null.
|
||||||
auto *N = GenericDINode::get(Context, 15, StringRef(), None);
|
auto *N = GenericDINode::get(Context, 15, StringRef(), std::nullopt);
|
||||||
EXPECT_EQ(StringRef(), N->getHeader());
|
EXPECT_EQ(StringRef(), N->getHeader());
|
||||||
EXPECT_EQ(nullptr, N->getOperand(0));
|
EXPECT_EQ(nullptr, N->getOperand(0));
|
||||||
}
|
}
|
||||||
|
@ -1966,7 +1965,7 @@ TEST_F(DICompositeTypeTest, replaceOperands) {
|
||||||
Context, Tag, Name, File, Line, Scope, BaseType, SizeInBits, AlignInBits,
|
Context, Tag, Name, File, Line, Scope, BaseType, SizeInBits, AlignInBits,
|
||||||
OffsetInBits, Flags, nullptr, RuntimeLang, nullptr, nullptr, Identifier);
|
OffsetInBits, Flags, nullptr, RuntimeLang, nullptr, nullptr, Identifier);
|
||||||
|
|
||||||
auto *Elements = MDTuple::getDistinct(Context, None);
|
auto *Elements = MDTuple::getDistinct(Context, std::nullopt);
|
||||||
EXPECT_EQ(nullptr, N->getElements().get());
|
EXPECT_EQ(nullptr, N->getElements().get());
|
||||||
N->replaceElements(Elements);
|
N->replaceElements(Elements);
|
||||||
EXPECT_EQ(Elements, N->getElements().get());
|
EXPECT_EQ(Elements, N->getElements().get());
|
||||||
|
@ -1985,7 +1984,7 @@ TEST_F(DICompositeTypeTest, replaceOperands) {
|
||||||
N->replaceVTableHolder(nullptr);
|
N->replaceVTableHolder(nullptr);
|
||||||
EXPECT_EQ(nullptr, N->getVTableHolder());
|
EXPECT_EQ(nullptr, N->getVTableHolder());
|
||||||
|
|
||||||
auto *TemplateParams = MDTuple::getDistinct(Context, None);
|
auto *TemplateParams = MDTuple::getDistinct(Context, std::nullopt);
|
||||||
EXPECT_EQ(nullptr, N->getTemplateParams().get());
|
EXPECT_EQ(nullptr, N->getTemplateParams().get());
|
||||||
N->replaceTemplateParams(TemplateParams);
|
N->replaceTemplateParams(TemplateParams);
|
||||||
EXPECT_EQ(TemplateParams, N->getTemplateParams().get());
|
EXPECT_EQ(TemplateParams, N->getTemplateParams().get());
|
||||||
|
@ -2303,9 +2302,9 @@ TEST_F(DICompileUnitTest, replaceArrays) {
|
||||||
unsigned RuntimeVersion = 2;
|
unsigned RuntimeVersion = 2;
|
||||||
StringRef SplitDebugFilename = "another/file";
|
StringRef SplitDebugFilename = "another/file";
|
||||||
auto EmissionKind = DICompileUnit::FullDebug;
|
auto EmissionKind = DICompileUnit::FullDebug;
|
||||||
MDTuple *EnumTypes = MDTuple::getDistinct(Context, None);
|
MDTuple *EnumTypes = MDTuple::getDistinct(Context, std::nullopt);
|
||||||
MDTuple *RetainedTypes = MDTuple::getDistinct(Context, None);
|
MDTuple *RetainedTypes = MDTuple::getDistinct(Context, std::nullopt);
|
||||||
MDTuple *ImportedEntities = MDTuple::getDistinct(Context, None);
|
MDTuple *ImportedEntities = MDTuple::getDistinct(Context, std::nullopt);
|
||||||
uint64_t DWOId = 0xc0ffee;
|
uint64_t DWOId = 0xc0ffee;
|
||||||
StringRef SysRoot = "/";
|
StringRef SysRoot = "/";
|
||||||
StringRef SDK = "MacOSX.sdk";
|
StringRef SDK = "MacOSX.sdk";
|
||||||
|
@ -2315,14 +2314,14 @@ TEST_F(DICompileUnitTest, replaceArrays) {
|
||||||
RetainedTypes, nullptr, ImportedEntities, nullptr, DWOId, true, false,
|
RetainedTypes, nullptr, ImportedEntities, nullptr, DWOId, true, false,
|
||||||
DICompileUnit::DebugNameTableKind::Default, false, SysRoot, SDK);
|
DICompileUnit::DebugNameTableKind::Default, false, SysRoot, SDK);
|
||||||
|
|
||||||
auto *GlobalVariables = MDTuple::getDistinct(Context, None);
|
auto *GlobalVariables = MDTuple::getDistinct(Context, std::nullopt);
|
||||||
EXPECT_EQ(nullptr, N->getGlobalVariables().get());
|
EXPECT_EQ(nullptr, N->getGlobalVariables().get());
|
||||||
N->replaceGlobalVariables(GlobalVariables);
|
N->replaceGlobalVariables(GlobalVariables);
|
||||||
EXPECT_EQ(GlobalVariables, N->getGlobalVariables().get());
|
EXPECT_EQ(GlobalVariables, N->getGlobalVariables().get());
|
||||||
N->replaceGlobalVariables(nullptr);
|
N->replaceGlobalVariables(nullptr);
|
||||||
EXPECT_EQ(nullptr, N->getGlobalVariables().get());
|
EXPECT_EQ(nullptr, N->getGlobalVariables().get());
|
||||||
|
|
||||||
auto *Macros = MDTuple::getDistinct(Context, None);
|
auto *Macros = MDTuple::getDistinct(Context, std::nullopt);
|
||||||
EXPECT_EQ(nullptr, N->getMacros().get());
|
EXPECT_EQ(nullptr, N->getMacros().get());
|
||||||
N->replaceMacros(Macros);
|
N->replaceMacros(Macros);
|
||||||
EXPECT_EQ(Macros, N->getMacros().get());
|
EXPECT_EQ(Macros, N->getMacros().get());
|
||||||
|
@ -2972,7 +2971,7 @@ TEST_F(DIExpressionTest, isValid) {
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
// Empty expression should be valid.
|
// Empty expression should be valid.
|
||||||
EXPECT_TRUE(DIExpression::get(Context, None));
|
EXPECT_TRUE(DIExpression::get(Context, std::nullopt));
|
||||||
|
|
||||||
// Valid constructions.
|
// Valid constructions.
|
||||||
EXPECT_VALID(dwarf::DW_OP_plus_uconst, 6);
|
EXPECT_VALID(dwarf::DW_OP_plus_uconst, 6);
|
||||||
|
@ -3258,7 +3257,7 @@ TEST_F(DIImportedEntityTest, get) {
|
||||||
typedef MetadataTest MetadataAsValueTest;
|
typedef MetadataTest MetadataAsValueTest;
|
||||||
|
|
||||||
TEST_F(MetadataAsValueTest, MDNode) {
|
TEST_F(MetadataAsValueTest, MDNode) {
|
||||||
MDNode *N = MDNode::get(Context, None);
|
MDNode *N = MDNode::get(Context, std::nullopt);
|
||||||
auto *V = MetadataAsValue::get(Context, N);
|
auto *V = MetadataAsValue::get(Context, N);
|
||||||
EXPECT_TRUE(V->getType()->isMetadataTy());
|
EXPECT_TRUE(V->getType()->isMetadataTy());
|
||||||
EXPECT_EQ(N, V->getMetadata());
|
EXPECT_EQ(N, V->getMetadata());
|
||||||
|
@ -3268,7 +3267,7 @@ TEST_F(MetadataAsValueTest, MDNode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MetadataAsValueTest, MDNodeMDNode) {
|
TEST_F(MetadataAsValueTest, MDNodeMDNode) {
|
||||||
MDNode *N = MDNode::get(Context, None);
|
MDNode *N = MDNode::get(Context, std::nullopt);
|
||||||
Metadata *Ops[] = {N};
|
Metadata *Ops[] = {N};
|
||||||
MDNode *N2 = MDNode::get(Context, Ops);
|
MDNode *N2 = MDNode::get(Context, Ops);
|
||||||
auto *V = MetadataAsValue::get(Context, N2);
|
auto *V = MetadataAsValue::get(Context, N2);
|
||||||
|
@ -3320,7 +3319,7 @@ TEST_F(ValueAsMetadataTest, TempTempReplacement) {
|
||||||
ConstantAsMetadata *CI =
|
ConstantAsMetadata *CI =
|
||||||
ConstantAsMetadata::get(ConstantInt::get(Context, APInt(8, 0)));
|
ConstantAsMetadata::get(ConstantInt::get(Context, APInt(8, 0)));
|
||||||
|
|
||||||
auto Temp1 = MDTuple::getTemporary(Context, None);
|
auto Temp1 = MDTuple::getTemporary(Context, std::nullopt);
|
||||||
auto Temp2 = MDTuple::getTemporary(Context, {CI});
|
auto Temp2 = MDTuple::getTemporary(Context, {CI});
|
||||||
auto *N = MDTuple::get(Context, {Temp1.get()});
|
auto *N = MDTuple::get(Context, {Temp1.get()});
|
||||||
|
|
||||||
|
@ -3338,7 +3337,7 @@ TEST_F(ValueAsMetadataTest, CollidingDoubleUpdates) {
|
||||||
ConstantAsMetadata::get(ConstantInt::get(Context, APInt(8, 0)));
|
ConstantAsMetadata::get(ConstantInt::get(Context, APInt(8, 0)));
|
||||||
|
|
||||||
// Create a temporary to prevent nodes from resolving.
|
// Create a temporary to prevent nodes from resolving.
|
||||||
auto Temp = MDTuple::getTemporary(Context, None);
|
auto Temp = MDTuple::getTemporary(Context, std::nullopt);
|
||||||
|
|
||||||
// When the first operand of N1 gets reset to nullptr, it'll collide with N2.
|
// When the first operand of N1 gets reset to nullptr, it'll collide with N2.
|
||||||
Metadata *Ops1[] = {CI, CI, Temp.get()};
|
Metadata *Ops1[] = {CI, CI, Temp.get()};
|
||||||
|
@ -3604,7 +3603,7 @@ TEST_F(DistinctMDOperandPlaceholderTest, replaceUseWith) {
|
||||||
ASSERT_EQ(&PH2, D->getOperand(2));
|
ASSERT_EQ(&PH2, D->getOperand(2));
|
||||||
|
|
||||||
// Replace them.
|
// Replace them.
|
||||||
auto *N0 = MDTuple::get(Context, None);
|
auto *N0 = MDTuple::get(Context, std::nullopt);
|
||||||
auto *N1 = MDTuple::get(Context, N0);
|
auto *N1 = MDTuple::get(Context, N0);
|
||||||
PH0.replaceUseWith(N0);
|
PH0.replaceUseWith(N0);
|
||||||
PH1.replaceUseWith(N1);
|
PH1.replaceUseWith(N1);
|
||||||
|
@ -3616,7 +3615,8 @@ TEST_F(DistinctMDOperandPlaceholderTest, replaceUseWith) {
|
||||||
|
|
||||||
TEST_F(DistinctMDOperandPlaceholderTest, replaceUseWithNoUser) {
|
TEST_F(DistinctMDOperandPlaceholderTest, replaceUseWithNoUser) {
|
||||||
// There is no user, but we can still call replace.
|
// There is no user, but we can still call replace.
|
||||||
DistinctMDOperandPlaceholder(7).replaceUseWith(MDTuple::get(Context, None));
|
DistinctMDOperandPlaceholder(7).replaceUseWith(
|
||||||
|
MDTuple::get(Context, std::nullopt));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test various assertions in metadata tracking. Don't run these tests if gtest
|
// Test various assertions in metadata tracking. Don't run these tests if gtest
|
||||||
|
@ -3683,9 +3683,9 @@ TEST_F(DebugVariableTest, DenseMap) {
|
||||||
DILocalVariable *VarB =
|
DILocalVariable *VarB =
|
||||||
DILocalVariable::get(Context, Scope, "B", File, 7, Type, 3, Flags, 8, nullptr);
|
DILocalVariable::get(Context, Scope, "B", File, 7, Type, 3, Flags, 8, nullptr);
|
||||||
|
|
||||||
DebugVariable DebugVariableA(VarA, None, nullptr);
|
DebugVariable DebugVariableA(VarA, std::nullopt, nullptr);
|
||||||
DebugVariable DebugVariableInlineA(VarA, None, InlinedLoc);
|
DebugVariable DebugVariableInlineA(VarA, std::nullopt, InlinedLoc);
|
||||||
DebugVariable DebugVariableB(VarB, None, nullptr);
|
DebugVariable DebugVariableB(VarB, std::nullopt, nullptr);
|
||||||
DebugVariable DebugVariableFragB(VarB, {{16, 16}}, nullptr);
|
DebugVariable DebugVariableFragB(VarB, {{16, 16}}, nullptr);
|
||||||
|
|
||||||
DebugVariableMap.insert({DebugVariableA, 2});
|
DebugVariableMap.insert({DebugVariableA, 2});
|
||||||
|
@ -3782,7 +3782,7 @@ TEST_F(MDTupleAllocationTest, Resize) {
|
||||||
EXPECT_EQ(B->getOperand(3), Value5);
|
EXPECT_EQ(B->getOperand(3), Value5);
|
||||||
|
|
||||||
// Check that we can resize temporary nodes as well.
|
// Check that we can resize temporary nodes as well.
|
||||||
auto Temp1 = MDTuple::getTemporary(Context, None);
|
auto Temp1 = MDTuple::getTemporary(Context, std::nullopt);
|
||||||
EXPECT_EQ(Temp1->getNumOperands(), 0u);
|
EXPECT_EQ(Temp1->getNumOperands(), 0u);
|
||||||
|
|
||||||
Temp1->push_back(Value1);
|
Temp1->push_back(Value1);
|
||||||
|
|
|
@ -462,8 +462,8 @@ protected:
|
||||||
"exit:\n"
|
"exit:\n"
|
||||||
" ret void\n"
|
" ret void\n"
|
||||||
"}\n")),
|
"}\n")),
|
||||||
CallbacksHandle(),
|
CallbacksHandle(), PB(nullptr, PipelineTuningOptions(), std::nullopt,
|
||||||
PB(nullptr, PipelineTuningOptions(), None, &CallbacksHandle.Callbacks),
|
&CallbacksHandle.Callbacks),
|
||||||
PM(), LAM(), FAM(), CGAM(), AM() {
|
PM(), LAM(), FAM(), CGAM(), AM() {
|
||||||
|
|
||||||
EXPECT_TRUE(&CallbacksHandle.Callbacks ==
|
EXPECT_TRUE(&CallbacksHandle.Callbacks ==
|
||||||
|
|
|
@ -240,7 +240,7 @@ TEST(VerifierTest, DetectInvalidDebugInfo) {
|
||||||
|
|
||||||
TEST(VerifierTest, MDNodeWrongContext) {
|
TEST(VerifierTest, MDNodeWrongContext) {
|
||||||
LLVMContext C1, C2;
|
LLVMContext C1, C2;
|
||||||
auto *Node = MDNode::get(C1, None);
|
auto *Node = MDNode::get(C1, std::nullopt);
|
||||||
|
|
||||||
Module M("M", C2);
|
Module M("M", C2);
|
||||||
auto *NamedNode = M.getOrInsertNamedMetadata("test");
|
auto *NamedNode = M.getOrInsertNamedMetadata("test");
|
||||||
|
|
|
@ -37,8 +37,9 @@ createTargetMachine(std::string TStr, StringRef CPU, StringRef FS) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
|
return std::unique_ptr<LLVMTargetMachine>(
|
||||||
T->createTargetMachine(TStr, CPU, FS, Options, None, None)));
|
static_cast<LLVMTargetMachine *>(T->createTargetMachine(
|
||||||
|
TStr, CPU, FS, Options, std::nullopt, std::nullopt)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(AMDGPUDwarfRegMappingTests, TestWave64DwarfRegMapping) {
|
TEST(AMDGPUDwarfRegMappingTests, TestWave64DwarfRegMapping) {
|
||||||
|
|
|
@ -118,10 +118,10 @@ public:
|
||||||
TheStreamer->switchSection(C.MOFI->getDwarfLineSection());
|
TheStreamer->switchSection(C.MOFI->getDwarfLineSection());
|
||||||
MCDwarfLineTableHeader Header;
|
MCDwarfLineTableHeader Header;
|
||||||
MCDwarfLineTableParams Params = Assembler.getDWARFLinetableParams();
|
MCDwarfLineTableParams Params = Assembler.getDWARFLinetableParams();
|
||||||
Optional<MCDwarfLineStr> LineStr(None);
|
Optional<MCDwarfLineStr> LineStr(std::nullopt);
|
||||||
if (Ctx.getDwarfVersion() >= 5) {
|
if (Ctx.getDwarfVersion() >= 5) {
|
||||||
LineStr.emplace(Ctx);
|
LineStr.emplace(Ctx);
|
||||||
Header.setRootFile("dir", "file", None, None);
|
Header.setRootFile("dir", "file", std::nullopt, std::nullopt);
|
||||||
}
|
}
|
||||||
MCSymbol *LineEndSym = Header.Emit(TheStreamer, Params, LineStr).second;
|
MCSymbol *LineEndSym = Header.Emit(TheStreamer, Params, LineStr).second;
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@ using namespace llvm;
|
||||||
|
|
||||||
TEST(MCDisassembler, XCOFFSymbolPriorityTest) {
|
TEST(MCDisassembler, XCOFFSymbolPriorityTest) {
|
||||||
|
|
||||||
SymbolInfoTy SIT1(0x100000, "sym1", None, 1, false);
|
SymbolInfoTy SIT1(0x100000, "sym1", std::nullopt, 1, false);
|
||||||
SymbolInfoTy SIT2(0x110000, "sym2", None, 2, false);
|
SymbolInfoTy SIT2(0x110000, "sym2", std::nullopt, 2, false);
|
||||||
SymbolInfoTy SIT3(0x120000, ".func", XCOFF::XMC_PR, 3, true);
|
SymbolInfoTy SIT3(0x120000, ".func", XCOFF::XMC_PR, 3, true);
|
||||||
SymbolInfoTy SIT4(0x120000, ".text", XCOFF::XMC_PR, 4, false);
|
SymbolInfoTy SIT4(0x120000, ".text", XCOFF::XMC_PR, 4, false);
|
||||||
SymbolInfoTy SIT5(0x130000, "TOC", XCOFF::XMC_TC0, 5, false);
|
SymbolInfoTy SIT5(0x130000, "TOC", XCOFF::XMC_TC0, 5, false);
|
||||||
|
|
|
@ -44,9 +44,9 @@ std::unique_ptr<LLVMTargetMachine> createTargetMachine() {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine*>(
|
return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
|
||||||
T->createTargetMachine("AMDGPU", "gfx900", "", Options, None, None,
|
T->createTargetMachine("AMDGPU", "gfx900", "", Options, std::nullopt,
|
||||||
CodeGenOpt::Aggressive)));
|
std::nullopt, CodeGenOpt::Aggressive)));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Module> parseMIR(LLVMContext &Context,
|
std::unique_ptr<Module> parseMIR(LLVMContext &Context,
|
||||||
|
|
|
@ -72,8 +72,9 @@ protected:
|
||||||
if (!T)
|
if (!T)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
|
return std::unique_ptr<LLVMTargetMachine>(
|
||||||
T->createTargetMachine(TT, CPU, FS, Options, None, None)));
|
static_cast<LLVMTargetMachine *>(T->createTargetMachine(
|
||||||
|
TT, CPU, FS, Options, std::nullopt, std::nullopt)));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Module> parseMIR(const TargetMachine &TM, StringRef MIRCode,
|
std::unique_ptr<Module> parseMIR(const TargetMachine &TM, StringRef MIRCode,
|
||||||
|
|
|
@ -703,7 +703,8 @@ Sections:
|
||||||
};
|
};
|
||||||
|
|
||||||
// Check that we can retrieve the data in the normal case.
|
// Check that we can retrieve the data in the normal case.
|
||||||
DoCheckSucceeds(CommonYamlString, /*TextSectionIndex=*/None, AllBBAddrMaps);
|
DoCheckSucceeds(CommonYamlString, /*TextSectionIndex=*/std::nullopt,
|
||||||
|
AllBBAddrMaps);
|
||||||
DoCheckSucceeds(CommonYamlString, /*TextSectionIndex=*/0, Section0BBAddrMaps);
|
DoCheckSucceeds(CommonYamlString, /*TextSectionIndex=*/0, Section0BBAddrMaps);
|
||||||
DoCheckSucceeds(CommonYamlString, /*TextSectionIndex=*/1, Section1BBAddrMaps);
|
DoCheckSucceeds(CommonYamlString, /*TextSectionIndex=*/1, Section1BBAddrMaps);
|
||||||
// Check that when no bb-address-map section is found for a text section,
|
// Check that when no bb-address-map section is found for a text section,
|
||||||
|
@ -723,7 +724,7 @@ Sections:
|
||||||
"index: 10");
|
"index: 10");
|
||||||
// Linked sections are not checked when we don't target a specific text
|
// Linked sections are not checked when we don't target a specific text
|
||||||
// section.
|
// section.
|
||||||
DoCheckSucceeds(InvalidLinkedYamlString, /*TextSectionIndex=*/None,
|
DoCheckSucceeds(InvalidLinkedYamlString, /*TextSectionIndex=*/std::nullopt,
|
||||||
AllBBAddrMaps);
|
AllBBAddrMaps);
|
||||||
|
|
||||||
// Check that we can detect when bb-address-map decoding fails.
|
// Check that we can detect when bb-address-map decoding fails.
|
||||||
|
@ -732,7 +733,7 @@ Sections:
|
||||||
ShSize: 0x8
|
ShSize: 0x8
|
||||||
)";
|
)";
|
||||||
|
|
||||||
DoCheckFails(TruncatedYamlString, /*TextSectionIndex=*/None,
|
DoCheckFails(TruncatedYamlString, /*TextSectionIndex=*/std::nullopt,
|
||||||
"unable to read SHT_LLVM_BB_ADDR_MAP_V0 section with index 3: "
|
"unable to read SHT_LLVM_BB_ADDR_MAP_V0 section with index 3: "
|
||||||
"unable to decode LEB128 at offset 0x00000008: malformed "
|
"unable to decode LEB128 at offset 0x00000008: malformed "
|
||||||
"uleb128, extends past end");
|
"uleb128, extends past end");
|
||||||
|
|
|
@ -200,7 +200,7 @@ TEST(MinidumpFile, IngoresDummyStreams) {
|
||||||
ASSERT_EQ(2u, File.streams().size());
|
ASSERT_EQ(2u, File.streams().size());
|
||||||
EXPECT_EQ(StreamType::Unused, File.streams()[0].Type);
|
EXPECT_EQ(StreamType::Unused, File.streams()[0].Type);
|
||||||
EXPECT_EQ(StreamType::Unused, File.streams()[1].Type);
|
EXPECT_EQ(StreamType::Unused, File.streams()[1].Type);
|
||||||
EXPECT_EQ(None, File.getRawStream(StreamType::Unused));
|
EXPECT_EQ(std::nullopt, File.getRawStream(StreamType::Unused));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(MinidumpFile, getSystemInfo) {
|
TEST(MinidumpFile, getSystemInfo) {
|
||||||
|
|
|
@ -67,15 +67,16 @@ static void check(remarks::SerializerMode Mode, const remarks::Remark &R,
|
||||||
|
|
||||||
static void check(const remarks::Remark &R, StringRef ExpectedR,
|
static void check(const remarks::Remark &R, StringRef ExpectedR,
|
||||||
StringRef ExpectedMeta,
|
StringRef ExpectedMeta,
|
||||||
Optional<remarks::StringTable> StrTab = None) {
|
Optional<remarks::StringTable> StrTab = std::nullopt) {
|
||||||
return check(remarks::SerializerMode::Separate, R, ExpectedR, ExpectedMeta,
|
return check(remarks::SerializerMode::Separate, R, ExpectedR, ExpectedMeta,
|
||||||
std::move(StrTab));
|
std::move(StrTab));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void checkStandalone(const remarks::Remark &R, StringRef ExpectedR,
|
static void
|
||||||
Optional<remarks::StringTable> StrTab = None) {
|
checkStandalone(const remarks::Remark &R, StringRef ExpectedR,
|
||||||
|
Optional<remarks::StringTable> StrTab = std::nullopt) {
|
||||||
return check(remarks::SerializerMode::Standalone, R, ExpectedR,
|
return check(remarks::SerializerMode::Standalone, R, ExpectedR,
|
||||||
/*ExpectedMeta=*/None, std::move(StrTab));
|
/*ExpectedMeta=*/std::nullopt, std::move(StrTab));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BitstreamRemarkSerializer, SeparateRemarkFileNoOptionals) {
|
TEST(BitstreamRemarkSerializer, SeparateRemarkFileNoOptionals) {
|
||||||
|
|
|
@ -68,14 +68,15 @@ enum class CmpType {
|
||||||
Contains
|
Contains
|
||||||
};
|
};
|
||||||
|
|
||||||
void parseExpectErrorMeta(StringRef Buf, const char *Error, CmpType Cmp,
|
void parseExpectErrorMeta(
|
||||||
Optional<StringRef> ExternalFilePrependPath = None) {
|
StringRef Buf, const char *Error, CmpType Cmp,
|
||||||
|
Optional<StringRef> ExternalFilePrependPath = std::nullopt) {
|
||||||
std::string ErrorStr;
|
std::string ErrorStr;
|
||||||
raw_string_ostream Stream(ErrorStr);
|
raw_string_ostream Stream(ErrorStr);
|
||||||
|
|
||||||
Expected<std::unique_ptr<remarks::RemarkParser>> MaybeParser =
|
Expected<std::unique_ptr<remarks::RemarkParser>> MaybeParser =
|
||||||
remarks::createRemarkParserFromMeta(remarks::Format::YAML, Buf,
|
remarks::createRemarkParserFromMeta(remarks::Format::YAML, Buf,
|
||||||
/*StrTab=*/None,
|
/*StrTab=*/std::nullopt,
|
||||||
std::move(ExternalFilePrependPath));
|
std::move(ExternalFilePrependPath));
|
||||||
handleAllErrors(MaybeParser.takeError(),
|
handleAllErrors(MaybeParser.takeError(),
|
||||||
[&](const ErrorInfoBase &EIB) { EIB.log(Stream); });
|
[&](const ErrorInfoBase &EIB) { EIB.log(Stream); });
|
||||||
|
|
|
@ -25,7 +25,7 @@ using namespace llvm;
|
||||||
static void check(remarks::Format SerializerFormat,
|
static void check(remarks::Format SerializerFormat,
|
||||||
remarks::SerializerMode Mode, ArrayRef<remarks::Remark> Rs,
|
remarks::SerializerMode Mode, ArrayRef<remarks::Remark> Rs,
|
||||||
StringRef ExpectedR, Optional<StringRef> ExpectedMeta,
|
StringRef ExpectedR, Optional<StringRef> ExpectedMeta,
|
||||||
Optional<remarks::StringTable> StrTab = None) {
|
Optional<remarks::StringTable> StrTab = std::nullopt) {
|
||||||
std::string Buf;
|
std::string Buf;
|
||||||
raw_string_ostream OS(Buf);
|
raw_string_ostream OS(Buf);
|
||||||
Expected<std::unique_ptr<remarks::RemarkSerializer>> MaybeS = [&] {
|
Expected<std::unique_ptr<remarks::RemarkSerializer>> MaybeS = [&] {
|
||||||
|
@ -53,18 +53,19 @@ static void check(remarks::Format SerializerFormat,
|
||||||
|
|
||||||
static void check(remarks::Format SerializerFormat, const remarks::Remark &R,
|
static void check(remarks::Format SerializerFormat, const remarks::Remark &R,
|
||||||
StringRef ExpectedR, StringRef ExpectedMeta,
|
StringRef ExpectedR, StringRef ExpectedMeta,
|
||||||
Optional<remarks::StringTable> StrTab = None) {
|
Optional<remarks::StringTable> StrTab = std::nullopt) {
|
||||||
return check(SerializerFormat, remarks::SerializerMode::Separate,
|
return check(SerializerFormat, remarks::SerializerMode::Separate,
|
||||||
makeArrayRef(&R, &R + 1), ExpectedR, ExpectedMeta,
|
makeArrayRef(&R, &R + 1), ExpectedR, ExpectedMeta,
|
||||||
std::move(StrTab));
|
std::move(StrTab));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void checkStandalone(remarks::Format SerializerFormat,
|
static void
|
||||||
const remarks::Remark &R, StringRef ExpectedR,
|
checkStandalone(remarks::Format SerializerFormat, const remarks::Remark &R,
|
||||||
Optional<remarks::StringTable> StrTab = None) {
|
StringRef ExpectedR,
|
||||||
|
Optional<remarks::StringTable> StrTab = std::nullopt) {
|
||||||
return check(SerializerFormat, remarks::SerializerMode::Standalone,
|
return check(SerializerFormat, remarks::SerializerMode::Standalone,
|
||||||
makeArrayRef(&R, &R + 1), ExpectedR,
|
makeArrayRef(&R, &R + 1), ExpectedR,
|
||||||
/*ExpectedMeta=*/None, std::move(StrTab));
|
/*ExpectedMeta=*/std::nullopt, std::move(StrTab));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(YAMLRemarks, SerializerRemark) {
|
TEST(YAMLRemarks, SerializerRemark) {
|
||||||
|
@ -325,5 +326,5 @@ TEST(YAMLRemarks, SerializerRemarkParsedStrTabStandaloneMultipleRemarks) {
|
||||||
" DebugLoc: { File: 6, Line: 6, Column: 7 }\n"
|
" DebugLoc: { File: 6, Line: 6, Column: 7 }\n"
|
||||||
"...\n",
|
"...\n",
|
||||||
561),
|
561),
|
||||||
/*ExpectedMeta=*/None, std::move(PreFilledStrTab));
|
/*ExpectedMeta=*/std::nullopt, std::move(PreFilledStrTab));
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,75 +8,75 @@ namespace {
|
||||||
TEST(CheckedArithmetic, CheckedAdd) {
|
TEST(CheckedArithmetic, CheckedAdd) {
|
||||||
const int64_t Max = std::numeric_limits<int64_t>::max();
|
const int64_t Max = std::numeric_limits<int64_t>::max();
|
||||||
const int64_t Min = std::numeric_limits<int64_t>::min();
|
const int64_t Min = std::numeric_limits<int64_t>::min();
|
||||||
EXPECT_EQ(checkedAdd<int64_t>(Max, Max), None);
|
EXPECT_EQ(checkedAdd<int64_t>(Max, Max), std::nullopt);
|
||||||
EXPECT_EQ(checkedAdd<int64_t>(Min, -1), None);
|
EXPECT_EQ(checkedAdd<int64_t>(Min, -1), std::nullopt);
|
||||||
EXPECT_EQ(checkedAdd<int64_t>(Max, 1), None);
|
EXPECT_EQ(checkedAdd<int64_t>(Max, 1), std::nullopt);
|
||||||
EXPECT_EQ(checkedAdd<int64_t>(10, 1), Optional<int64_t>(11));
|
EXPECT_EQ(checkedAdd<int64_t>(10, 1), Optional<int64_t>(11));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CheckedArithmetic, CheckedAddSmall) {
|
TEST(CheckedArithmetic, CheckedAddSmall) {
|
||||||
const int16_t Max = std::numeric_limits<int16_t>::max();
|
const int16_t Max = std::numeric_limits<int16_t>::max();
|
||||||
const int16_t Min = std::numeric_limits<int16_t>::min();
|
const int16_t Min = std::numeric_limits<int16_t>::min();
|
||||||
EXPECT_EQ(checkedAdd<int16_t>(Max, Max), None);
|
EXPECT_EQ(checkedAdd<int16_t>(Max, Max), std::nullopt);
|
||||||
EXPECT_EQ(checkedAdd<int16_t>(Min, -1), None);
|
EXPECT_EQ(checkedAdd<int16_t>(Min, -1), std::nullopt);
|
||||||
EXPECT_EQ(checkedAdd<int16_t>(Max, 1), None);
|
EXPECT_EQ(checkedAdd<int16_t>(Max, 1), std::nullopt);
|
||||||
EXPECT_EQ(checkedAdd<int16_t>(10, 1), Optional<int64_t>(11));
|
EXPECT_EQ(checkedAdd<int16_t>(10, 1), Optional<int64_t>(11));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CheckedArithmetic, CheckedMul) {
|
TEST(CheckedArithmetic, CheckedMul) {
|
||||||
const int64_t Max = std::numeric_limits<int64_t>::max();
|
const int64_t Max = std::numeric_limits<int64_t>::max();
|
||||||
const int64_t Min = std::numeric_limits<int64_t>::min();
|
const int64_t Min = std::numeric_limits<int64_t>::min();
|
||||||
EXPECT_EQ(checkedMul<int64_t>(Max, 2), None);
|
EXPECT_EQ(checkedMul<int64_t>(Max, 2), std::nullopt);
|
||||||
EXPECT_EQ(checkedMul<int64_t>(Max, Max), None);
|
EXPECT_EQ(checkedMul<int64_t>(Max, Max), std::nullopt);
|
||||||
EXPECT_EQ(checkedMul<int64_t>(Min, 2), None);
|
EXPECT_EQ(checkedMul<int64_t>(Min, 2), std::nullopt);
|
||||||
EXPECT_EQ(checkedMul<int64_t>(10, 2), Optional<int64_t>(20));
|
EXPECT_EQ(checkedMul<int64_t>(10, 2), Optional<int64_t>(20));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CheckedArithmetic, CheckedMulAdd) {
|
TEST(CheckedArithmetic, CheckedMulAdd) {
|
||||||
const int64_t Max = std::numeric_limits<int64_t>::max();
|
const int64_t Max = std::numeric_limits<int64_t>::max();
|
||||||
const int64_t Min = std::numeric_limits<int64_t>::min();
|
const int64_t Min = std::numeric_limits<int64_t>::min();
|
||||||
EXPECT_EQ(checkedMulAdd<int64_t>(Max, 1, 2), None);
|
EXPECT_EQ(checkedMulAdd<int64_t>(Max, 1, 2), std::nullopt);
|
||||||
EXPECT_EQ(checkedMulAdd<int64_t>(1, 1, Max), None);
|
EXPECT_EQ(checkedMulAdd<int64_t>(1, 1, Max), std::nullopt);
|
||||||
EXPECT_EQ(checkedMulAdd<int64_t>(1, -1, Min), None);
|
EXPECT_EQ(checkedMulAdd<int64_t>(1, -1, Min), std::nullopt);
|
||||||
EXPECT_EQ(checkedMulAdd<int64_t>(10, 2, 3), Optional<int64_t>(23));
|
EXPECT_EQ(checkedMulAdd<int64_t>(10, 2, 3), Optional<int64_t>(23));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CheckedArithmetic, CheckedMulSmall) {
|
TEST(CheckedArithmetic, CheckedMulSmall) {
|
||||||
const int16_t Max = std::numeric_limits<int16_t>::max();
|
const int16_t Max = std::numeric_limits<int16_t>::max();
|
||||||
const int16_t Min = std::numeric_limits<int16_t>::min();
|
const int16_t Min = std::numeric_limits<int16_t>::min();
|
||||||
EXPECT_EQ(checkedMul<int16_t>(Max, 2), None);
|
EXPECT_EQ(checkedMul<int16_t>(Max, 2), std::nullopt);
|
||||||
EXPECT_EQ(checkedMul<int16_t>(Max, Max), None);
|
EXPECT_EQ(checkedMul<int16_t>(Max, Max), std::nullopt);
|
||||||
EXPECT_EQ(checkedMul<int16_t>(Min, 2), None);
|
EXPECT_EQ(checkedMul<int16_t>(Min, 2), std::nullopt);
|
||||||
EXPECT_EQ(checkedMul<int16_t>(10, 2), Optional<int16_t>(20));
|
EXPECT_EQ(checkedMul<int16_t>(10, 2), Optional<int16_t>(20));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CheckedArithmetic, CheckedMulAddSmall) {
|
TEST(CheckedArithmetic, CheckedMulAddSmall) {
|
||||||
const int16_t Max = std::numeric_limits<int16_t>::max();
|
const int16_t Max = std::numeric_limits<int16_t>::max();
|
||||||
const int16_t Min = std::numeric_limits<int16_t>::min();
|
const int16_t Min = std::numeric_limits<int16_t>::min();
|
||||||
EXPECT_EQ(checkedMulAdd<int16_t>(Max, 1, 2), None);
|
EXPECT_EQ(checkedMulAdd<int16_t>(Max, 1, 2), std::nullopt);
|
||||||
EXPECT_EQ(checkedMulAdd<int16_t>(1, 1, Max), None);
|
EXPECT_EQ(checkedMulAdd<int16_t>(1, 1, Max), std::nullopt);
|
||||||
EXPECT_EQ(checkedMulAdd<int16_t>(1, -1, Min), None);
|
EXPECT_EQ(checkedMulAdd<int16_t>(1, -1, Min), std::nullopt);
|
||||||
EXPECT_EQ(checkedMulAdd<int16_t>(10, 2, 3), Optional<int16_t>(23));
|
EXPECT_EQ(checkedMulAdd<int16_t>(10, 2, 3), Optional<int16_t>(23));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CheckedArithmetic, CheckedAddUnsigned) {
|
TEST(CheckedArithmetic, CheckedAddUnsigned) {
|
||||||
const uint64_t Max = std::numeric_limits<uint64_t>::max();
|
const uint64_t Max = std::numeric_limits<uint64_t>::max();
|
||||||
EXPECT_EQ(checkedAddUnsigned<uint64_t>(Max, Max), None);
|
EXPECT_EQ(checkedAddUnsigned<uint64_t>(Max, Max), std::nullopt);
|
||||||
EXPECT_EQ(checkedAddUnsigned<uint64_t>(Max, 1), None);
|
EXPECT_EQ(checkedAddUnsigned<uint64_t>(Max, 1), std::nullopt);
|
||||||
EXPECT_EQ(checkedAddUnsigned<uint64_t>(10, 1), Optional<uint64_t>(11));
|
EXPECT_EQ(checkedAddUnsigned<uint64_t>(10, 1), Optional<uint64_t>(11));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CheckedArithmetic, CheckedMulUnsigned) {
|
TEST(CheckedArithmetic, CheckedMulUnsigned) {
|
||||||
const uint64_t Max = std::numeric_limits<uint64_t>::max();
|
const uint64_t Max = std::numeric_limits<uint64_t>::max();
|
||||||
EXPECT_EQ(checkedMulUnsigned<uint64_t>(Max, 2), llvm::None);
|
EXPECT_EQ(checkedMulUnsigned<uint64_t>(Max, 2), std::nullopt);
|
||||||
EXPECT_EQ(checkedMulUnsigned<uint64_t>(Max, Max), llvm::None);
|
EXPECT_EQ(checkedMulUnsigned<uint64_t>(Max, Max), std::nullopt);
|
||||||
EXPECT_EQ(checkedMulUnsigned<uint64_t>(10, 2), Optional<uint64_t>(20));
|
EXPECT_EQ(checkedMulUnsigned<uint64_t>(10, 2), Optional<uint64_t>(20));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CheckedArithmetic, CheckedMulAddUnsigned) {
|
TEST(CheckedArithmetic, CheckedMulAddUnsigned) {
|
||||||
const uint64_t Max = std::numeric_limits<uint64_t>::max();
|
const uint64_t Max = std::numeric_limits<uint64_t>::max();
|
||||||
EXPECT_EQ(checkedMulAddUnsigned<uint64_t>(Max, 1, 2), None);
|
EXPECT_EQ(checkedMulAddUnsigned<uint64_t>(Max, 1, 2), std::nullopt);
|
||||||
EXPECT_EQ(checkedMulAddUnsigned<uint64_t>(1, 1, Max), None);
|
EXPECT_EQ(checkedMulAddUnsigned<uint64_t>(1, 1, Max), std::nullopt);
|
||||||
EXPECT_EQ(checkedMulAddUnsigned<uint64_t>(10, 2, 3), Optional<uint64_t>(23));
|
EXPECT_EQ(checkedMulAddUnsigned<uint64_t>(10, 2, 3), Optional<uint64_t>(23));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,8 @@ TEST(ConvertUTFTest, OddLengthInput) {
|
||||||
|
|
||||||
TEST(ConvertUTFTest, Empty) {
|
TEST(ConvertUTFTest, Empty) {
|
||||||
std::string Result;
|
std::string Result;
|
||||||
bool Success = convertUTF16ToUTF8String(llvm::ArrayRef<char>(None), Result);
|
bool Success =
|
||||||
|
convertUTF16ToUTF8String(llvm::ArrayRef<char>(std::nullopt), Result);
|
||||||
EXPECT_TRUE(Success);
|
EXPECT_TRUE(Success);
|
||||||
EXPECT_TRUE(Result.empty());
|
EXPECT_TRUE(Result.empty());
|
||||||
}
|
}
|
||||||
|
@ -96,7 +97,7 @@ TEST(ConvertUTFTest, HasUTF16BOM) {
|
||||||
HasBOM = hasUTF16ByteOrderMark(makeArrayRef("\xfe\xff\x00asdf", 6));
|
HasBOM = hasUTF16ByteOrderMark(makeArrayRef("\xfe\xff\x00asdf", 6));
|
||||||
EXPECT_TRUE(HasBOM);
|
EXPECT_TRUE(HasBOM);
|
||||||
|
|
||||||
HasBOM = hasUTF16ByteOrderMark(None);
|
HasBOM = hasUTF16ByteOrderMark(std::nullopt);
|
||||||
EXPECT_FALSE(HasBOM);
|
EXPECT_FALSE(HasBOM);
|
||||||
HasBOM = hasUTF16ByteOrderMark(makeArrayRef("\xfe", 1));
|
HasBOM = hasUTF16ByteOrderMark(makeArrayRef("\xfe", 1));
|
||||||
EXPECT_FALSE(HasBOM);
|
EXPECT_FALSE(HasBOM);
|
||||||
|
|
|
@ -1097,7 +1097,7 @@ TEST(Error, moveInto) {
|
||||||
|
|
||||||
// Failure with no prior value.
|
// Failure with no prior value.
|
||||||
EXPECT_THAT_ERROR(makeFailure().moveInto(V), Failed());
|
EXPECT_THAT_ERROR(makeFailure().moveInto(V), Failed());
|
||||||
EXPECT_EQ(None, V.Box);
|
EXPECT_EQ(std::nullopt, V.Box);
|
||||||
|
|
||||||
// Success with no prior value.
|
// Success with no prior value.
|
||||||
EXPECT_THAT_ERROR(make(5).moveInto(V), Succeeded());
|
EXPECT_THAT_ERROR(make(5).moveInto(V), Succeeded());
|
||||||
|
@ -1119,7 +1119,7 @@ TEST(Error, moveInto) {
|
||||||
// Same cases as above.
|
// Same cases as above.
|
||||||
Optional<MoveOnlyBox> MaybeV;
|
Optional<MoveOnlyBox> MaybeV;
|
||||||
EXPECT_THAT_ERROR(makeFailure().moveInto(MaybeV), Failed());
|
EXPECT_THAT_ERROR(makeFailure().moveInto(MaybeV), Failed());
|
||||||
EXPECT_EQ(None, MaybeV);
|
EXPECT_EQ(std::nullopt, MaybeV);
|
||||||
|
|
||||||
EXPECT_THAT_ERROR(make(5).moveInto(MaybeV), Succeeded());
|
EXPECT_THAT_ERROR(make(5).moveInto(MaybeV), Succeeded());
|
||||||
EXPECT_EQ(MoveOnlyBox(5), MaybeV);
|
EXPECT_EQ(MoveOnlyBox(5), MaybeV);
|
||||||
|
|
|
@ -388,8 +388,9 @@ static bool runAndGetCommandOutput(
|
||||||
StringRef OutputPath = OutputFile.str();
|
StringRef OutputPath = OutputFile.str();
|
||||||
|
|
||||||
const std::optional<StringRef> Redirects[] = {
|
const std::optional<StringRef> Redirects[] = {
|
||||||
/*STDIN=*/None, /*STDOUT=*/OutputPath, /*STDERR=*/None};
|
/*STDIN=*/std::nullopt, /*STDOUT=*/OutputPath, /*STDERR=*/std::nullopt};
|
||||||
int RetCode = ExecuteAndWait(ExePath, argv, /*env=*/llvm::None, Redirects);
|
int RetCode =
|
||||||
|
ExecuteAndWait(ExePath, argv, /*env=*/std::nullopt, Redirects);
|
||||||
ASSERT_EQ(0, RetCode);
|
ASSERT_EQ(0, RetCode);
|
||||||
|
|
||||||
int FD = 0;
|
int FD = 0;
|
||||||
|
|
|
@ -72,7 +72,7 @@ TEST_F(CostTest, Operators) {
|
||||||
|
|
||||||
// Test value extraction
|
// Test value extraction
|
||||||
EXPECT_EQ(*(VThree.getValue()), 3);
|
EXPECT_EQ(*(VThree.getValue()), 3);
|
||||||
EXPECT_EQ(IThreeA.getValue(), None);
|
EXPECT_EQ(IThreeA.getValue(), std::nullopt);
|
||||||
|
|
||||||
EXPECT_EQ(std::min(VThree, VNegTwo), -2);
|
EXPECT_EQ(std::min(VThree, VNegTwo), -2);
|
||||||
EXPECT_EQ(std::max(VThree, VSix), 6);
|
EXPECT_EQ(std::max(VThree, VSix), 6);
|
||||||
|
|
|
@ -49,7 +49,7 @@ TEST(JSONTest, Constructors) {
|
||||||
EXPECT_EQ("null", s(llvm::Optional<double>()));
|
EXPECT_EQ("null", s(llvm::Optional<double>()));
|
||||||
EXPECT_EQ("2.5", s(llvm::Optional<double>(2.5)));
|
EXPECT_EQ("2.5", s(llvm::Optional<double>(2.5)));
|
||||||
EXPECT_EQ("[[2.5,null]]", s(std::vector<std::vector<llvm::Optional<double>>>{
|
EXPECT_EQ("[[2.5,null]]", s(std::vector<std::vector<llvm::Optional<double>>>{
|
||||||
{2.5, llvm::None}}));
|
{2.5, std::nullopt}}));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(JSONTest, StringOwnership) {
|
TEST(JSONTest, StringOwnership) {
|
||||||
|
@ -301,49 +301,49 @@ TEST(JSONTest, Integers) {
|
||||||
llvm::Optional<int64_t> AsInt;
|
llvm::Optional<int64_t> AsInt;
|
||||||
llvm::Optional<double> AsNumber;
|
llvm::Optional<double> AsNumber;
|
||||||
} TestCases[] = {
|
} TestCases[] = {
|
||||||
{
|
{
|
||||||
"Non-integer. Stored as double, not convertible.",
|
"Non-integer. Stored as double, not convertible.",
|
||||||
double{1.5},
|
double{1.5},
|
||||||
"1.5",
|
"1.5",
|
||||||
llvm::None,
|
std::nullopt,
|
||||||
1.5,
|
1.5,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"Integer, not exact double. Stored as int64, convertible.",
|
"Integer, not exact double. Stored as int64, convertible.",
|
||||||
int64_t{0x4000000000000001},
|
int64_t{0x4000000000000001},
|
||||||
"4611686018427387905",
|
"4611686018427387905",
|
||||||
int64_t{0x4000000000000001},
|
int64_t{0x4000000000000001},
|
||||||
double{0x4000000000000000},
|
double{0x4000000000000000},
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"Negative integer, not exact double. Stored as int64, convertible.",
|
"Negative integer, not exact double. Stored as int64, convertible.",
|
||||||
int64_t{-0x4000000000000001},
|
int64_t{-0x4000000000000001},
|
||||||
"-4611686018427387905",
|
"-4611686018427387905",
|
||||||
int64_t{-0x4000000000000001},
|
int64_t{-0x4000000000000001},
|
||||||
double{-0x4000000000000000},
|
double{-0x4000000000000000},
|
||||||
},
|
},
|
||||||
|
|
||||||
// PR46470,
|
// PR46470,
|
||||||
// https://developercommunity.visualstudio.com/content/problem/1093399/incorrect-result-when-printing-6917529027641081856.html
|
// https://developercommunity.visualstudio.com/content/problem/1093399/incorrect-result-when-printing-6917529027641081856.html
|
||||||
#if !defined(_MSC_VER) || _MSC_VER < 1926
|
#if !defined(_MSC_VER) || _MSC_VER < 1926
|
||||||
{
|
{
|
||||||
"Dynamically exact integer. Stored as double, convertible.",
|
"Dynamically exact integer. Stored as double, convertible.",
|
||||||
double{0x6000000000000000},
|
double{0x6000000000000000},
|
||||||
"6.9175290276410819e+18",
|
"6.9175290276410819e+18",
|
||||||
int64_t{0x6000000000000000},
|
int64_t{0x6000000000000000},
|
||||||
double{0x6000000000000000},
|
double{0x6000000000000000},
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
"Dynamically integer, >64 bits. Stored as double, not convertible.",
|
"Dynamically integer, >64 bits. Stored as double, not convertible.",
|
||||||
1.5 * double{0x8000000000000000},
|
1.5 * double{0x8000000000000000},
|
||||||
"1.3835058055282164e+19",
|
"1.3835058055282164e+19",
|
||||||
llvm::None,
|
std::nullopt,
|
||||||
1.5 * double{0x8000000000000000},
|
1.5 * double{0x8000000000000000},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
for (const auto &T : TestCases) {
|
for (const auto &T : TestCases) {
|
||||||
EXPECT_EQ(T.Str, s(T.Val)) << T.Desc;
|
EXPECT_EQ(T.Str, s(T.Val)) << T.Desc;
|
||||||
|
@ -382,7 +382,7 @@ TEST(JSONTest, U64Integers) {
|
||||||
|
|
||||||
EXPECT_TRUE(!!Doc);
|
EXPECT_TRUE(!!Doc);
|
||||||
EXPECT_EQ(Doc->getAsInteger(), int64_t{-78278238238328222});
|
EXPECT_EQ(Doc->getAsInteger(), int64_t{-78278238238328222});
|
||||||
EXPECT_EQ(Doc->getAsUINT64(), llvm::None);
|
EXPECT_EQ(Doc->getAsUINT64(), std::nullopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test with the largest 64 signed int.
|
// Test with the largest 64 signed int.
|
||||||
|
@ -401,7 +401,7 @@ TEST(JSONTest, U64Integers) {
|
||||||
llvm::Expected<Value> Doc = parse(Str);
|
llvm::Expected<Value> Doc = parse(Str);
|
||||||
|
|
||||||
EXPECT_TRUE(!!Doc);
|
EXPECT_TRUE(!!Doc);
|
||||||
EXPECT_EQ(Doc->getAsInteger(), None);
|
EXPECT_EQ(Doc->getAsInteger(), std::nullopt);
|
||||||
EXPECT_EQ(Doc->getAsUINT64(), uint64_t{18446744073709551615u});
|
EXPECT_EQ(Doc->getAsUINT64(), uint64_t{18446744073709551615u});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,8 +411,8 @@ TEST(JSONTest, U64Integers) {
|
||||||
llvm::Expected<Value> Doc = parse(Str);
|
llvm::Expected<Value> Doc = parse(Str);
|
||||||
|
|
||||||
EXPECT_TRUE(!!Doc);
|
EXPECT_TRUE(!!Doc);
|
||||||
EXPECT_EQ(Doc->getAsInteger(), None);
|
EXPECT_EQ(Doc->getAsInteger(), std::nullopt);
|
||||||
EXPECT_EQ(Doc->getAsUINT64(), None);
|
EXPECT_EQ(Doc->getAsUINT64(), std::nullopt);
|
||||||
// The number was parsed as a double.
|
// The number was parsed as a double.
|
||||||
EXPECT_TRUE(!!Doc->getAsNumber());
|
EXPECT_TRUE(!!Doc->getAsNumber());
|
||||||
}
|
}
|
||||||
|
@ -423,8 +423,8 @@ TEST(JSONTest, U64Integers) {
|
||||||
llvm::Expected<Value> Doc = parse(Str);
|
llvm::Expected<Value> Doc = parse(Str);
|
||||||
|
|
||||||
EXPECT_TRUE(!!Doc);
|
EXPECT_TRUE(!!Doc);
|
||||||
EXPECT_EQ(Doc->getAsInteger(), None);
|
EXPECT_EQ(Doc->getAsInteger(), std::nullopt);
|
||||||
EXPECT_EQ(Doc->getAsUINT64(), None);
|
EXPECT_EQ(Doc->getAsUINT64(), std::nullopt);
|
||||||
// The number was parsed as a double.
|
// The number was parsed as a double.
|
||||||
EXPECT_TRUE(!!Doc->getAsNumber());
|
EXPECT_TRUE(!!Doc->getAsNumber());
|
||||||
}
|
}
|
||||||
|
@ -483,7 +483,7 @@ TEST(JSONTest, Deserialize) {
|
||||||
}}};
|
}}};
|
||||||
Expected["foo"] = {
|
Expected["foo"] = {
|
||||||
CustomStruct("foo", 42, true),
|
CustomStruct("foo", 42, true),
|
||||||
CustomStruct("bar", llvm::None, false),
|
CustomStruct("bar", std::nullopt, false),
|
||||||
};
|
};
|
||||||
Path::Root Root("CustomStruct");
|
Path::Root Root("CustomStruct");
|
||||||
ASSERT_TRUE(fromJSON(J, R, Root));
|
ASSERT_TRUE(fromJSON(J, R, Root));
|
||||||
|
|
|
@ -18,7 +18,7 @@ using ::testing::Not;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
TEST(MatchersTest, Optional) {
|
TEST(MatchersTest, Optional) {
|
||||||
EXPECT_THAT(llvm::Optional<int>(llvm::None), Not(llvm::ValueIs(_)));
|
EXPECT_THAT(llvm::Optional<int>(std::nullopt), Not(llvm::ValueIs(_)));
|
||||||
EXPECT_THAT(llvm::Optional<int>(10), llvm::ValueIs(10));
|
EXPECT_THAT(llvm::Optional<int>(10), llvm::ValueIs(10));
|
||||||
EXPECT_THAT(llvm::Optional<int>(10), llvm::ValueIs(AllOf(Lt(11), Gt(9))));
|
EXPECT_THAT(llvm::Optional<int>(10), llvm::ValueIs(AllOf(Lt(11), Gt(9))));
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ template <typename T> std::string format_number(T N, IntegerStyle Style) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string format_number(uint64_t N, HexPrintStyle Style,
|
std::string format_number(uint64_t N, HexPrintStyle Style,
|
||||||
Optional<size_t> Width = None) {
|
Optional<size_t> Width = std::nullopt) {
|
||||||
std::string S;
|
std::string S;
|
||||||
llvm::raw_string_ostream Str(S);
|
llvm::raw_string_ostream Str(S);
|
||||||
write_hex(Str, N, Style, Width);
|
write_hex(Str, N, Style, Width);
|
||||||
|
@ -35,7 +35,7 @@ std::string format_number(uint64_t N, HexPrintStyle Style,
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string format_number(double D, FloatStyle Style,
|
std::string format_number(double D, FloatStyle Style,
|
||||||
Optional<size_t> Precision = None) {
|
Optional<size_t> Precision = std::nullopt) {
|
||||||
std::string S;
|
std::string S;
|
||||||
llvm::raw_string_ostream Str(S);
|
llvm::raw_string_ostream Str(S);
|
||||||
write_double(Str, D, Style, Precision);
|
write_double(Str, D, Style, Precision);
|
||||||
|
|
|
@ -1994,7 +1994,7 @@ TEST_F(FileSystemTest, readNativeFileToEOF) {
|
||||||
static_cast<SmallVectorImpl<char> *>(&StaysSmall),
|
static_cast<SmallVectorImpl<char> *>(&StaysSmall),
|
||||||
};
|
};
|
||||||
for (SmallVectorImpl<char> *V : Vectors) {
|
for (SmallVectorImpl<char> *V : Vectors) {
|
||||||
ASSERT_THAT_ERROR(Read(*V, None), Succeeded());
|
ASSERT_THAT_ERROR(Read(*V, std::nullopt), Succeeded());
|
||||||
ASSERT_EQ(Content, StringRef(V->begin(), V->size()));
|
ASSERT_EQ(Content, StringRef(V->begin(), V->size()));
|
||||||
}
|
}
|
||||||
ASSERT_EQ(fs::DefaultReadChunkSize + Content.size(), StaysSmall.capacity());
|
ASSERT_EQ(fs::DefaultReadChunkSize + Content.size(), StaysSmall.capacity());
|
||||||
|
@ -2004,7 +2004,7 @@ TEST_F(FileSystemTest, readNativeFileToEOF) {
|
||||||
constexpr StringLiteral Prefix = "prefix-";
|
constexpr StringLiteral Prefix = "prefix-";
|
||||||
for (SmallVectorImpl<char> *V : Vectors) {
|
for (SmallVectorImpl<char> *V : Vectors) {
|
||||||
V->assign(Prefix.begin(), Prefix.end());
|
V->assign(Prefix.begin(), Prefix.end());
|
||||||
ASSERT_THAT_ERROR(Read(*V, None), Succeeded());
|
ASSERT_THAT_ERROR(Read(*V, std::nullopt), Succeeded());
|
||||||
ASSERT_EQ((Prefix + Content).str(), StringRef(V->begin(), V->size()));
|
ASSERT_EQ((Prefix + Content).str(), StringRef(V->begin(), V->size()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,7 +195,7 @@ TEST_F(ProgramEnvTest, CreateProcessTrailingSlash) {
|
||||||
#else
|
#else
|
||||||
StringRef nul("/dev/null");
|
StringRef nul("/dev/null");
|
||||||
#endif
|
#endif
|
||||||
std::optional<StringRef> redirects[] = {nul, nul, None};
|
std::optional<StringRef> redirects[] = {nul, nul, std::nullopt};
|
||||||
int rc = ExecuteAndWait(my_exe, argv, getEnviron(), redirects,
|
int rc = ExecuteAndWait(my_exe, argv, getEnviron(), redirects,
|
||||||
/*secondsToWait=*/ 10, /*memoryLimit=*/ 0, &error,
|
/*secondsToWait=*/ 10, /*memoryLimit=*/ 0, &error,
|
||||||
&ExecutionFailed);
|
&ExecutionFailed);
|
||||||
|
@ -289,8 +289,8 @@ TEST(ProgramTest, TestExecuteNegative) {
|
||||||
{
|
{
|
||||||
std::string Error;
|
std::string Error;
|
||||||
bool ExecutionFailed;
|
bool ExecutionFailed;
|
||||||
int RetCode = ExecuteAndWait(Executable, argv, llvm::None, {}, 0, 0, &Error,
|
int RetCode = ExecuteAndWait(Executable, argv, std::nullopt, {}, 0, 0,
|
||||||
&ExecutionFailed);
|
&Error, &ExecutionFailed);
|
||||||
ASSERT_LT(RetCode, 0) << "On error ExecuteAndWait should return 0 or "
|
ASSERT_LT(RetCode, 0) << "On error ExecuteAndWait should return 0 or "
|
||||||
"positive value indicating the result code";
|
"positive value indicating the result code";
|
||||||
ASSERT_TRUE(ExecutionFailed);
|
ASSERT_TRUE(ExecutionFailed);
|
||||||
|
@ -300,8 +300,8 @@ TEST(ProgramTest, TestExecuteNegative) {
|
||||||
{
|
{
|
||||||
std::string Error;
|
std::string Error;
|
||||||
bool ExecutionFailed;
|
bool ExecutionFailed;
|
||||||
ProcessInfo PI = ExecuteNoWait(Executable, argv, llvm::None, {}, 0, &Error,
|
ProcessInfo PI = ExecuteNoWait(Executable, argv, std::nullopt, {}, 0,
|
||||||
&ExecutionFailed);
|
&Error, &ExecutionFailed);
|
||||||
ASSERT_EQ(PI.Pid, ProcessInfo::InvalidPid)
|
ASSERT_EQ(PI.Pid, ProcessInfo::InvalidPid)
|
||||||
<< "On error ExecuteNoWait should return an invalid ProcessInfo";
|
<< "On error ExecuteNoWait should return an invalid ProcessInfo";
|
||||||
ASSERT_TRUE(ExecutionFailed);
|
ASSERT_TRUE(ExecutionFailed);
|
||||||
|
|
|
@ -48,7 +48,8 @@ public:
|
||||||
|
|
||||||
TEST_F(SourceMgrTest, BasicError) {
|
TEST_F(SourceMgrTest, BasicError) {
|
||||||
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
|
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
|
||||||
printMessage(getLoc(4), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(4), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
|
|
||||||
EXPECT_EQ("file.in:1:5: error: message\n"
|
EXPECT_EQ("file.in:1:5: error: message\n"
|
||||||
"aaa bbb\n"
|
"aaa bbb\n"
|
||||||
|
@ -58,7 +59,8 @@ TEST_F(SourceMgrTest, BasicError) {
|
||||||
|
|
||||||
TEST_F(SourceMgrTest, BasicWarning) {
|
TEST_F(SourceMgrTest, BasicWarning) {
|
||||||
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
|
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
|
||||||
printMessage(getLoc(4), SourceMgr::DK_Warning, "message", None, None);
|
printMessage(getLoc(4), SourceMgr::DK_Warning, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
|
|
||||||
EXPECT_EQ("file.in:1:5: warning: message\n"
|
EXPECT_EQ("file.in:1:5: warning: message\n"
|
||||||
"aaa bbb\n"
|
"aaa bbb\n"
|
||||||
|
@ -68,7 +70,8 @@ TEST_F(SourceMgrTest, BasicWarning) {
|
||||||
|
|
||||||
TEST_F(SourceMgrTest, BasicRemark) {
|
TEST_F(SourceMgrTest, BasicRemark) {
|
||||||
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
|
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
|
||||||
printMessage(getLoc(4), SourceMgr::DK_Remark, "message", None, None);
|
printMessage(getLoc(4), SourceMgr::DK_Remark, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
|
|
||||||
EXPECT_EQ("file.in:1:5: remark: message\n"
|
EXPECT_EQ("file.in:1:5: remark: message\n"
|
||||||
"aaa bbb\n"
|
"aaa bbb\n"
|
||||||
|
@ -78,7 +81,8 @@ TEST_F(SourceMgrTest, BasicRemark) {
|
||||||
|
|
||||||
TEST_F(SourceMgrTest, BasicNote) {
|
TEST_F(SourceMgrTest, BasicNote) {
|
||||||
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
|
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
|
||||||
printMessage(getLoc(4), SourceMgr::DK_Note, "message", None, None);
|
printMessage(getLoc(4), SourceMgr::DK_Note, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
|
|
||||||
EXPECT_EQ("file.in:1:5: note: message\n"
|
EXPECT_EQ("file.in:1:5: note: message\n"
|
||||||
"aaa bbb\n"
|
"aaa bbb\n"
|
||||||
|
@ -88,7 +92,8 @@ TEST_F(SourceMgrTest, BasicNote) {
|
||||||
|
|
||||||
TEST_F(SourceMgrTest, LocationAtEndOfLine) {
|
TEST_F(SourceMgrTest, LocationAtEndOfLine) {
|
||||||
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
|
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
|
||||||
printMessage(getLoc(6), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(6), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
|
|
||||||
EXPECT_EQ("file.in:1:7: error: message\n"
|
EXPECT_EQ("file.in:1:7: error: message\n"
|
||||||
"aaa bbb\n"
|
"aaa bbb\n"
|
||||||
|
@ -98,7 +103,8 @@ TEST_F(SourceMgrTest, LocationAtEndOfLine) {
|
||||||
|
|
||||||
TEST_F(SourceMgrTest, LocationAtNewline) {
|
TEST_F(SourceMgrTest, LocationAtNewline) {
|
||||||
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
|
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
|
||||||
printMessage(getLoc(7), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(7), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
|
|
||||||
EXPECT_EQ("file.in:1:8: error: message\n"
|
EXPECT_EQ("file.in:1:8: error: message\n"
|
||||||
"aaa bbb\n"
|
"aaa bbb\n"
|
||||||
|
@ -108,7 +114,8 @@ TEST_F(SourceMgrTest, LocationAtNewline) {
|
||||||
|
|
||||||
TEST_F(SourceMgrTest, LocationAtEmptyBuffer) {
|
TEST_F(SourceMgrTest, LocationAtEmptyBuffer) {
|
||||||
setMainBuffer("", "file.in");
|
setMainBuffer("", "file.in");
|
||||||
printMessage(getLoc(0), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(0), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
|
|
||||||
EXPECT_EQ("file.in:1:1: error: message\n"
|
EXPECT_EQ("file.in:1:1: error: message\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -118,7 +125,8 @@ TEST_F(SourceMgrTest, LocationAtEmptyBuffer) {
|
||||||
|
|
||||||
TEST_F(SourceMgrTest, LocationJustOnSoleNewline) {
|
TEST_F(SourceMgrTest, LocationJustOnSoleNewline) {
|
||||||
setMainBuffer("\n", "file.in");
|
setMainBuffer("\n", "file.in");
|
||||||
printMessage(getLoc(0), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(0), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
|
|
||||||
EXPECT_EQ("file.in:1:1: error: message\n"
|
EXPECT_EQ("file.in:1:1: error: message\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -128,7 +136,8 @@ TEST_F(SourceMgrTest, LocationJustOnSoleNewline) {
|
||||||
|
|
||||||
TEST_F(SourceMgrTest, LocationJustAfterSoleNewline) {
|
TEST_F(SourceMgrTest, LocationJustAfterSoleNewline) {
|
||||||
setMainBuffer("\n", "file.in");
|
setMainBuffer("\n", "file.in");
|
||||||
printMessage(getLoc(1), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(1), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
|
|
||||||
EXPECT_EQ("file.in:2:1: error: message\n"
|
EXPECT_EQ("file.in:2:1: error: message\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -138,7 +147,8 @@ TEST_F(SourceMgrTest, LocationJustAfterSoleNewline) {
|
||||||
|
|
||||||
TEST_F(SourceMgrTest, LocationJustAfterNonNewline) {
|
TEST_F(SourceMgrTest, LocationJustAfterNonNewline) {
|
||||||
setMainBuffer("123", "file.in");
|
setMainBuffer("123", "file.in");
|
||||||
printMessage(getLoc(3), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(3), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
|
|
||||||
EXPECT_EQ("file.in:1:4: error: message\n"
|
EXPECT_EQ("file.in:1:4: error: message\n"
|
||||||
"123\n"
|
"123\n"
|
||||||
|
@ -148,7 +158,8 @@ TEST_F(SourceMgrTest, LocationJustAfterNonNewline) {
|
||||||
|
|
||||||
TEST_F(SourceMgrTest, LocationOnFirstLineOfMultiline) {
|
TEST_F(SourceMgrTest, LocationOnFirstLineOfMultiline) {
|
||||||
setMainBuffer("1234\n6789\n", "file.in");
|
setMainBuffer("1234\n6789\n", "file.in");
|
||||||
printMessage(getLoc(3), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(3), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
|
|
||||||
EXPECT_EQ("file.in:1:4: error: message\n"
|
EXPECT_EQ("file.in:1:4: error: message\n"
|
||||||
"1234\n"
|
"1234\n"
|
||||||
|
@ -158,7 +169,8 @@ TEST_F(SourceMgrTest, LocationOnFirstLineOfMultiline) {
|
||||||
|
|
||||||
TEST_F(SourceMgrTest, LocationOnEOLOfFirstLineOfMultiline) {
|
TEST_F(SourceMgrTest, LocationOnEOLOfFirstLineOfMultiline) {
|
||||||
setMainBuffer("1234\n6789\n", "file.in");
|
setMainBuffer("1234\n6789\n", "file.in");
|
||||||
printMessage(getLoc(4), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(4), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
|
|
||||||
EXPECT_EQ("file.in:1:5: error: message\n"
|
EXPECT_EQ("file.in:1:5: error: message\n"
|
||||||
"1234\n"
|
"1234\n"
|
||||||
|
@ -168,7 +180,8 @@ TEST_F(SourceMgrTest, LocationOnEOLOfFirstLineOfMultiline) {
|
||||||
|
|
||||||
TEST_F(SourceMgrTest, LocationOnSecondLineOfMultiline) {
|
TEST_F(SourceMgrTest, LocationOnSecondLineOfMultiline) {
|
||||||
setMainBuffer("1234\n6789\n", "file.in");
|
setMainBuffer("1234\n6789\n", "file.in");
|
||||||
printMessage(getLoc(5), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(5), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
|
|
||||||
EXPECT_EQ("file.in:2:1: error: message\n"
|
EXPECT_EQ("file.in:2:1: error: message\n"
|
||||||
"6789\n"
|
"6789\n"
|
||||||
|
@ -178,7 +191,8 @@ TEST_F(SourceMgrTest, LocationOnSecondLineOfMultiline) {
|
||||||
|
|
||||||
TEST_F(SourceMgrTest, LocationOnSecondLineOfMultilineNoSecondEOL) {
|
TEST_F(SourceMgrTest, LocationOnSecondLineOfMultilineNoSecondEOL) {
|
||||||
setMainBuffer("1234\n6789", "file.in");
|
setMainBuffer("1234\n6789", "file.in");
|
||||||
printMessage(getLoc(5), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(5), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
|
|
||||||
EXPECT_EQ("file.in:2:1: error: message\n"
|
EXPECT_EQ("file.in:2:1: error: message\n"
|
||||||
"6789\n"
|
"6789\n"
|
||||||
|
@ -188,7 +202,8 @@ TEST_F(SourceMgrTest, LocationOnSecondLineOfMultilineNoSecondEOL) {
|
||||||
|
|
||||||
TEST_F(SourceMgrTest, LocationOnEOLOfSecondSecondLineOfMultiline) {
|
TEST_F(SourceMgrTest, LocationOnEOLOfSecondSecondLineOfMultiline) {
|
||||||
setMainBuffer("1234\n6789\n", "file.in");
|
setMainBuffer("1234\n6789\n", "file.in");
|
||||||
printMessage(getLoc(9), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(9), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
|
|
||||||
EXPECT_EQ("file.in:2:5: error: message\n"
|
EXPECT_EQ("file.in:2:5: error: message\n"
|
||||||
"6789\n"
|
"6789\n"
|
||||||
|
@ -218,7 +233,8 @@ TEST_F(SourceMgrTest, LocationBeforeEndOf255ByteBuffer) {
|
||||||
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
||||||
"12" // + 2 = 255 bytes
|
"12" // + 2 = 255 bytes
|
||||||
, "file.in");
|
, "file.in");
|
||||||
printMessage(getLoc(253), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(253), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
EXPECT_EQ("file.in:24:1: error: message\n"
|
EXPECT_EQ("file.in:24:1: error: message\n"
|
||||||
"12\n"
|
"12\n"
|
||||||
"^\n",
|
"^\n",
|
||||||
|
@ -229,7 +245,8 @@ TEST_F(SourceMgrTest, LocationAtEndOf255ByteBuffer) {
|
||||||
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
||||||
"12" // + 2 = 255 bytes
|
"12" // + 2 = 255 bytes
|
||||||
, "file.in");
|
, "file.in");
|
||||||
printMessage(getLoc(254), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(254), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
EXPECT_EQ("file.in:24:2: error: message\n"
|
EXPECT_EQ("file.in:24:2: error: message\n"
|
||||||
"12\n"
|
"12\n"
|
||||||
" ^\n",
|
" ^\n",
|
||||||
|
@ -240,7 +257,8 @@ TEST_F(SourceMgrTest, LocationPastEndOf255ByteBuffer) {
|
||||||
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
||||||
"12" // + 2 = 255 bytes
|
"12" // + 2 = 255 bytes
|
||||||
, "file.in");
|
, "file.in");
|
||||||
printMessage(getLoc(255), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(255), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
EXPECT_EQ("file.in:24:3: error: message\n"
|
EXPECT_EQ("file.in:24:3: error: message\n"
|
||||||
"12\n"
|
"12\n"
|
||||||
" ^\n",
|
" ^\n",
|
||||||
|
@ -251,7 +269,8 @@ TEST_F(SourceMgrTest, LocationBeforeEndOf255ByteBufferEndingInNewline) {
|
||||||
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
||||||
"1\n" // + 2 = 255 bytes
|
"1\n" // + 2 = 255 bytes
|
||||||
, "file.in");
|
, "file.in");
|
||||||
printMessage(getLoc(253), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(253), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
EXPECT_EQ("file.in:24:1: error: message\n"
|
EXPECT_EQ("file.in:24:1: error: message\n"
|
||||||
"1\n"
|
"1\n"
|
||||||
"^\n",
|
"^\n",
|
||||||
|
@ -262,7 +281,8 @@ TEST_F(SourceMgrTest, LocationAtEndOf255ByteBufferEndingInNewline) {
|
||||||
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
||||||
"1\n" // + 2 = 255 bytes
|
"1\n" // + 2 = 255 bytes
|
||||||
, "file.in");
|
, "file.in");
|
||||||
printMessage(getLoc(254), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(254), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
EXPECT_EQ("file.in:24:2: error: message\n"
|
EXPECT_EQ("file.in:24:2: error: message\n"
|
||||||
"1\n"
|
"1\n"
|
||||||
" ^\n",
|
" ^\n",
|
||||||
|
@ -273,7 +293,8 @@ TEST_F(SourceMgrTest, LocationPastEndOf255ByteBufferEndingInNewline) {
|
||||||
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
||||||
"1\n" // + 2 = 255 bytes
|
"1\n" // + 2 = 255 bytes
|
||||||
, "file.in");
|
, "file.in");
|
||||||
printMessage(getLoc(255), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(255), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
EXPECT_EQ("file.in:25:1: error: message\n"
|
EXPECT_EQ("file.in:25:1: error: message\n"
|
||||||
"\n"
|
"\n"
|
||||||
"^\n",
|
"^\n",
|
||||||
|
@ -288,7 +309,8 @@ TEST_F(SourceMgrTest, LocationBeforeEndOf256ByteBuffer) {
|
||||||
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
||||||
"123" // + 3 = 256 bytes
|
"123" // + 3 = 256 bytes
|
||||||
, "file.in");
|
, "file.in");
|
||||||
printMessage(getLoc(254), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(254), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
EXPECT_EQ("file.in:24:2: error: message\n"
|
EXPECT_EQ("file.in:24:2: error: message\n"
|
||||||
"123\n"
|
"123\n"
|
||||||
" ^\n",
|
" ^\n",
|
||||||
|
@ -299,7 +321,8 @@ TEST_F(SourceMgrTest, LocationAtEndOf256ByteBuffer) {
|
||||||
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
||||||
"123" // + 3 = 256 bytes
|
"123" // + 3 = 256 bytes
|
||||||
, "file.in");
|
, "file.in");
|
||||||
printMessage(getLoc(255), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(255), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
EXPECT_EQ("file.in:24:3: error: message\n"
|
EXPECT_EQ("file.in:24:3: error: message\n"
|
||||||
"123\n"
|
"123\n"
|
||||||
" ^\n",
|
" ^\n",
|
||||||
|
@ -310,7 +333,8 @@ TEST_F(SourceMgrTest, LocationPastEndOf256ByteBuffer) {
|
||||||
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
||||||
"123" // + 3 = 256 bytes
|
"123" // + 3 = 256 bytes
|
||||||
, "file.in");
|
, "file.in");
|
||||||
printMessage(getLoc(256), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(256), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
EXPECT_EQ("file.in:24:4: error: message\n"
|
EXPECT_EQ("file.in:24:4: error: message\n"
|
||||||
"123\n"
|
"123\n"
|
||||||
" ^\n",
|
" ^\n",
|
||||||
|
@ -321,7 +345,8 @@ TEST_F(SourceMgrTest, LocationBeforeEndOf256ByteBufferEndingInNewline) {
|
||||||
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
||||||
"12\n" // + 3 = 256 bytes
|
"12\n" // + 3 = 256 bytes
|
||||||
, "file.in");
|
, "file.in");
|
||||||
printMessage(getLoc(254), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(254), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
EXPECT_EQ("file.in:24:2: error: message\n"
|
EXPECT_EQ("file.in:24:2: error: message\n"
|
||||||
"12\n"
|
"12\n"
|
||||||
" ^\n",
|
" ^\n",
|
||||||
|
@ -332,7 +357,8 @@ TEST_F(SourceMgrTest, LocationAtEndOf256ByteBufferEndingInNewline) {
|
||||||
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
||||||
"12\n" // + 3 = 256 bytes
|
"12\n" // + 3 = 256 bytes
|
||||||
, "file.in");
|
, "file.in");
|
||||||
printMessage(getLoc(255), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(255), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
EXPECT_EQ("file.in:24:3: error: message\n"
|
EXPECT_EQ("file.in:24:3: error: message\n"
|
||||||
"12\n"
|
"12\n"
|
||||||
" ^\n",
|
" ^\n",
|
||||||
|
@ -343,7 +369,8 @@ TEST_F(SourceMgrTest, LocationPastEndOf256ByteBufferEndingInNewline) {
|
||||||
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
||||||
"12\n" // + 3 = 256 bytes
|
"12\n" // + 3 = 256 bytes
|
||||||
, "file.in");
|
, "file.in");
|
||||||
printMessage(getLoc(256), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(256), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
EXPECT_EQ("file.in:25:1: error: message\n"
|
EXPECT_EQ("file.in:25:1: error: message\n"
|
||||||
"\n"
|
"\n"
|
||||||
"^\n",
|
"^\n",
|
||||||
|
@ -358,7 +385,8 @@ TEST_F(SourceMgrTest, LocationBeforeEndOf257ByteBuffer) {
|
||||||
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
||||||
"1234" // + 4 = 257 bytes
|
"1234" // + 4 = 257 bytes
|
||||||
, "file.in");
|
, "file.in");
|
||||||
printMessage(getLoc(255), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(255), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
EXPECT_EQ("file.in:24:3: error: message\n"
|
EXPECT_EQ("file.in:24:3: error: message\n"
|
||||||
"1234\n"
|
"1234\n"
|
||||||
" ^\n",
|
" ^\n",
|
||||||
|
@ -369,7 +397,8 @@ TEST_F(SourceMgrTest, LocationAtEndOf257ByteBuffer) {
|
||||||
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
||||||
"1234" // + 4 = 257 bytes
|
"1234" // + 4 = 257 bytes
|
||||||
, "file.in");
|
, "file.in");
|
||||||
printMessage(getLoc(256), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(256), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
EXPECT_EQ("file.in:24:4: error: message\n"
|
EXPECT_EQ("file.in:24:4: error: message\n"
|
||||||
"1234\n"
|
"1234\n"
|
||||||
" ^\n",
|
" ^\n",
|
||||||
|
@ -380,7 +409,8 @@ TEST_F(SourceMgrTest, LocationPastEndOf257ByteBuffer) {
|
||||||
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
||||||
"1234" // + 4 = 257 bytes
|
"1234" // + 4 = 257 bytes
|
||||||
, "file.in");
|
, "file.in");
|
||||||
printMessage(getLoc(257), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(257), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
EXPECT_EQ("file.in:24:5: error: message\n"
|
EXPECT_EQ("file.in:24:5: error: message\n"
|
||||||
"1234\n"
|
"1234\n"
|
||||||
" ^\n",
|
" ^\n",
|
||||||
|
@ -391,7 +421,8 @@ TEST_F(SourceMgrTest, LocationBeforeEndOf257ByteBufferEndingInNewline) {
|
||||||
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
||||||
"123\n" // + 4 = 257 bytes
|
"123\n" // + 4 = 257 bytes
|
||||||
, "file.in");
|
, "file.in");
|
||||||
printMessage(getLoc(255), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(255), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
EXPECT_EQ("file.in:24:3: error: message\n"
|
EXPECT_EQ("file.in:24:3: error: message\n"
|
||||||
"123\n"
|
"123\n"
|
||||||
" ^\n",
|
" ^\n",
|
||||||
|
@ -402,7 +433,8 @@ TEST_F(SourceMgrTest, LocationAtEndOf257ByteBufferEndingInNewline) {
|
||||||
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
||||||
"123\n" // + 4 = 257 bytes
|
"123\n" // + 4 = 257 bytes
|
||||||
, "file.in");
|
, "file.in");
|
||||||
printMessage(getLoc(256), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(256), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
EXPECT_EQ("file.in:24:4: error: message\n"
|
EXPECT_EQ("file.in:24:4: error: message\n"
|
||||||
"123\n"
|
"123\n"
|
||||||
" ^\n",
|
" ^\n",
|
||||||
|
@ -413,7 +445,8 @@ TEST_F(SourceMgrTest, LocationPastEndOf257ByteBufferEndingInNewline) {
|
||||||
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
|
||||||
"123\n" // + 4 = 257 bytes
|
"123\n" // + 4 = 257 bytes
|
||||||
, "file.in");
|
, "file.in");
|
||||||
printMessage(getLoc(257), SourceMgr::DK_Error, "message", None, None);
|
printMessage(getLoc(257), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
|
std::nullopt);
|
||||||
EXPECT_EQ("file.in:25:1: error: message\n"
|
EXPECT_EQ("file.in:25:1: error: message\n"
|
||||||
"\n"
|
"\n"
|
||||||
"^\n",
|
"^\n",
|
||||||
|
@ -422,7 +455,8 @@ TEST_F(SourceMgrTest, LocationPastEndOf257ByteBufferEndingInNewline) {
|
||||||
|
|
||||||
TEST_F(SourceMgrTest, BasicRange) {
|
TEST_F(SourceMgrTest, BasicRange) {
|
||||||
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
|
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
|
||||||
printMessage(getLoc(4), SourceMgr::DK_Error, "message", getRange(4, 3), None);
|
printMessage(getLoc(4), SourceMgr::DK_Error, "message", getRange(4, 3),
|
||||||
|
std::nullopt);
|
||||||
|
|
||||||
EXPECT_EQ("file.in:1:5: error: message\n"
|
EXPECT_EQ("file.in:1:5: error: message\n"
|
||||||
"aaa bbb\n"
|
"aaa bbb\n"
|
||||||
|
@ -432,7 +466,8 @@ TEST_F(SourceMgrTest, BasicRange) {
|
||||||
|
|
||||||
TEST_F(SourceMgrTest, RangeWithTab) {
|
TEST_F(SourceMgrTest, RangeWithTab) {
|
||||||
setMainBuffer("aaa\tbbb\nccc ddd\n", "file.in");
|
setMainBuffer("aaa\tbbb\nccc ddd\n", "file.in");
|
||||||
printMessage(getLoc(4), SourceMgr::DK_Error, "message", getRange(3, 3), None);
|
printMessage(getLoc(4), SourceMgr::DK_Error, "message", getRange(3, 3),
|
||||||
|
std::nullopt);
|
||||||
|
|
||||||
EXPECT_EQ("file.in:1:5: error: message\n"
|
EXPECT_EQ("file.in:1:5: error: message\n"
|
||||||
"aaa bbb\n"
|
"aaa bbb\n"
|
||||||
|
@ -442,7 +477,8 @@ TEST_F(SourceMgrTest, RangeWithTab) {
|
||||||
|
|
||||||
TEST_F(SourceMgrTest, MultiLineRange) {
|
TEST_F(SourceMgrTest, MultiLineRange) {
|
||||||
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
|
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
|
||||||
printMessage(getLoc(4), SourceMgr::DK_Error, "message", getRange(4, 7), None);
|
printMessage(getLoc(4), SourceMgr::DK_Error, "message", getRange(4, 7),
|
||||||
|
std::nullopt);
|
||||||
|
|
||||||
EXPECT_EQ("file.in:1:5: error: message\n"
|
EXPECT_EQ("file.in:1:5: error: message\n"
|
||||||
"aaa bbb\n"
|
"aaa bbb\n"
|
||||||
|
@ -453,7 +489,7 @@ TEST_F(SourceMgrTest, MultiLineRange) {
|
||||||
TEST_F(SourceMgrTest, MultipleRanges) {
|
TEST_F(SourceMgrTest, MultipleRanges) {
|
||||||
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
|
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
|
||||||
SMRange Ranges[] = { getRange(0, 3), getRange(4, 3) };
|
SMRange Ranges[] = { getRange(0, 3), getRange(4, 3) };
|
||||||
printMessage(getLoc(4), SourceMgr::DK_Error, "message", Ranges, None);
|
printMessage(getLoc(4), SourceMgr::DK_Error, "message", Ranges, std::nullopt);
|
||||||
|
|
||||||
EXPECT_EQ("file.in:1:5: error: message\n"
|
EXPECT_EQ("file.in:1:5: error: message\n"
|
||||||
"aaa bbb\n"
|
"aaa bbb\n"
|
||||||
|
@ -464,7 +500,7 @@ TEST_F(SourceMgrTest, MultipleRanges) {
|
||||||
TEST_F(SourceMgrTest, OverlappingRanges) {
|
TEST_F(SourceMgrTest, OverlappingRanges) {
|
||||||
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
|
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
|
||||||
SMRange Ranges[] = { getRange(0, 3), getRange(2, 4) };
|
SMRange Ranges[] = { getRange(0, 3), getRange(2, 4) };
|
||||||
printMessage(getLoc(4), SourceMgr::DK_Error, "message", Ranges, None);
|
printMessage(getLoc(4), SourceMgr::DK_Error, "message", Ranges, std::nullopt);
|
||||||
|
|
||||||
EXPECT_EQ("file.in:1:5: error: message\n"
|
EXPECT_EQ("file.in:1:5: error: message\n"
|
||||||
"aaa bbb\n"
|
"aaa bbb\n"
|
||||||
|
@ -474,7 +510,7 @@ TEST_F(SourceMgrTest, OverlappingRanges) {
|
||||||
|
|
||||||
TEST_F(SourceMgrTest, BasicFixit) {
|
TEST_F(SourceMgrTest, BasicFixit) {
|
||||||
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
|
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
|
||||||
printMessage(getLoc(4), SourceMgr::DK_Error, "message", None,
|
printMessage(getLoc(4), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
makeArrayRef(SMFixIt(getRange(4, 3), "zzz")));
|
makeArrayRef(SMFixIt(getRange(4, 3), "zzz")));
|
||||||
|
|
||||||
EXPECT_EQ("file.in:1:5: error: message\n"
|
EXPECT_EQ("file.in:1:5: error: message\n"
|
||||||
|
@ -486,7 +522,7 @@ TEST_F(SourceMgrTest, BasicFixit) {
|
||||||
|
|
||||||
TEST_F(SourceMgrTest, FixitForTab) {
|
TEST_F(SourceMgrTest, FixitForTab) {
|
||||||
setMainBuffer("aaa\tbbb\nccc ddd\n", "file.in");
|
setMainBuffer("aaa\tbbb\nccc ddd\n", "file.in");
|
||||||
printMessage(getLoc(3), SourceMgr::DK_Error, "message", None,
|
printMessage(getLoc(3), SourceMgr::DK_Error, "message", std::nullopt,
|
||||||
makeArrayRef(SMFixIt(getRange(3, 1), "zzz")));
|
makeArrayRef(SMFixIt(getRange(3, 1), "zzz")));
|
||||||
|
|
||||||
EXPECT_EQ("file.in:1:4: error: message\n"
|
EXPECT_EQ("file.in:1:4: error: message\n"
|
||||||
|
|
|
@ -1129,7 +1129,8 @@ TEST_F(InMemoryFileSystemTest, AddFileWithUser) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(InMemoryFileSystemTest, AddFileWithGroup) {
|
TEST_F(InMemoryFileSystemTest, AddFileWithGroup) {
|
||||||
FS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"), None, 0xDABBAD00);
|
FS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"), std::nullopt,
|
||||||
|
0xDABBAD00);
|
||||||
auto Stat = FS.status("/a");
|
auto Stat = FS.status("/a");
|
||||||
ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
|
ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
|
||||||
ASSERT_TRUE(Stat->isDirectory());
|
ASSERT_TRUE(Stat->isDirectory());
|
||||||
|
@ -1146,8 +1147,8 @@ TEST_F(InMemoryFileSystemTest, AddFileWithGroup) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(InMemoryFileSystemTest, AddFileWithFileType) {
|
TEST_F(InMemoryFileSystemTest, AddFileWithFileType) {
|
||||||
FS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"), None, None,
|
FS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"), std::nullopt,
|
||||||
sys::fs::file_type::socket_file);
|
std::nullopt, sys::fs::file_type::socket_file);
|
||||||
auto Stat = FS.status("/a");
|
auto Stat = FS.status("/a");
|
||||||
ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
|
ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
|
||||||
ASSERT_TRUE(Stat->isDirectory());
|
ASSERT_TRUE(Stat->isDirectory());
|
||||||
|
@ -1161,7 +1162,8 @@ TEST_F(InMemoryFileSystemTest, AddFileWithFileType) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(InMemoryFileSystemTest, AddFileWithPerms) {
|
TEST_F(InMemoryFileSystemTest, AddFileWithPerms) {
|
||||||
FS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"), None, None, None,
|
FS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"), std::nullopt,
|
||||||
|
std::nullopt, std::nullopt,
|
||||||
sys::fs::perms::owner_read | sys::fs::perms::owner_write);
|
sys::fs::perms::owner_read | sys::fs::perms::owner_write);
|
||||||
auto Stat = FS.status("/a");
|
auto Stat = FS.status("/a");
|
||||||
ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
|
ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
|
||||||
|
@ -1183,10 +1185,11 @@ TEST_F(InMemoryFileSystemTest, AddFileWithPerms) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(InMemoryFileSystemTest, AddDirectoryThenAddChild) {
|
TEST_F(InMemoryFileSystemTest, AddDirectoryThenAddChild) {
|
||||||
FS.addFile("/a", 0, MemoryBuffer::getMemBuffer(""), /*User=*/None,
|
FS.addFile("/a", 0, MemoryBuffer::getMemBuffer(""), /*User=*/std::nullopt,
|
||||||
/*Group=*/None, sys::fs::file_type::directory_file);
|
/*Group=*/std::nullopt, sys::fs::file_type::directory_file);
|
||||||
FS.addFile("/a/b", 0, MemoryBuffer::getMemBuffer("abc"), /*User=*/None,
|
FS.addFile("/a/b", 0, MemoryBuffer::getMemBuffer("abc"),
|
||||||
/*Group=*/None, sys::fs::file_type::regular_file);
|
/*User=*/std::nullopt,
|
||||||
|
/*Group=*/std::nullopt, sys::fs::file_type::regular_file);
|
||||||
auto Stat = FS.status("/a");
|
auto Stat = FS.status("/a");
|
||||||
ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
|
ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
|
||||||
ASSERT_TRUE(Stat->isDirectory());
|
ASSERT_TRUE(Stat->isDirectory());
|
||||||
|
@ -1199,8 +1202,9 @@ TEST_F(InMemoryFileSystemTest, AddDirectoryThenAddChild) {
|
||||||
// was requested (to match the behavior of RealFileSystem).
|
// was requested (to match the behavior of RealFileSystem).
|
||||||
TEST_F(InMemoryFileSystemTest, StatusName) {
|
TEST_F(InMemoryFileSystemTest, StatusName) {
|
||||||
NormalizedFS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"),
|
NormalizedFS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"),
|
||||||
/*User=*/None,
|
/*User=*/std::nullopt,
|
||||||
/*Group=*/None, sys::fs::file_type::regular_file);
|
/*Group=*/std::nullopt,
|
||||||
|
sys::fs::file_type::regular_file);
|
||||||
NormalizedFS.setCurrentWorkingDirectory("/a/b");
|
NormalizedFS.setCurrentWorkingDirectory("/a/b");
|
||||||
|
|
||||||
// Access using InMemoryFileSystem::status.
|
// Access using InMemoryFileSystem::status.
|
||||||
|
|
|
@ -204,10 +204,10 @@ TEST(raw_ostreamTest, FormatDecimal) {
|
||||||
printToString(format_decimal(INT64_MIN, 21), 21));
|
printToString(format_decimal(INT64_MIN, 21), 21));
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string formatted_bytes_str(ArrayRef<uint8_t> Bytes,
|
static std::string
|
||||||
llvm::Optional<uint64_t> Offset = None,
|
formatted_bytes_str(ArrayRef<uint8_t> Bytes,
|
||||||
uint32_t NumPerLine = 16,
|
llvm::Optional<uint64_t> Offset = std::nullopt,
|
||||||
uint8_t ByteGroupSize = 4) {
|
uint32_t NumPerLine = 16, uint8_t ByteGroupSize = 4) {
|
||||||
std::string S;
|
std::string S;
|
||||||
raw_string_ostream Str(S);
|
raw_string_ostream Str(S);
|
||||||
Str << format_bytes(Bytes, Offset, NumPerLine, ByteGroupSize);
|
Str << format_bytes(Bytes, Offset, NumPerLine, ByteGroupSize);
|
||||||
|
@ -215,10 +215,9 @@ static std::string formatted_bytes_str(ArrayRef<uint8_t> Bytes,
|
||||||
return S;
|
return S;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string format_bytes_with_ascii_str(ArrayRef<uint8_t> Bytes,
|
static std::string format_bytes_with_ascii_str(
|
||||||
Optional<uint64_t> Offset = None,
|
ArrayRef<uint8_t> Bytes, Optional<uint64_t> Offset = std::nullopt,
|
||||||
uint32_t NumPerLine = 16,
|
uint32_t NumPerLine = 16, uint8_t ByteGroupSize = 4) {
|
||||||
uint8_t ByteGroupSize = 4) {
|
|
||||||
std::string S;
|
std::string S;
|
||||||
raw_string_ostream Str(S);
|
raw_string_ostream Str(S);
|
||||||
Str << format_bytes_with_ascii(Bytes, Offset, NumPerLine, ByteGroupSize);
|
Str << format_bytes_with_ascii(Bytes, Offset, NumPerLine, ByteGroupSize);
|
||||||
|
@ -249,47 +248,48 @@ TEST(raw_ostreamTest, FormattedHexBytes) {
|
||||||
formatted_bytes_str(B.take_front(17)));
|
formatted_bytes_str(B.take_front(17)));
|
||||||
// Test raw bytes with 1 bytes per line wrapping.
|
// Test raw bytes with 1 bytes per line wrapping.
|
||||||
EXPECT_EQ("61\n62\n63\n64\n65\n66",
|
EXPECT_EQ("61\n62\n63\n64\n65\n66",
|
||||||
formatted_bytes_str(B.take_front(6), None, 1));
|
formatted_bytes_str(B.take_front(6), std::nullopt, 1));
|
||||||
// Test raw bytes with 7 bytes per line wrapping.
|
// Test raw bytes with 7 bytes per line wrapping.
|
||||||
EXPECT_EQ("61626364 656667\n68696a6b 6c6d6e\n6f7071",
|
EXPECT_EQ("61626364 656667\n68696a6b 6c6d6e\n6f7071",
|
||||||
formatted_bytes_str(B.take_front(17), None, 7));
|
formatted_bytes_str(B.take_front(17), std::nullopt, 7));
|
||||||
// Test raw bytes with 8 bytes per line wrapping.
|
// Test raw bytes with 8 bytes per line wrapping.
|
||||||
EXPECT_EQ("61626364 65666768\n696a6b6c 6d6e6f70\n71",
|
EXPECT_EQ("61626364 65666768\n696a6b6c 6d6e6f70\n71",
|
||||||
formatted_bytes_str(B.take_front(17), None, 8));
|
formatted_bytes_str(B.take_front(17), std::nullopt, 8));
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// Test hex byte output with the 1 byte groups
|
// Test hex byte output with the 1 byte groups
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
EXPECT_EQ("61 62 63 64 65",
|
EXPECT_EQ("61 62 63 64 65",
|
||||||
formatted_bytes_str(B.take_front(5), None, 16, 1));
|
formatted_bytes_str(B.take_front(5), std::nullopt, 16, 1));
|
||||||
// Test that 16 bytes get written to a line correctly.
|
// Test that 16 bytes get written to a line correctly.
|
||||||
EXPECT_EQ("61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70",
|
EXPECT_EQ("61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70",
|
||||||
formatted_bytes_str(B.take_front(16), None, 16, 1));
|
formatted_bytes_str(B.take_front(16), std::nullopt, 16, 1));
|
||||||
// Test raw bytes with default 16 bytes per line wrapping.
|
// Test raw bytes with default 16 bytes per line wrapping.
|
||||||
EXPECT_EQ("61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70\n71",
|
EXPECT_EQ("61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70\n71",
|
||||||
formatted_bytes_str(B.take_front(17), None, 16, 1));
|
formatted_bytes_str(B.take_front(17), std::nullopt, 16, 1));
|
||||||
// Test raw bytes with 7 bytes per line wrapping.
|
// Test raw bytes with 7 bytes per line wrapping.
|
||||||
EXPECT_EQ("61 62 63 64 65 66 67\n68 69 6a 6b 6c 6d 6e\n6f 70 71",
|
EXPECT_EQ("61 62 63 64 65 66 67\n68 69 6a 6b 6c 6d 6e\n6f 70 71",
|
||||||
formatted_bytes_str(B.take_front(17), None, 7, 1));
|
formatted_bytes_str(B.take_front(17), std::nullopt, 7, 1));
|
||||||
// Test raw bytes with 8 bytes per line wrapping.
|
// Test raw bytes with 8 bytes per line wrapping.
|
||||||
EXPECT_EQ("61 62 63 64 65 66 67 68\n69 6a 6b 6c 6d 6e 6f 70\n71",
|
EXPECT_EQ("61 62 63 64 65 66 67 68\n69 6a 6b 6c 6d 6e 6f 70\n71",
|
||||||
formatted_bytes_str(B.take_front(17), None, 8, 1));
|
formatted_bytes_str(B.take_front(17), std::nullopt, 8, 1));
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// Test hex byte output with the 2 byte groups
|
// Test hex byte output with the 2 byte groups
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
EXPECT_EQ("6162 6364 65", formatted_bytes_str(B.take_front(5), None, 16, 2));
|
EXPECT_EQ("6162 6364 65",
|
||||||
|
formatted_bytes_str(B.take_front(5), std::nullopt, 16, 2));
|
||||||
// Test that 16 bytes get written to a line correctly.
|
// Test that 16 bytes get written to a line correctly.
|
||||||
EXPECT_EQ("6162 6364 6566 6768 696a 6b6c 6d6e 6f70",
|
EXPECT_EQ("6162 6364 6566 6768 696a 6b6c 6d6e 6f70",
|
||||||
formatted_bytes_str(B.take_front(16), None, 16, 2));
|
formatted_bytes_str(B.take_front(16), std::nullopt, 16, 2));
|
||||||
// Test raw bytes with default 16 bytes per line wrapping.
|
// Test raw bytes with default 16 bytes per line wrapping.
|
||||||
EXPECT_EQ("6162 6364 6566 6768 696a 6b6c 6d6e 6f70\n71",
|
EXPECT_EQ("6162 6364 6566 6768 696a 6b6c 6d6e 6f70\n71",
|
||||||
formatted_bytes_str(B.take_front(17), None, 16, 2));
|
formatted_bytes_str(B.take_front(17), std::nullopt, 16, 2));
|
||||||
// Test raw bytes with 7 bytes per line wrapping.
|
// Test raw bytes with 7 bytes per line wrapping.
|
||||||
EXPECT_EQ("6162 6364 6566 67\n6869 6a6b 6c6d 6e\n6f70 71",
|
EXPECT_EQ("6162 6364 6566 67\n6869 6a6b 6c6d 6e\n6f70 71",
|
||||||
formatted_bytes_str(B.take_front(17), None, 7, 2));
|
formatted_bytes_str(B.take_front(17), std::nullopt, 7, 2));
|
||||||
// Test raw bytes with 8 bytes per line wrapping.
|
// Test raw bytes with 8 bytes per line wrapping.
|
||||||
EXPECT_EQ("6162 6364 6566 6768\n696a 6b6c 6d6e 6f70\n71",
|
EXPECT_EQ("6162 6364 6566 6768\n696a 6b6c 6d6e 6f70\n71",
|
||||||
formatted_bytes_str(B.take_front(17), None, 8, 2));
|
formatted_bytes_str(B.take_front(17), std::nullopt, 8, 2));
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// Test hex bytes with offset with the default 4 byte groups.
|
// Test hex bytes with offset with the default 4 byte groups.
|
||||||
|
@ -305,9 +305,9 @@ TEST(raw_ostreamTest, FormattedHexBytes) {
|
||||||
format_bytes_with_ascii_str(B.take_front(16)));
|
format_bytes_with_ascii_str(B.take_front(16)));
|
||||||
EXPECT_EQ("61626364 65666768 |abcdefgh|\n"
|
EXPECT_EQ("61626364 65666768 |abcdefgh|\n"
|
||||||
"696a6b6c 6d6e6f70 |ijklmnop|",
|
"696a6b6c 6d6e6f70 |ijklmnop|",
|
||||||
format_bytes_with_ascii_str(B.take_front(16), None, 8));
|
format_bytes_with_ascii_str(B.take_front(16), std::nullopt, 8));
|
||||||
EXPECT_EQ("61626364 65666768 |abcdefgh|\n696a6b6c |ijkl|",
|
EXPECT_EQ("61626364 65666768 |abcdefgh|\n696a6b6c |ijkl|",
|
||||||
format_bytes_with_ascii_str(B.take_front(12), None, 8));
|
format_bytes_with_ascii_str(B.take_front(12), std::nullopt, 8));
|
||||||
std::vector<uint8_t> Unprintable = {'a', '\x1e', 'b', '\x1f'};
|
std::vector<uint8_t> Unprintable = {'a', '\x1e', 'b', '\x1f'};
|
||||||
// Make sure the ASCII is still lined up correctly when fewer bytes than 16
|
// Make sure the ASCII is still lined up correctly when fewer bytes than 16
|
||||||
// bytes per line are available. The ASCII should still be aligned as if 16
|
// bytes per line are available. The ASCII should still be aligned as if 16
|
||||||
|
|
|
@ -23,9 +23,9 @@ std::unique_ptr<LLVMTargetMachine> createTargetMachine() {
|
||||||
std::string Error;
|
std::string Error;
|
||||||
const Target *TheTarget = TargetRegistry::lookupTarget(TT, Error);
|
const Target *TheTarget = TargetRegistry::lookupTarget(TT, Error);
|
||||||
|
|
||||||
return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine*>(
|
return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
|
||||||
TheTarget->createTargetMachine(TT, CPU, FS, TargetOptions(), None, None,
|
TheTarget->createTargetMachine(TT, CPU, FS, TargetOptions(), std::nullopt,
|
||||||
CodeGenOpt::Default)));
|
std::nullopt, CodeGenOpt::Default)));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<AArch64InstrInfo> createInstrInfo(TargetMachine *TM) {
|
std::unique_ptr<AArch64InstrInfo> createInstrInfo(TargetMachine *TM) {
|
||||||
|
|
|
@ -19,9 +19,9 @@ std::unique_ptr<LLVMTargetMachine> createTargetMachine() {
|
||||||
std::string Error;
|
std::string Error;
|
||||||
const Target *TheTarget = TargetRegistry::lookupTarget(TT, Error);
|
const Target *TheTarget = TargetRegistry::lookupTarget(TT, Error);
|
||||||
|
|
||||||
return std::unique_ptr<LLVMTargetMachine>(
|
return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
|
||||||
static_cast<LLVMTargetMachine *>(TheTarget->createTargetMachine(
|
TheTarget->createTargetMachine(TT, CPU, FS, TargetOptions(), std::nullopt,
|
||||||
TT, CPU, FS, TargetOptions(), None, None, CodeGenOpt::Default)));
|
std::nullopt, CodeGenOpt::Default)));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<AArch64InstrInfo> createInstrInfo(TargetMachine *TM) {
|
std::unique_ptr<AArch64InstrInfo> createInstrInfo(TargetMachine *TM) {
|
||||||
|
|
|
@ -38,8 +38,9 @@ createTargetMachine(std::string TStr, StringRef CPU, StringRef FS) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
return std::unique_ptr<GCNTargetMachine>(static_cast<GCNTargetMachine *>(
|
return std::unique_ptr<GCNTargetMachine>(
|
||||||
T->createTargetMachine(TStr, CPU, FS, Options, None, None)));
|
static_cast<GCNTargetMachine *>(T->createTargetMachine(
|
||||||
|
TStr, CPU, FS, Options, std::nullopt, std::nullopt)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(AMDGPUDwarfRegMappingTests, TestWave64DwarfRegMapping) {
|
TEST(AMDGPUDwarfRegMappingTests, TestWave64DwarfRegMapping) {
|
||||||
|
|
|
@ -81,9 +81,9 @@ TEST(InstSizes, PseudoInst) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
auto TM = std::unique_ptr<LLVMTargetMachine>(
|
auto TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
|
||||||
static_cast<LLVMTargetMachine *>(T->createTargetMachine(
|
T->createTargetMachine(TT, "generic", "", Options, std::nullopt,
|
||||||
TT, "generic", "", Options, None, None, CodeGenOpt::Default)));
|
std::nullopt, CodeGenOpt::Default)));
|
||||||
ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
|
ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
|
||||||
std::string(TM->getTargetFeatureString()),
|
std::string(TM->getTargetFeatureString()),
|
||||||
*static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
|
*static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
|
||||||
|
|
|
@ -83,10 +83,9 @@ TEST(MachineInstructionDoubleWidthResult, IsCorrect) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
auto TM = std::unique_ptr<LLVMTargetMachine>(
|
auto TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
|
||||||
static_cast<LLVMTargetMachine*>(
|
T->createTargetMachine(TT, "generic", "", Options, std::nullopt,
|
||||||
T->createTargetMachine(TT, "generic", "", Options, None, None,
|
std::nullopt, CodeGenOpt::Default)));
|
||||||
CodeGenOpt::Default)));
|
|
||||||
ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
|
ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
|
||||||
std::string(TM->getTargetFeatureString()),
|
std::string(TM->getTargetFeatureString()),
|
||||||
*static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
|
*static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
|
||||||
|
@ -240,10 +239,9 @@ TEST(MachineInstructionHorizontalReduction, IsCorrect) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
auto TM = std::unique_ptr<LLVMTargetMachine>(
|
auto TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
|
||||||
static_cast<LLVMTargetMachine*>(
|
T->createTargetMachine(TT, "generic", "", Options, std::nullopt,
|
||||||
T->createTargetMachine(TT, "generic", "", Options, None, None,
|
std::nullopt, CodeGenOpt::Default)));
|
||||||
CodeGenOpt::Default)));
|
|
||||||
ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
|
ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
|
||||||
std::string(TM->getTargetFeatureString()),
|
std::string(TM->getTargetFeatureString()),
|
||||||
*static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
|
*static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
|
||||||
|
@ -340,10 +338,9 @@ TEST(MachineInstructionRetainsPreviousHalfElement, IsCorrect) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
auto TM = std::unique_ptr<LLVMTargetMachine>(
|
auto TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
|
||||||
static_cast<LLVMTargetMachine*>(
|
T->createTargetMachine(TT, "generic", "", Options, std::nullopt,
|
||||||
T->createTargetMachine(TT, "generic", "", Options, None, None,
|
std::nullopt, CodeGenOpt::Default)));
|
||||||
CodeGenOpt::Default)));
|
|
||||||
ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
|
ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
|
||||||
std::string(TM->getTargetFeatureString()),
|
std::string(TM->getTargetFeatureString()),
|
||||||
*static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
|
*static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
|
||||||
|
@ -1047,10 +1044,9 @@ TEST(MachineInstrValidTailPredication, IsCorrect) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
auto TM = std::unique_ptr<LLVMTargetMachine>(
|
auto TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
|
||||||
static_cast<LLVMTargetMachine*>(
|
T->createTargetMachine(TT, "generic", "", Options, std::nullopt,
|
||||||
T->createTargetMachine(TT, "generic", "", Options, None, None,
|
std::nullopt, CodeGenOpt::Default)));
|
||||||
CodeGenOpt::Default)));
|
|
||||||
ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
|
ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
|
||||||
std::string(TM->getTargetFeatureString()),
|
std::string(TM->getTargetFeatureString()),
|
||||||
*static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
|
*static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
|
||||||
|
@ -1189,9 +1185,9 @@ TEST(MachineInstr, HasSideEffects) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
auto TM = std::unique_ptr<LLVMTargetMachine>(
|
auto TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
|
||||||
static_cast<LLVMTargetMachine *>(T->createTargetMachine(
|
T->createTargetMachine(TT, "generic", "", Options, std::nullopt,
|
||||||
TT, "generic", "", Options, None, None, CodeGenOpt::Default)));
|
std::nullopt, CodeGenOpt::Default)));
|
||||||
ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
|
ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
|
||||||
std::string(TM->getTargetFeatureString()),
|
std::string(TM->getTargetFeatureString()),
|
||||||
*static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
|
*static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
|
||||||
|
@ -2069,10 +2065,9 @@ TEST(MachineInstr, MVEVecSize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetOptions Options;
|
TargetOptions Options;
|
||||||
auto TM = std::unique_ptr<LLVMTargetMachine>(
|
auto TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
|
||||||
static_cast<LLVMTargetMachine*>(
|
T->createTargetMachine(TT, "generic", "", Options, std::nullopt,
|
||||||
T->createTargetMachine(TT, "generic", "", Options, None, None,
|
std::nullopt, CodeGenOpt::Default)));
|
||||||
CodeGenOpt::Default)));
|
|
||||||
ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
|
ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
|
||||||
std::string(TM->getTargetFeatureString()),
|
std::string(TM->getTargetFeatureString()),
|
||||||
*static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
|
*static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
|
||||||
|
|
|
@ -28,7 +28,7 @@ TEST_F(AIXRelocModelTest, DefalutToPIC) {
|
||||||
// relocation model unset.
|
// relocation model unset.
|
||||||
std::unique_ptr<TargetMachine> Target(TheTarget->createTargetMachine(
|
std::unique_ptr<TargetMachine> Target(TheTarget->createTargetMachine(
|
||||||
/*TT*/ TheTriple.getTriple(), /*CPU*/ "", /*Features*/ "",
|
/*TT*/ TheTriple.getTriple(), /*CPU*/ "", /*Features*/ "",
|
||||||
/*Options*/ Options, /*RM*/ None, /*CM*/ None,
|
/*Options*/ Options, /*RM*/ std::nullopt, /*CM*/ std::nullopt,
|
||||||
/*OL*/ CodeGenOpt::Default));
|
/*OL*/ CodeGenOpt::Default));
|
||||||
ASSERT_TRUE(Target) << "Could not allocate target machine!";
|
ASSERT_TRUE(Target) << "Could not allocate target machine!";
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,9 @@ std::unique_ptr<LLVMTargetMachine> createTargetMachine() {
|
||||||
const Target *TheTarget = TargetRegistry::lookupTarget(TT, Error);
|
const Target *TheTarget = TargetRegistry::lookupTarget(TT, Error);
|
||||||
assert(TheTarget);
|
assert(TheTarget);
|
||||||
|
|
||||||
return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine*>(
|
return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
|
||||||
TheTarget->createTargetMachine(TT, CPU, FS, TargetOptions(), None, None,
|
TheTarget->createTargetMachine(TT, CPU, FS, TargetOptions(), std::nullopt,
|
||||||
CodeGenOpt::Default)));
|
std::nullopt, CodeGenOpt::Default)));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Module> parseMIR(LLVMContext &Context,
|
std::unique_ptr<Module> parseMIR(LLVMContext &Context,
|
||||||
|
|
|
@ -31,9 +31,9 @@ std::unique_ptr<LLVMTargetMachine> createTargetMachine() {
|
||||||
auto TT(Triple::normalize("x86_64--"));
|
auto TT(Triple::normalize("x86_64--"));
|
||||||
std::string Error;
|
std::string Error;
|
||||||
const Target *TheTarget = TargetRegistry::lookupTarget(TT, Error);
|
const Target *TheTarget = TargetRegistry::lookupTarget(TT, Error);
|
||||||
return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine*>(
|
return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
|
||||||
TheTarget->createTargetMachine(TT, "", "", TargetOptions(), None, None,
|
TheTarget->createTargetMachine(TT, "", "", TargetOptions(), std::nullopt,
|
||||||
CodeGenOpt::Default)));
|
std::nullopt, CodeGenOpt::Default)));
|
||||||
}
|
}
|
||||||
|
|
||||||
class MachineSizeOptsTest : public testing::Test {
|
class MachineSizeOptsTest : public testing::Test {
|
||||||
|
|
|
@ -33,10 +33,10 @@ TEST(TempPathTest, TempDir) {
|
||||||
ASSERT_EQ(Path, Dir2->path());
|
ASSERT_EQ(Path, Dir2->path());
|
||||||
ASSERT_TRUE(sys::fs::exists(Path));
|
ASSERT_TRUE(sys::fs::exists(Path));
|
||||||
|
|
||||||
Dir1 = None;
|
Dir1 = std::nullopt;
|
||||||
ASSERT_TRUE(sys::fs::exists(Path));
|
ASSERT_TRUE(sys::fs::exists(Path));
|
||||||
|
|
||||||
Dir2 = None;
|
Dir2 = std::nullopt;
|
||||||
ASSERT_FALSE(sys::fs::exists(Path));
|
ASSERT_FALSE(sys::fs::exists(Path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,10 +61,10 @@ TEST(TempPathTest, TempFile) {
|
||||||
ASSERT_EQ(Path, File2->path());
|
ASSERT_EQ(Path, File2->path());
|
||||||
ASSERT_TRUE(sys::fs::exists(Path));
|
ASSERT_TRUE(sys::fs::exists(Path));
|
||||||
|
|
||||||
File1 = None;
|
File1 = std::nullopt;
|
||||||
ASSERT_TRUE(sys::fs::exists(Path));
|
ASSERT_TRUE(sys::fs::exists(Path));
|
||||||
|
|
||||||
File2 = None;
|
File2 = std::nullopt;
|
||||||
ASSERT_FALSE(sys::fs::exists(Path));
|
ASSERT_FALSE(sys::fs::exists(Path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,10 +90,10 @@ TEST(TempPathTest, TempLink) {
|
||||||
ASSERT_EQ(Path, Link2->path());
|
ASSERT_EQ(Path, Link2->path());
|
||||||
ASSERT_TRUE(sys::fs::exists(Path));
|
ASSERT_TRUE(sys::fs::exists(Path));
|
||||||
|
|
||||||
Link1 = None;
|
Link1 = std::nullopt;
|
||||||
ASSERT_TRUE(sys::fs::exists(Path));
|
ASSERT_TRUE(sys::fs::exists(Path));
|
||||||
|
|
||||||
Link2 = None;
|
Link2 = std::nullopt;
|
||||||
ASSERT_FALSE(sys::fs::exists(Path));
|
ASSERT_FALSE(sys::fs::exists(Path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -473,7 +473,7 @@ protected:
|
||||||
|
|
||||||
// Function DI
|
// Function DI
|
||||||
auto *File = DBuilder.createFile("filename.c", "/file/dir/");
|
auto *File = DBuilder.createFile("filename.c", "/file/dir/");
|
||||||
DITypeRefArray ParamTypes = DBuilder.getOrCreateTypeArray(None);
|
DITypeRefArray ParamTypes = DBuilder.getOrCreateTypeArray(std::nullopt);
|
||||||
DISubroutineType *FuncType =
|
DISubroutineType *FuncType =
|
||||||
DBuilder.createSubroutineType(ParamTypes);
|
DBuilder.createSubroutineType(ParamTypes);
|
||||||
auto *CU = DBuilder.createCompileUnit(dwarf::DW_LANG_C99,
|
auto *CU = DBuilder.createCompileUnit(dwarf::DW_LANG_C99,
|
||||||
|
@ -962,7 +962,7 @@ protected:
|
||||||
|
|
||||||
// Create debug info
|
// Create debug info
|
||||||
auto *File = DBuilder.createFile("filename.c", "/file/dir/");
|
auto *File = DBuilder.createFile("filename.c", "/file/dir/");
|
||||||
DITypeRefArray ParamTypes = DBuilder.getOrCreateTypeArray(None);
|
DITypeRefArray ParamTypes = DBuilder.getOrCreateTypeArray(std::nullopt);
|
||||||
DISubroutineType *DFuncType = DBuilder.createSubroutineType(ParamTypes);
|
DISubroutineType *DFuncType = DBuilder.createSubroutineType(ParamTypes);
|
||||||
auto *CU = DBuilder.createCompileUnit(dwarf::DW_LANG_C99,
|
auto *CU = DBuilder.createCompileUnit(dwarf::DW_LANG_C99,
|
||||||
DBuilder.createFile("filename.c",
|
DBuilder.createFile("filename.c",
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace {
|
||||||
|
|
||||||
TEST(ValueMapperTest, mapMDNode) {
|
TEST(ValueMapperTest, mapMDNode) {
|
||||||
LLVMContext Context;
|
LLVMContext Context;
|
||||||
auto *U = MDTuple::get(Context, None);
|
auto *U = MDTuple::get(Context, std::nullopt);
|
||||||
|
|
||||||
// The node should be unchanged.
|
// The node should be unchanged.
|
||||||
ValueToValueMapTy VM;
|
ValueToValueMapTy VM;
|
||||||
|
@ -107,7 +107,7 @@ TEST(ValueMapperTest, mapMDNodeDuplicatedCycle) {
|
||||||
|
|
||||||
TEST(ValueMapperTest, mapMDNodeUnresolved) {
|
TEST(ValueMapperTest, mapMDNodeUnresolved) {
|
||||||
LLVMContext Context;
|
LLVMContext Context;
|
||||||
TempMDTuple T = MDTuple::getTemporary(Context, None);
|
TempMDTuple T = MDTuple::getTemporary(Context, std::nullopt);
|
||||||
|
|
||||||
ValueToValueMapTy VM;
|
ValueToValueMapTy VM;
|
||||||
EXPECT_EQ(T.get(), ValueMapper(VM, RF_NoModuleLevelChanges).mapMDNode(*T));
|
EXPECT_EQ(T.get(), ValueMapper(VM, RF_NoModuleLevelChanges).mapMDNode(*T));
|
||||||
|
@ -115,7 +115,7 @@ TEST(ValueMapperTest, mapMDNodeUnresolved) {
|
||||||
|
|
||||||
TEST(ValueMapperTest, mapMDNodeDistinct) {
|
TEST(ValueMapperTest, mapMDNodeDistinct) {
|
||||||
LLVMContext Context;
|
LLVMContext Context;
|
||||||
auto *D = MDTuple::getDistinct(Context, None);
|
auto *D = MDTuple::getDistinct(Context, std::nullopt);
|
||||||
|
|
||||||
{
|
{
|
||||||
// The node should be cloned.
|
// The node should be cloned.
|
||||||
|
@ -131,11 +131,11 @@ TEST(ValueMapperTest, mapMDNodeDistinct) {
|
||||||
|
|
||||||
TEST(ValueMapperTest, mapMDNodeDistinctOperands) {
|
TEST(ValueMapperTest, mapMDNodeDistinctOperands) {
|
||||||
LLVMContext Context;
|
LLVMContext Context;
|
||||||
Metadata *Old = MDTuple::getDistinct(Context, None);
|
Metadata *Old = MDTuple::getDistinct(Context, std::nullopt);
|
||||||
auto *D = MDTuple::getDistinct(Context, Old);
|
auto *D = MDTuple::getDistinct(Context, Old);
|
||||||
ASSERT_EQ(Old, D->getOperand(0));
|
ASSERT_EQ(Old, D->getOperand(0));
|
||||||
|
|
||||||
Metadata *New = MDTuple::getDistinct(Context, None);
|
Metadata *New = MDTuple::getDistinct(Context, std::nullopt);
|
||||||
ValueToValueMapTy VM;
|
ValueToValueMapTy VM;
|
||||||
VM.MD()[Old].reset(New);
|
VM.MD()[Old].reset(New);
|
||||||
|
|
||||||
|
@ -146,11 +146,11 @@ TEST(ValueMapperTest, mapMDNodeDistinctOperands) {
|
||||||
|
|
||||||
TEST(ValueMapperTest, mapMDNodeSeeded) {
|
TEST(ValueMapperTest, mapMDNodeSeeded) {
|
||||||
LLVMContext Context;
|
LLVMContext Context;
|
||||||
auto *D = MDTuple::getDistinct(Context, None);
|
auto *D = MDTuple::getDistinct(Context, std::nullopt);
|
||||||
|
|
||||||
// The node should be moved.
|
// The node should be moved.
|
||||||
ValueToValueMapTy VM;
|
ValueToValueMapTy VM;
|
||||||
EXPECT_EQ(None, VM.getMappedMD(D));
|
EXPECT_EQ(std::nullopt, VM.getMappedMD(D));
|
||||||
|
|
||||||
VM.MD().insert(std::make_pair(D, TrackingMDRef(D)));
|
VM.MD().insert(std::make_pair(D, TrackingMDRef(D)));
|
||||||
EXPECT_EQ(D, *VM.getMappedMD(D));
|
EXPECT_EQ(D, *VM.getMappedMD(D));
|
||||||
|
@ -159,11 +159,11 @@ TEST(ValueMapperTest, mapMDNodeSeeded) {
|
||||||
|
|
||||||
TEST(ValueMapperTest, mapMDNodeSeededWithNull) {
|
TEST(ValueMapperTest, mapMDNodeSeededWithNull) {
|
||||||
LLVMContext Context;
|
LLVMContext Context;
|
||||||
auto *D = MDTuple::getDistinct(Context, None);
|
auto *D = MDTuple::getDistinct(Context, std::nullopt);
|
||||||
|
|
||||||
// The node should be moved.
|
// The node should be moved.
|
||||||
ValueToValueMapTy VM;
|
ValueToValueMapTy VM;
|
||||||
EXPECT_EQ(None, VM.getMappedMD(D));
|
EXPECT_EQ(std::nullopt, VM.getMappedMD(D));
|
||||||
|
|
||||||
VM.MD().insert(std::make_pair(D, TrackingMDRef()));
|
VM.MD().insert(std::make_pair(D, TrackingMDRef()));
|
||||||
EXPECT_EQ(nullptr, *VM.getMappedMD(D));
|
EXPECT_EQ(nullptr, *VM.getMappedMD(D));
|
||||||
|
@ -189,7 +189,7 @@ TEST(ValueMapperTest, mapMetadataMDString) {
|
||||||
|
|
||||||
// Make sure S1 maps to itself, but isn't memoized.
|
// Make sure S1 maps to itself, but isn't memoized.
|
||||||
EXPECT_EQ(S1, ValueMapper(VM).mapMetadata(*S1));
|
EXPECT_EQ(S1, ValueMapper(VM).mapMetadata(*S1));
|
||||||
EXPECT_EQ(None, VM.getMappedMD(S1));
|
EXPECT_EQ(std::nullopt, VM.getMappedMD(S1));
|
||||||
|
|
||||||
// We still expect VM.MD() to be respected.
|
// We still expect VM.MD() to be respected.
|
||||||
auto *S2 = MDString::get(C, "S2");
|
auto *S2 = MDString::get(C, "S2");
|
||||||
|
@ -199,7 +199,7 @@ TEST(ValueMapperTest, mapMetadataMDString) {
|
||||||
|
|
||||||
TEST(ValueMapperTest, mapMetadataGetMappedMD) {
|
TEST(ValueMapperTest, mapMetadataGetMappedMD) {
|
||||||
LLVMContext C;
|
LLVMContext C;
|
||||||
auto *N0 = MDTuple::get(C, None);
|
auto *N0 = MDTuple::get(C, std::nullopt);
|
||||||
auto *N1 = MDTuple::get(C, N0);
|
auto *N1 = MDTuple::get(C, N0);
|
||||||
|
|
||||||
// Make sure hasMD and getMappedMD work correctly.
|
// Make sure hasMD and getMappedMD work correctly.
|
||||||
|
@ -208,15 +208,15 @@ TEST(ValueMapperTest, mapMetadataGetMappedMD) {
|
||||||
EXPECT_EQ(N0, ValueMapper(VM).mapMetadata(*N0));
|
EXPECT_EQ(N0, ValueMapper(VM).mapMetadata(*N0));
|
||||||
EXPECT_EQ(N1, ValueMapper(VM).mapMetadata(*N1));
|
EXPECT_EQ(N1, ValueMapper(VM).mapMetadata(*N1));
|
||||||
EXPECT_TRUE(VM.hasMD());
|
EXPECT_TRUE(VM.hasMD());
|
||||||
ASSERT_NE(None, VM.getMappedMD(N0));
|
ASSERT_NE(std::nullopt, VM.getMappedMD(N0));
|
||||||
ASSERT_NE(None, VM.getMappedMD(N1));
|
ASSERT_NE(std::nullopt, VM.getMappedMD(N1));
|
||||||
EXPECT_EQ(N0, *VM.getMappedMD(N0));
|
EXPECT_EQ(N0, *VM.getMappedMD(N0));
|
||||||
EXPECT_EQ(N1, *VM.getMappedMD(N1));
|
EXPECT_EQ(N1, *VM.getMappedMD(N1));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ValueMapperTest, mapMetadataNoModuleLevelChanges) {
|
TEST(ValueMapperTest, mapMetadataNoModuleLevelChanges) {
|
||||||
LLVMContext C;
|
LLVMContext C;
|
||||||
auto *N0 = MDTuple::get(C, None);
|
auto *N0 = MDTuple::get(C, std::nullopt);
|
||||||
auto *N1 = MDTuple::get(C, N0);
|
auto *N1 = MDTuple::get(C, N0);
|
||||||
|
|
||||||
// Nothing should be memoized when RF_NoModuleLevelChanges.
|
// Nothing should be memoized when RF_NoModuleLevelChanges.
|
||||||
|
@ -225,8 +225,8 @@ TEST(ValueMapperTest, mapMetadataNoModuleLevelChanges) {
|
||||||
EXPECT_EQ(N0, ValueMapper(VM, RF_NoModuleLevelChanges).mapMetadata(*N0));
|
EXPECT_EQ(N0, ValueMapper(VM, RF_NoModuleLevelChanges).mapMetadata(*N0));
|
||||||
EXPECT_EQ(N1, ValueMapper(VM, RF_NoModuleLevelChanges).mapMetadata(*N1));
|
EXPECT_EQ(N1, ValueMapper(VM, RF_NoModuleLevelChanges).mapMetadata(*N1));
|
||||||
EXPECT_FALSE(VM.hasMD());
|
EXPECT_FALSE(VM.hasMD());
|
||||||
EXPECT_EQ(None, VM.getMappedMD(N0));
|
EXPECT_EQ(std::nullopt, VM.getMappedMD(N0));
|
||||||
EXPECT_EQ(None, VM.getMappedMD(N1));
|
EXPECT_EQ(std::nullopt, VM.getMappedMD(N1));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ValueMapperTest, mapMetadataConstantAsMetadata) {
|
TEST(ValueMapperTest, mapMetadataConstantAsMetadata) {
|
||||||
|
@ -246,7 +246,7 @@ TEST(ValueMapperTest, mapMetadataConstantAsMetadata) {
|
||||||
EXPECT_FALSE(VM.MD().count(CAM));
|
EXPECT_FALSE(VM.MD().count(CAM));
|
||||||
|
|
||||||
// But it should respect a mapping that gets seeded.
|
// But it should respect a mapping that gets seeded.
|
||||||
auto *N = MDTuple::get(C, None);
|
auto *N = MDTuple::get(C, std::nullopt);
|
||||||
VM.MD()[CAM].reset(N);
|
VM.MD()[CAM].reset(N);
|
||||||
EXPECT_EQ(N, ValueMapper(VM).mapMetadata(*CAM));
|
EXPECT_EQ(N, ValueMapper(VM).mapMetadata(*CAM));
|
||||||
EXPECT_EQ(N, ValueMapper(VM, RF_IgnoreMissingLocals).mapMetadata(*CAM));
|
EXPECT_EQ(N, ValueMapper(VM, RF_IgnoreMissingLocals).mapMetadata(*CAM));
|
||||||
|
@ -303,14 +303,14 @@ TEST(ValueMapperTest, mapValueLocalAsMetadata) {
|
||||||
// property. To keep RemapInstruction from crashing we need a non-null
|
// property. To keep RemapInstruction from crashing we need a non-null
|
||||||
// return here, but we also shouldn't reference the unmapped local. Use
|
// return here, but we also shouldn't reference the unmapped local. Use
|
||||||
// "metadata !{}".
|
// "metadata !{}".
|
||||||
auto *N0 = MDTuple::get(C, None);
|
auto *N0 = MDTuple::get(C, std::nullopt);
|
||||||
auto *N0AV = MetadataAsValue::get(C, N0);
|
auto *N0AV = MetadataAsValue::get(C, N0);
|
||||||
ValueToValueMapTy VM;
|
ValueToValueMapTy VM;
|
||||||
EXPECT_EQ(N0AV, ValueMapper(VM).mapValue(*MAV));
|
EXPECT_EQ(N0AV, ValueMapper(VM).mapValue(*MAV));
|
||||||
EXPECT_EQ(nullptr, ValueMapper(VM, RF_IgnoreMissingLocals).mapValue(*MAV));
|
EXPECT_EQ(nullptr, ValueMapper(VM, RF_IgnoreMissingLocals).mapValue(*MAV));
|
||||||
EXPECT_FALSE(VM.count(MAV));
|
EXPECT_FALSE(VM.count(MAV));
|
||||||
EXPECT_FALSE(VM.count(&A));
|
EXPECT_FALSE(VM.count(&A));
|
||||||
EXPECT_EQ(None, VM.getMappedMD(LAM));
|
EXPECT_EQ(std::nullopt, VM.getMappedMD(LAM));
|
||||||
|
|
||||||
VM[MAV] = MAV;
|
VM[MAV] = MAV;
|
||||||
EXPECT_EQ(MAV, ValueMapper(VM).mapValue(*MAV));
|
EXPECT_EQ(MAV, ValueMapper(VM).mapValue(*MAV));
|
||||||
|
@ -359,8 +359,8 @@ TEST(ValueMapperTest, mapValueLocalInArgList) {
|
||||||
EXPECT_EQ(MAV, ValueMapper(VM, RF_IgnoreMissingLocals).mapValue(*MAV));
|
EXPECT_EQ(MAV, ValueMapper(VM, RF_IgnoreMissingLocals).mapValue(*MAV));
|
||||||
EXPECT_FALSE(VM.count(MAV));
|
EXPECT_FALSE(VM.count(MAV));
|
||||||
EXPECT_FALSE(VM.count(&A));
|
EXPECT_FALSE(VM.count(&A));
|
||||||
EXPECT_EQ(None, VM.getMappedMD(LAM));
|
EXPECT_EQ(std::nullopt, VM.getMappedMD(LAM));
|
||||||
EXPECT_EQ(None, VM.getMappedMD(ArgList));
|
EXPECT_EQ(std::nullopt, VM.getMappedMD(ArgList));
|
||||||
|
|
||||||
VM[MAV] = MAV;
|
VM[MAV] = MAV;
|
||||||
EXPECT_EQ(MAV, ValueMapper(VM).mapValue(*MAV));
|
EXPECT_EQ(MAV, ValueMapper(VM).mapValue(*MAV));
|
||||||
|
|
|
@ -74,7 +74,7 @@ protected:
|
||||||
/// `llvm-mca` tool to verify result correctness.
|
/// `llvm-mca` tool to verify result correctness.
|
||||||
/// This function only displays on SummaryView by default.
|
/// This function only displays on SummaryView by default.
|
||||||
virtual Error runBaselineMCA(json::Object &Result, ArrayRef<MCInst> Insts,
|
virtual Error runBaselineMCA(json::Object &Result, ArrayRef<MCInst> Insts,
|
||||||
ArrayRef<mca::View *> Views = None,
|
ArrayRef<mca::View *> Views = std::nullopt,
|
||||||
const mca::PipelineOptions *PO = nullptr);
|
const mca::PipelineOptions *PO = nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue