template <typename InfoT>
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>
All.push_back(
{Code.size(), size_t(-1), Name.value_or(""), Payload.value_or("")});
Points[Name.value_or("")].push_back(All.size() - 1);
- Name = llvm::None;
- Payload = llvm::None;
+ Name = std::nullopt;
+ Payload = std::nullopt;
continue;
}
if (Text.consume_front("[[")) {
OpenRanges.push_back(
{Code.size(), size_t(-1), Name.value_or(""), Payload.value_or("")});
- Name = llvm::None;
- Payload = llvm::None;
+ Name = std::nullopt;
+ Payload = std::nullopt;
continue;
}
Require(!Name, "$name should be followed by ^ or [[");
TEST(APIntTest, GetMostSignificantDifferentBit) {
EXPECT_EQ(APIntOps::GetMostSignificantDifferentBit(APInt(8, 0), APInt(8, 0)),
- llvm::None);
+ std::nullopt);
EXPECT_EQ(
APIntOps::GetMostSignificantDifferentBit(APInt(8, 42), APInt(8, 42)),
- llvm::None);
+ std::nullopt);
EXPECT_EQ(*APIntOps::GetMostSignificantDifferentBit(APInt(8, 0), APInt(8, 1)),
0u);
EXPECT_EQ(*APIntOps::GetMostSignificantDifferentBit(APInt(8, 0), APInt(8, 2)),
EXPECT_EQ(*APIntOps::GetMostSignificantDifferentBit(APInt(8, 1), APInt(8, 0)),
0u);
EXPECT_EQ(APIntOps::GetMostSignificantDifferentBit(APInt(8, 1), APInt(8, 1)),
- llvm::None);
+ std::nullopt);
EXPECT_EQ(*APIntOps::GetMostSignificantDifferentBit(APInt(8, 1), APInt(8, 2)),
1u);
EXPECT_EQ(*APIntOps::GetMostSignificantDifferentBit(APInt(8, 1), APInt(8, 3)),
[](const APInt &V0, const APInt &V1) -> llvm::Optional<unsigned> {
assert(V0.getBitWidth() == V1.getBitWidth() && "Must have same bitwidth");
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.
for (int Bit = V0.getBitWidth() - 1; Bit >= 0; --Bit) {
if (V0[Bit] == V1[Bit])
const vector<tuple<Optional<unsigned>, Optional<StringRef>>> expected{
make_tuple(3, StringRef("2")), make_tuple(1, StringRef("7")),
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;
for (auto tup : zip_longest(pi, e)) {
EXPECT_EQ(tup, expected[iters]);
const vector<tuple<Optional<StringRef>, Optional<unsigned>>> expected{
make_tuple(StringRef("2"), 3), make_tuple(StringRef("7"), 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;
for (auto tup : zip_longest(e, pi)) {
EXPECT_EQ(tup, expected[iters]);
if (Lhs)
EXPECT_EQ(Expected, OperatorT::apply(*Lhs, Rhs));
else
- EXPECT_EQ(Expected, OperatorT::apply(None, Rhs));
+ EXPECT_EQ(Expected, OperatorT::apply(std::nullopt, Rhs));
if (Rhs)
EXPECT_EQ(Expected, OperatorT::apply(Lhs, *Rhs));
else
- EXPECT_EQ(Expected, OperatorT::apply(Lhs, None));
+ EXPECT_EQ(Expected, OperatorT::apply(Lhs, std::nullopt));
}
struct EqualityMock {};
};
EXPECT_EQ("ComparableAndStreamable",
to_string(ComparableAndStreamable::get()));
- EXPECT_EQ("None", to_string(None));
+ EXPECT_EQ("None", to_string(std::nullopt));
}
struct Comparable {
// Check basic results
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, 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, 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, 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, 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, None), ModRefInfo::ModRef);
+ EXPECT_EQ(AA.getModRefInfo(AtomicRMW, std::nullopt), ModRefInfo::ModRef);
}
static Instruction *getInstructionByName(Function &F, StringRef Name) {
EXPECT_NE(L, nullptr);
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
- EXPECT_NE(Bounds, None);
+ EXPECT_NE(Bounds, std::nullopt);
ConstantInt *InitialIVValue =
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
EXPECT_NE(L, nullptr);
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
- EXPECT_NE(Bounds, None);
+ EXPECT_NE(Bounds, std::nullopt);
ConstantInt *InitialIVValue =
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
EXPECT_NE(L, nullptr);
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
- EXPECT_NE(Bounds, None);
+ EXPECT_NE(Bounds, std::nullopt);
ConstantInt *InitialIVValue =
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
EXPECT_NE(L, nullptr);
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
- EXPECT_NE(Bounds, None);
+ EXPECT_NE(Bounds, std::nullopt);
ConstantInt *InitialIVValue =
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
EXPECT_NE(L, nullptr);
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
- EXPECT_NE(Bounds, None);
+ EXPECT_NE(Bounds, std::nullopt);
ConstantInt *InitialIVValue =
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
EXPECT_NE(L, nullptr);
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
- EXPECT_NE(Bounds, None);
+ EXPECT_NE(Bounds, std::nullopt);
ConstantInt *InitialIVValue =
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
EXPECT_NE(L, nullptr);
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
- EXPECT_NE(Bounds, None);
+ EXPECT_NE(Bounds, std::nullopt);
ConstantInt *InitialIVValue =
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
EXPECT_NE(L, nullptr);
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
- EXPECT_NE(Bounds, None);
+ EXPECT_NE(Bounds, std::nullopt);
ConstantInt *InitialIVValue =
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
EXPECT_NE(L, nullptr);
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->getStepInst().getName(), "inc");
ConstantInt *StepValue =
EXPECT_NE(L, nullptr);
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
- EXPECT_NE(Bounds, None);
+ EXPECT_NE(Bounds, std::nullopt);
ConstantInt *InitialIVValue =
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
EXPECT_NE(L, nullptr);
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
- EXPECT_NE(Bounds, None);
+ EXPECT_NE(Bounds, std::nullopt);
ConstantInt *InitialIVValue =
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
EXPECT_NE(L, nullptr);
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
- EXPECT_NE(Bounds, None);
+ EXPECT_NE(Bounds, std::nullopt);
ConstantInt *InitialIVValue =
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
EXPECT_NE(L, nullptr);
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
- EXPECT_NE(Bounds, None);
+ EXPECT_NE(Bounds, std::nullopt);
ConstantInt *InitialIVValue =
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
EXPECT_NE(L, nullptr);
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
- EXPECT_NE(Bounds, None);
+ EXPECT_NE(Bounds, std::nullopt);
ConstantInt *InitialIVValue =
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
EXPECT_NE(L, nullptr);
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
- EXPECT_NE(Bounds, None);
+ EXPECT_NE(Bounds, std::nullopt);
ConstantInt *InitialIVValue =
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
EXPECT_NE(L, nullptr);
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
- EXPECT_NE(Bounds, None);
+ EXPECT_NE(Bounds, std::nullopt);
ConstantInt *InitialIVValue =
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
EXPECT_NE(L, nullptr);
Optional<Loop::LoopBounds> InnerBounds = L->getBounds(SE);
- EXPECT_NE(InnerBounds, None);
+ EXPECT_NE(InnerBounds, std::nullopt);
InitialIVValue =
dyn_cast<ConstantInt>(&InnerBounds->getInitialIVValue());
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
EXPECT_NE(L, nullptr);
Optional<Loop::LoopBounds> Bounds = L->getBounds(SE);
- EXPECT_NE(Bounds, None);
+ EXPECT_NE(Bounds, std::nullopt);
ConstantInt *InitialIVValue =
dyn_cast<ConstantInt>(&Bounds->getInitialIVValue());
EXPECT_TRUE(InitialIVValue && InitialIVValue->isZero());
FunctionType::get(Type::getInt8PtrTy(Context), {ArgTy}, false),
GlobalValue::ExternalLinkage, "F", &M);
- AllocSizeFn->addFnAttr(Attribute::getWithAllocSizeArgs(Context, 1, None));
+ AllocSizeFn->addFnAttr(
+ Attribute::getWithAllocSizeArgs(Context, 1, std::nullopt));
// 100 is arbitrary.
std::unique_ptr<CallInst> Caller(
auto diff = [&SE](const SCEV *LHS, const SCEV *RHS) -> Optional<int> {
auto ConstantDiffOrNone = computeConstantDifference(SE, LHS, RHS);
if (!ConstantDiffOrNone)
- return None;
+ return std::nullopt;
auto ExtDiff = ConstantDiffOrNone->getSExtValue();
int Diff = ExtDiff;
EXPECT_EQ(diff(ScevIV, ScevIVNext), -1);
EXPECT_EQ(diff(ScevIVNext, ScevIV), 1);
EXPECT_EQ(diff(ScevIVNext, ScevIVNext), 0);
- EXPECT_EQ(diff(ScevV0, ScevIV), None);
- EXPECT_EQ(diff(ScevIVNext, ScevV3), None);
- EXPECT_EQ(diff(ScevYY, ScevV3), None);
+ EXPECT_EQ(diff(ScevV0, ScevIV), std::nullopt);
+ EXPECT_EQ(diff(ScevIVNext, ScevV3), std::nullopt);
+ EXPECT_EQ(diff(ScevYY, ScevV3), std::nullopt);
});
}
const DataLayout &DL = M->getDataLayout();
EXPECT_EQ(isImpliedCondition(A, A2, DL), true);
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) {
const DataLayout &DL = M->getDataLayout();
EXPECT_EQ(isImpliedCondition(A, A2, DL), true);
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) {
const DataLayout &DL = M->getDataLayout();
EXPECT_EQ(isImpliedCondition(A, A2, DL, false), false);
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) {
const DataLayout &DL = M->getDataLayout();
EXPECT_EQ(isImpliedCondition(A, A2, DL, false), false);
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) {
TargetOptions Options;
TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
- T->createTargetMachine("AArch64", "", "+sve", Options, None, None,
- CodeGenOpt::Aggressive)));
+ T->createTargetMachine("AArch64", "", "+sve", Options, std::nullopt,
+ std::nullopt, CodeGenOpt::Aggressive)));
if (!TM)
GTEST_SKIP();
EXPECT_FALSE(DAG->getHeapAllocSite(N2.getNode()));
EXPECT_FALSE(DAG->getNoMergeSiteInfo(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->addNoMergeSiteInfo(N2.getNode(), true);
DAG->addPCSections(N2.getNode(), MD);
TargetOptions Options;
TM = std::unique_ptr<LLVMTargetMachine>(
static_cast<LLVMTargetMachine *>(T->createTargetMachine(
- "amdgcn--amdpal", "gfx1010", "", Options, None)));
+ "amdgcn--amdpal", "gfx1010", "", Options, std::nullopt)));
if (!TM)
GTEST_SKIP();
return nullptr;
TargetOptions Options;
- return std::unique_ptr<LLVMTargetMachine>(
- static_cast<LLVMTargetMachine *>(T->createTargetMachine(
- "AArch64", "", "", Options, None, None, CodeGenOpt::Aggressive)));
+ return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+ T->createTargetMachine("AArch64", "", "", Options, std::nullopt,
+ std::nullopt, CodeGenOpt::Aggressive)));
}
void AArch64GISelMITest::getTargetTestModuleString(SmallString<512> &S,
return nullptr;
TargetOptions Options;
- return std::unique_ptr<LLVMTargetMachine>(
- static_cast<LLVMTargetMachine *>(T->createTargetMachine(
- "amdgcn-amd-amdhsa", "gfx900", "", Options, None, None,
- CodeGenOpt::Aggressive)));
+ return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+ T->createTargetMachine("amdgcn-amd-amdhsa", "gfx900", "", Options,
+ std::nullopt, std::nullopt,
+ CodeGenOpt::Aggressive)));
}
void AMDGPUGISelMITest::getTargetTestModuleString(
GTEST_SKIP();
TargetOptions Options;
- Machine = std::unique_ptr<TargetMachine>(
- T->createTargetMachine(Triple::normalize("x86_64--"), "", "", Options,
- None, None, CodeGenOpt::Aggressive));
+ Machine = std::unique_ptr<TargetMachine>(T->createTargetMachine(
+ Triple::normalize("x86_64--"), "", "", Options, std::nullopt,
+ std::nullopt, CodeGenOpt::Aggressive));
auto Type = FunctionType::get(Type::getVoidTy(Ctx), false);
auto F =
OurFile = DIB.createFile("xyzzy.c", "/cave");
OurCU =
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 =
DIB.createFunction(OurCU, "bees", "", OurFile, 1, OurSubT, 1,
DINode::FlagZero, DISubprogram::SPFlagDefinition);
DbgOpID RaxPHIInBlk3ID = addValueDbgOp(RaxPHIInBlk3);
DbgOpID ConstZeroID = addConstDbgOp(MachineOperand::CreateImm(0));
- DebugVariable Var(FuncVariable, None, nullptr);
+ DebugVariable Var(FuncVariable, std::nullopt, nullptr);
DbgValueProperties EmptyProps(EmptyExpr, false, false);
DIExpression *TwoOpExpr =
DIExpression::get(Ctx, {dwarf::DW_OP_LLVM_arg, 0, dwarf::DW_OP_LLVM_arg,
DbgOpID RspPHIInBlk1ID = addValueDbgOp(RspPHIInBlk1);
DbgOpID RaxPHIInBlk1ID = addValueDbgOp(RaxPHIInBlk1);
- DebugVariable Var(FuncVariable, None, nullptr);
+ DebugVariable Var(FuncVariable, std::nullopt, nullptr);
DbgValueProperties EmptyProps(EmptyExpr, false, false);
DIExpression *TwoOpExpr =
DIExpression::get(Ctx, {dwarf::DW_OP_LLVM_arg, 0, dwarf::DW_OP_LLVM_arg,
addValueDbgOp(RaxPHIInBlk1);
DbgOpID RbxPHIInBlk1ID = addValueDbgOp(RbxPHIInBlk1);
- DebugVariable Var(FuncVariable, None, nullptr);
+ DebugVariable Var(FuncVariable, std::nullopt, nullptr);
DbgValueProperties EmptyProps(EmptyExpr, false, false);
SmallVector<DbgValue, 32> VLiveOuts;
VLiveOuts.resize(5, DbgValue(EmptyProps, DbgValue::Undef));
DbgOpID LiveInRspID = DbgOpID(false, 0);
DbgOpID LiveInRaxID = DbgOpID(false, 1);
- DebugVariable Var(FuncVariable, None, nullptr);
+ DebugVariable Var(FuncVariable, std::nullopt, nullptr);
DbgValueProperties EmptyProps(EmptyExpr, false, false);
SmallVector<DbgValue, 32> VLiveOuts;
VLiveOuts.resize(4, DbgValue(EmptyProps, DbgValue::Undef));
DbgOpID LiveInRspID = DbgOpID(false, 0);
DbgOpID LiveInRaxID = DbgOpID(false, 1);
- DebugVariable Var(FuncVariable, None, nullptr);
+ DebugVariable Var(FuncVariable, std::nullopt, nullptr);
DbgValueProperties EmptyProps(EmptyExpr, false, false);
SmallVector<DbgValue, 32> VLiveOuts;
VLiveOuts.resize(3, DbgValue(EmptyProps, DbgValue::Undef));
DbgOpID LiveInRaxID = DbgOpID(false, 1);
DbgOpID LiveInRbxID = DbgOpID(false, 2);
- DebugVariable Var(FuncVariable, None, nullptr);
+ DebugVariable Var(FuncVariable, std::nullopt, nullptr);
DbgValueProperties EmptyProps(EmptyExpr, false, false);
SmallVector<DbgValue, 32> VLiveOuts;
VLiveOuts.resize(5, DbgValue(EmptyProps, DbgValue::Undef));
DbgOpID LiveInRspID = addValueDbgOp(LiveInRsp);
MInLocs[0][0] = MOutLocs[0][0] = LiveInRsp;
- DebugVariable Var(FuncVariable, None, nullptr);
+ DebugVariable Var(FuncVariable, std::nullopt, nullptr);
DbgValueProperties EmptyProps(EmptyExpr, false, false);
SmallSet<DebugVariable, 4> AllVars;
initValueArray(MInLocs, 4, 2);
initValueArray(MOutLocs, 4, 2);
- DebugVariable Var(FuncVariable, None, nullptr);
+ DebugVariable Var(FuncVariable, std::nullopt, nullptr);
DbgValueProperties EmptyProps(EmptyExpr, false, false);
SmallSet<DebugVariable, 4> AllVars;
initValueArray(MInLocs, 3, 2);
initValueArray(MOutLocs, 3, 2);
- DebugVariable Var(FuncVariable, None, nullptr);
+ DebugVariable Var(FuncVariable, std::nullopt, nullptr);
DbgValueProperties EmptyProps(EmptyExpr, false, false);
DIExpression *TwoOpExpr =
DIExpression::get(Ctx, {dwarf::DW_OP_LLVM_arg, 0, dwarf::DW_OP_LLVM_arg,
initValueArray(MInLocs, 5, 2);
initValueArray(MOutLocs, 5, 2);
- DebugVariable Var(FuncVariable, None, nullptr);
+ DebugVariable Var(FuncVariable, std::nullopt, nullptr);
DbgValueProperties EmptyProps(EmptyExpr, false, false);
SmallSet<DebugVariable, 4> AllVars;
OurFile = DIB.createFile("xyzzy.c", "/cave");
OurCU =
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 =
DIB.createFunction(OurCU, "bees", "", OurFile, 1, OurSubT, 1,
DINode::FlagZero, DISubprogram::SPFlagDefinition);
getCalleeSavedRegs(const MachineFunction *MF) const override {
return nullptr;
}
- ArrayRef<const uint32_t *> getRegMasks() const override { return None; }
- ArrayRef<const char *> getRegMaskNames() const override { return None; }
+ ArrayRef<const uint32_t *> getRegMasks() const override { return std::nullopt; }
+ ArrayRef<const char *> getRegMaskNames() const override { return std::nullopt; }
BitVector getReservedRegs(const MachineFunction &MF) const override {
return BitVector();
}
MMOs.push_back(MMO);
MCSymbol *Sym1 = MC->createTempSymbol("pre_label", false);
MCSymbol *Sym2 = MC->createTempSymbol("post_label", false);
- MDNode *HAM = MDNode::getDistinct(Ctx, None);
- MDNode *PCS = MDNode::getDistinct(Ctx, None);
+ MDNode *HAM = MDNode::getDistinct(Ctx, std::nullopt);
+ MDNode *PCS = MDNode::getDistinct(Ctx, std::nullopt);
ASSERT_TRUE(MI->memoperands_empty());
ASSERT_FALSE(MI->getPreInstrSymbol());
MMOs.push_back(MMO);
MCSymbol *Sym1 = MC->createTempSymbol("pre_label", false);
MCSymbol *Sym2 = MC->createTempSymbol("post_label", false);
- MDNode *HAM = MDNode::getDistinct(Ctx, None);
- MDNode *PCS = MDNode::getDistinct(Ctx, None);
+ MDNode *HAM = MDNode::getDistinct(Ctx, std::nullopt);
+ MDNode *PCS = MDNode::getDistinct(Ctx, std::nullopt);
MI->setMemRefs(*MF, MMOs);
MI->setPreInstrSymbol(*MF, Sym1);
MMOs.push_back(MMO);
MCSymbol *Sym1 = MC->createTempSymbol("pre_label", false);
MCSymbol *Sym2 = MC->createTempSymbol("post_label", false);
- MDNode *HAM = MDNode::getDistinct(Ctx, None);
- MDNode *PCS = MDNode::getDistinct(Ctx, None);
+ MDNode *HAM = MDNode::getDistinct(Ctx, std::nullopt);
+ MDNode *PCS = MDNode::getDistinct(Ctx, std::nullopt);
MI->setMemRefs(*MF, MMOs);
MI->setPreInstrSymbol(*MF, Sym1);
TEST(MachineInstrBuilder, BuildMI) {
LLVMContext Ctx;
- MDNode *PCS = MDNode::getDistinct(Ctx, None);
- MDNode *DI = MDNode::getDistinct(Ctx, None);
+ MDNode *PCS = MDNode::getDistinct(Ctx, std::nullopt);
+ MDNode *DI = MDNode::getDistinct(Ctx, std::nullopt);
DebugLoc DL(DI);
MIMetadata MIMD(DL, PCS);
EXPECT_EQ(MIMD.getDL(), DL);
return;
TargetOptions Options;
- TM.reset(TheTarget->createTargetMachine(TripleName, "", "",
- Options, None));
+ TM.reset(TheTarget->createTargetMachine(TripleName, "", "", Options,
+ std::nullopt));
}
};
TargetOptions Options;
TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
- T->createTargetMachine("AArch64", "", "+sve", Options, None, None,
- CodeGenOpt::Aggressive)));
+ T->createTargetMachine("AArch64", "", "+sve", Options, std::nullopt,
+ std::nullopt, CodeGenOpt::Aggressive)));
if (!TM)
GTEST_SKIP();
TargetOptions Options;
Options.EnableIPRA = EnableIPRA;
- return std::unique_ptr<TargetMachine>(T->createTargetMachine(
- "X86", "", "", Options, None, None, CodeGenOpt::Aggressive));
+ return std::unique_ptr<TargetMachine>(
+ T->createTargetMachine("X86", "", "", Options, std::nullopt, std::nullopt,
+ CodeGenOpt::Aggressive));
}
typedef std::function<void(bool)> TargetOptionsTest;
uint16_t DwarfVersion,
dwarf::DwarfFormat DwarfFormat) {
TM.reset(TheTarget->createTargetMachine(TripleName, "", "", TargetOptions(),
- None));
+ std::nullopt));
if (!TM)
return make_error<StringError>("no target machine for target " + TripleName,
inconvertibleErrorCode());
/*AugmentationData=*/StringRef(),
/*FDEPointerEncoding=*/dwarf::DW_EH_PE_absptr,
/*LSDAPointerEncoding=*/dwarf::DW_EH_PE_omit,
- /*Personality=*/None,
- /*PersonalityEnc=*/None,
+ /*Personality=*/std::nullopt,
+ /*PersonalityEnc=*/std::nullopt,
/*Arch=*/Triple::x86_64);
}
/*InitialLocation=*/0x5555abcdabcd,
/*AddressRange=*/0x111111111111,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
expectDumpResult(TestFDE, /*IsEH=*/false,
"3333abcdabcd 00004444abcdabcd 00001111abcdabcd FDE "
/*InitialLocation=*/0x4444abcdabcd,
/*AddressRange=*/0x111111111111,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
expectDumpResult(TestFDE, /*IsEH=*/true,
"1111abcdabcd 00002222abcdabcd 0033abcd FDE "
}
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,
/*AddressSize=*/8);
uint64_t Offset = 0;
/*InitialLocation=*/0x1000,
/*AddressRange=*/0x1000,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
// Having an empty instructions list is fine.
/*InitialLocation=*/0x1000,
/*AddressRange=*/0x1000,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
// Make an FDE that has only DW_CFA_nop instructions.
/*InitialLocation=*/0x1000,
/*AddressRange=*/0x1000,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
// Make a CIE that has a valid CFA definition.
/*InitialLocation=*/0x1000,
/*AddressRange=*/0x1000,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
// Make a CIE that has a valid CFA definition.
/*InitialLocation=*/0x1000,
/*AddressRange=*/0x1000,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
// Make a CIE that has a valid CFA definition.
/*InitialLocation=*/0x1000,
/*AddressRange=*/0x1000,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
// Make a CIE that has an invalid CFA definition. We do this so we can try
/*InitialLocation=*/0x1000,
/*AddressRange=*/0x1000,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
// Make a CIE that has an invalid CFA definition. We do this so we can try
/*InitialLocation=*/0x1000,
/*AddressRange=*/0x1000,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
// Make a CIE that has only defines the CFA register with no offset. Some
/*InitialLocation=*/0x1000,
/*AddressRange=*/0x1000,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
// Make a CIE that has a valid CFA definition and a single register unwind
/*InitialLocation=*/0x1000,
/*AddressRange=*/0x1000,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
// Make a CIE that has a valid CFA definition and a single register unwind
/*InitialLocation=*/0x1000,
/*AddressRange=*/0x1000,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
// Make a CIE that has a valid CFA definition and a single register unwind
/*InitialLocation=*/0x1000,
/*AddressRange=*/0x1000,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
// Make a CIE that has a valid CFA definition and a single register unwind
/*InitialLocation=*/0x1000,
/*AddressRange=*/0x1000,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
// Make a CIE that has a valid CFA definition and a single register unwind
/*InitialLocation=*/0x1000,
/*AddressRange=*/0x1000,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
// Make a CIE that has a valid CFA definition and a single register unwind
/*InitialLocation=*/0x1000,
/*AddressRange=*/0x1000,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
// Make a CIE that has a valid CFA definition and a single register unwind
/*InitialLocation=*/0x1000,
/*AddressRange=*/0x1000,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
// Make a CIE that has a valid CFA definition and a single register unwind
/*InitialLocation=*/0x1000,
/*AddressRange=*/0x1000,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
// Make a CIE that has a valid CFA definition and a single register unwind
/*InitialLocation=*/0x1000,
/*AddressRange=*/0x1000,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
// Make a CIE that has a valid CFA definition and a single register unwind
/*InitialLocation=*/0x1000,
/*AddressRange=*/0x1000,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
// Make a CIE that has a valid CFA definition and a single register unwind
/*InitialLocation=*/0x1000,
/*AddressRange=*/0x1000,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
// Make a CIE that has a valid CFA definition and a single register unwind
/*InitialLocation=*/0x1000,
/*AddressRange=*/0x1000,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
// Make a CIE that has a valid CFA definition and a single register unwind
/*InitialLocation=*/0x1000,
/*AddressRange=*/0x1000,
/*Cie=*/&TestCIE,
- /*LSDAAddress=*/None,
+ /*LSDAAddress=*/std::nullopt,
/*Arch=*/Triple::x86_64);
// Make a CIE that has a valid CFA definition and a single register unwind
HasValue(testing::ElementsAre(DWARFLocationExpression{
DWARFAddressRange{1, 3}, {}})));
- EXPECT_THAT_EXPECTED(
- Die.getLocations(DW_AT_data_member_location),
- HasValue(testing::ElementsAre(DWARFLocationExpression{None, {0x47}})));
+ EXPECT_THAT_EXPECTED(Die.getLocations(DW_AT_data_member_location),
+ HasValue(testing::ElementsAre(
+ DWARFLocationExpression{std::nullopt, {0x47}})));
EXPECT_THAT_EXPECTED(
Die.getLocations(DW_AT_vtable_elem_location),
return Instr;
}
}
- return None;
+ return std::nullopt;
};
std::unique_ptr<DWARFContext> Ctx = DWARFContext::create(E);
using object::SectionedAddress;
TEST(DWARFLocationExpression, Equality) {
- EXPECT_EQ((DWARFLocationExpression{None, {}}),
- (DWARFLocationExpression{None, {}}));
+ EXPECT_EQ((DWARFLocationExpression{std::nullopt, {}}),
+ (DWARFLocationExpression{std::nullopt, {}}));
EXPECT_NE((DWARFLocationExpression{DWARFAddressRange{1, 47}, {}}),
(DWARFLocationExpression{DWARFAddressRange{1, 48}, {}}));
EXPECT_NE((DWARFLocationExpression{DWARFAddressRange{1, 47}, {}}),
}
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(
"[0x0000000000000042, 0x0000000000000047): 1",
to_string(DWARFLocationExpression{DWARFAddressRange{0x42, 0x47}, {1}}));
inconvertibleErrorCode());
TM.reset(TheTarget->createTargetMachine(TripleName, "", "", TargetOptions(),
- None));
+ std::nullopt));
if (!TM)
return make_error<StringError>("no target machine for target " + TripleName,
inconvertibleErrorCode());
// Verify errors are propagated when we try to encoding an invalid inline
// info.
GC.forEachFunctionInfo([](FunctionInfo &FI) -> bool {
- FI.OptLineTable = llvm::None;
+ FI.OptLineTable = std::nullopt;
FI.Inline = InlineInfo(); // Invalid InlineInfo.
return false; // Stop iterating
});
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) {
MarkupParser Parser;
Parser.parseLine("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("kept");
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("kept")));
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("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");
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("text\r\n")));
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("{{{");
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{")));
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("{{{}}");
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{}}")));
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("{{}}}");
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{}}}")));
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("{{{}}}");
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{}}}")));
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("{{{:field}}}");
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{:field}}}")));
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("{{{tag:");
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tag:")));
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("{{{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");
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");
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");
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("a\033[4mb")));
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
}
TEST(SymbolizerMarkup, LinesWithMarkup) {
Parser.parseLine("{{{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}}}");
EXPECT_THAT(Parser.nextNode(),
testing::Optional(isNode("{{{tag:f1:f2:f3}}}", "tag",
ElementsAre("f1", "f2", "f3"))));
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("{{{tag:}}}");
EXPECT_THAT(Parser.nextNode(),
testing::Optional(isNode("{{{tag:}}}", "tag", ElementsAre(""))));
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("{{{tag:}}");
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tag:}}")));
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("{{{t2g}}}");
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{t2g}}}", "t2g")));
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("{{{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");
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("a")));
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("c")));
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{d}}}", "d")));
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("e")));
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("{{{}}}{{{tag}}}");
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{}}}")));
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");
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("\033[0m")));
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("\033[30m")));
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("C")));
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}}}");
EXPECT_THAT(Parser.nextNode(),
testing::Optional(
isNode("{{{tag:\033[0m}}}", "tag", ElementsAre("\033[0m"))));
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
}
TEST(SymbolizerMarkup, MultilineElements) {
Parser.parseLine("{{{tag:");
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{tag:")));
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("{{{first:");
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("}}}{{{second:");
EXPECT_THAT(
Parser.nextNode(),
testing::Optional(isNode("{{{first:}}}", "first", ElementsAre(""))));
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("}}}");
EXPECT_THAT(
Parser.nextNode(),
testing::Optional(isNode("{{{second:}}}", "second", ElementsAre(""))));
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("{{{before{{{first:");
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{before")));
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("line");
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("}}}after");
EXPECT_THAT(Parser.nextNode(),
testing::Optional(
isNode("{{{first:line}}}", "first", ElementsAre("line"))));
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("after")));
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("{{{first:");
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.flush();
EXPECT_THAT(Parser.nextNode(), testing::Optional(isNode("{{{first:")));
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("{{{first:\n");
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("}}}\n");
EXPECT_THAT(
Parser.nextNode(),
testing::Optional(isNode("{{{first:\n}}}", "first", ElementsAre("\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");
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("}}}\r\n");
EXPECT_THAT(Parser.nextNode(),
testing::Optional(
isNode("{{{first:\r\n}}}", "first", ElementsAre("\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:");
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
Parser.parseLine("\033[0m}}}");
EXPECT_THAT(Parser.nextNode(),
testing::Optional(isNode("{{{first:\033[0m}}}", "first",
ElementsAre("\033[0m"))));
- EXPECT_THAT(Parser.nextNode(), None);
+ EXPECT_THAT(Parser.nextNode(), std::nullopt);
}
} // namespace
EXPECT_EQ(S1.getSize(), 64U) << "Size was not updated";
// 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.getOffset(), 16U) << "Offset was not updated";
// Test API by performing a bunch of no-ops.
JTMB.setCPU("");
- JTMB.setRelocationModel(None);
- JTMB.setCodeModel(None);
+ JTMB.setRelocationModel(std::nullopt);
+ JTMB.setCodeModel(std::nullopt);
JTMB.setCodeGenOptLevel(CodeGenOpt::None);
JTMB.addFeatures(std::vector<std::string>());
SubtargetFeatures &STF = JTMB.getFeatures();
BB = BasicBlock::Create(Ctx, "", F);
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"));
auto CU =
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(
CU, "foo", "", File, 1, Type, 1, DINode::FlagZero,
DISubprogram::SPFlagDefinition | DISubprogram::SPFlagOptimized);
Value *RHS) {
IRBuilder<> Builder(IP.getBlock(), IP.getPoint());
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);
return Builder.saveIP();
}
Value *RHS) {
IRBuilder<> Builder(IP.getBlock(), IP.getPoint());
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);
return Builder.saveIP();
}
EXPECT_TRUE(AS.hasAttribute(Attribute::ReadOnly));
AS = AttributeSet::get(C, B_align_readonly);
AS = AS.removeAttributes(C, B_align);
- EXPECT_TRUE(AS.getAlignment() == None);
+ EXPECT_TRUE(AS.getAlignment() == std::nullopt);
EXPECT_TRUE(AS.hasAttribute(Attribute::ReadOnly));
AttributeList AL;
Optional<CFGBuilder::Update> CFGBuilder::getNextUpdate() const {
if (UpdateIdx == Updates.size())
- return None;
+ return std::nullopt;
return Updates[UpdateIdx];
}
Optional<CFGBuilder::Update> CFGBuilder::applyUpdate() {
if (UpdateIdx == Updates.size())
- return None;
+ return std::nullopt;
Update NextUpdate = Updates[UpdateIdx++];
if (NextUpdate.Action == ActionKind::Insert)
connect(NextUpdate.Edge);
bool IsOverflow;
APInt Res = N1.sadd_ov(N2, IsOverflow);
if (IsOverflow)
- return None;
+ return std::nullopt;
return Res;
},
PreferSmallest,
bool IsOverflow;
APInt Res = N1.uadd_ov(N2, IsOverflow);
if (IsOverflow)
- return None;
+ return std::nullopt;
return Res;
},
PreferSmallest,
APInt Res1 = N1.uadd_ov(N2, IsOverflow1);
APInt Res2 = N1.sadd_ov(N2, IsOverflow2);
if (IsOverflow1 || IsOverflow2)
- return None;
+ return std::nullopt;
assert(Res1 == Res2 && "Addition results differ?");
return Res1;
},
bool IsOverflow;
APInt Res = N1.ssub_ov(N2, IsOverflow);
if (IsOverflow)
- return None;
+ return std::nullopt;
return Res;
},
PreferSmallest,
bool IsOverflow;
APInt Res = N1.usub_ov(N2, IsOverflow);
if (IsOverflow)
- return None;
+ return std::nullopt;
return Res;
},
PreferSmallest,
APInt Res1 = N1.usub_ov(N2, IsOverflow1);
APInt Res2 = N1.ssub_ov(N2, IsOverflow2);
if (IsOverflow1 || IsOverflow2)
- return None;
+ return std::nullopt;
assert(Res1 == Res2 && "Subtraction results differ?");
return Res1;
},
},
[](const APInt &N1, const APInt &N2) -> Optional<APInt> {
if (N2.isZero())
- return None;
+ return std::nullopt;
return N1.urem(N2);
},
PreferSmallest,
},
[](const APInt &N1, const APInt &N2) -> Optional<APInt> {
if (N2.isZero())
- return None;
+ return std::nullopt;
return N1.srem(N2);
},
PreferSmallest,
},
[](const APInt &N1, const APInt &N2) -> Optional<APInt> {
if (N2.uge(N2.getBitWidth()))
- return None;
+ return std::nullopt;
return N1.shl(N2);
},
PreferSmallestUnsigned,
[](const ConstantRange &CR) { return CR.abs(/*IntMinIsPoison=*/true); },
[](const APInt &N) -> Optional<APInt> {
if (N.isMinSignedValue())
- return None;
+ return std::nullopt;
return N.abs();
});
}
bool foldFuncPtrAndConstToNull(LLVMContext &Context, Module *TheModule,
uint64_t AndValue,
- MaybeAlign FunctionAlign = llvm::None) {
+ MaybeAlign FunctionAlign = std::nullopt) {
Type *VoidType(Type::getVoidTy(Context));
FunctionType *FuncType(FunctionType::get(VoidType, false));
Function *Func(
// Now call the empty constrained FP function.
Builder.setIsFPConstrained(true);
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.
EXPECT_TRUE(
auto Callee =
Function::Create(CalleeTy, Function::ExternalLinkage, "", M.get());
- FCall = Builder.CreateCall(Callee, None);
+ FCall = Builder.CreateCall(Callee, std::nullopt);
EXPECT_FALSE(FCall->hasNoNaNs());
Function *V =
Function::Create(CalleeTy, Function::ExternalLinkage, "", M.get());
- FCall = Builder.CreateCall(V, None);
+ FCall = Builder.CreateCall(V, std::nullopt);
EXPECT_FALSE(FCall->hasNoNaNs());
FMF.clear();
FMF.setNoNaNs();
Builder.setFastMathFlags(FMF);
- FCall = Builder.CreateCall(Callee, None);
+ FCall = Builder.CreateCall(Callee, std::nullopt);
EXPECT_TRUE(Builder.getFastMathFlags().any());
EXPECT_TRUE(Builder.getFastMathFlags().NoNaNs);
EXPECT_TRUE(FCall->hasNoNaNs());
- FCall = Builder.CreateCall(V, None);
+ FCall = Builder.CreateCall(V, std::nullopt);
EXPECT_TRUE(Builder.getFastMathFlags().any());
EXPECT_TRUE(Builder.getFastMathFlags().NoNaNs);
EXPECT_TRUE(FCall->hasNoNaNs());
auto File = DIB.createFile("error.swift", "/");
auto CU =
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(
CU, "noerr", "", File, 1, Type, 1, DINode::FlagZero,
DISubprogram::SPFlagDefinition | DISubprogram::SPFlagOptimized);
auto CU = DIB.createCompileUnit(dwarf::DW_LANG_Cobol74,
DIB.createFile("F.CBL", "/"), "llvm-cobol74",
true, "", 0);
- auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
+ auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
auto SP = DIB.createFunction(
CU, "foo", "", File, 1, Type, 1, DINode::FlagZero,
DISubprogram::SPFlagDefinition | DISubprogram::SPFlagOptimized);
auto CU = DIB.createCompileUnit(dwarf::DW_LANG_C, File, "clang",
/*isOptimized=*/true, /*Flags=*/"",
/*Runtime Version=*/0);
- auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
+ auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
auto SP = DIB.createFunction(
CU, "foo", /*LinkageName=*/"", File,
/*LineNo=*/1, Type, /*ScopeLine=*/2, DINode::FlagZero,
auto CU = DIB.createCompileUnit(dwarf::DW_LANG_C_plus_plus_11,
DIB.createFile("tmp.cpp", "/"), "", true, "",
0);
- auto SPType = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
+ auto SPType =
+ DIB.createSubroutineType(DIB.getOrCreateTypeArray(std::nullopt));
auto SP =
DIB.createFunction(CU, "foo", "foo", File, 1, SPType, 1, DINode::FlagZero,
DISubprogram::SPFlagDefinition);
IRBuilder<> Builder(Ctx);
Builder.SetInsertPoint(Br);
EXPECT_EQ(DL1, Builder.getCurrentDebugLocation());
- auto Call1 = Builder.CreateCall(Callee, None);
+ auto Call1 = Builder.CreateCall(Callee, std::nullopt);
EXPECT_EQ(DL1, Call1->getDebugLoc());
Call1->setDebugLoc(DL2);
Builder.SetInsertPoint(Call1->getParent(), Call1->getIterator());
EXPECT_EQ(DL2, Builder.getCurrentDebugLocation());
- auto Call2 = Builder.CreateCall(Callee, None);
+ auto Call2 = Builder.CreateCall(Callee, std::nullopt);
EXPECT_EQ(DL2, Call2->getDebugLoc());
DIB.finalize();
auto CU = DIB.createCompileUnit(dwarf::DW_LANG_Cobol74,
F, "llvm-cobol74",
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);
AttrBuilder AB(C);
AB.addAttribute(Attribute::Cold);
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));
std::unique_ptr<CallInst> Clone(CallInst::Create(Call.get(), NewBundle));
AB.addAttribute(Attribute::Cold);
Invoke->setAttributes(
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));
std::unique_ptr<InvokeInst> Clone(
Module M;
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 *MD1, Metadata *MD2) {
Metadata *MDs[] = {MD1, MD2};
return MDNode::get(Context, MDs);
}
- MDTuple *getTuple() { return MDTuple::getDistinct(Context, None); }
+ MDTuple *getTuple() { return MDTuple::getDistinct(Context, std::nullopt); }
DISubroutineType *getSubroutineType() {
return DISubroutineType::getDistinct(Context, DINode::FlagZero, 0,
getNode(nullptr));
DIType *getDerivedType() {
return DIDerivedType::getDistinct(
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() {
return ConstantInt::get(Type::getInt32Ty(Context), Counter++);
}
Function *getFunction(StringRef Name) {
return Function::Create(
- FunctionType::get(Type::getVoidTy(Context), None, false),
+ FunctionType::get(Type::getVoidTy(Context), std::nullopt, false),
Function::ExternalLinkage, Name, M);
}
};
// !0 = !{!0}
// !1 = !{!0}
{
- auto Temp = MDNode::getTemporary(Context, None);
+ auto Temp = MDNode::getTemporary(Context, std::nullopt);
Metadata *Args[] = {Temp.get()};
MDNode *Self = MDNode::get(Context, Args);
Self->replaceOperandWith(0, Self);
// !0 = !{!0, !{}}
// !1 = !{!0, !{}}
{
- auto Temp = MDNode::getTemporary(Context, None);
- Metadata *Args[] = {Temp.get(), MDNode::get(Context, None)};
+ auto Temp = MDNode::getTemporary(Context, std::nullopt);
+ Metadata *Args[] = {Temp.get(), MDNode::get(Context, std::nullopt)};
MDNode *Self = MDNode::get(Context, Args);
Self->replaceOperandWith(0, Self);
ASSERT_EQ(Self, Self->getOperand(0));
auto *BB1 = BasicBlock::Create(Context, "entry", F1);
auto *R0 = ReturnInst::Create(Context, BB0);
auto *R1 = ReturnInst::Create(Context, BB1);
- auto *N0 = MDNode::getDistinct(Context, None);
- auto *N1 = MDNode::getDistinct(Context, None);
+ auto *N0 = MDNode::getDistinct(Context, std::nullopt);
+ auto *N1 = MDNode::getDistinct(Context, std::nullopt);
R0->setMetadata("md", N0);
R1->setMetadata("md", N1);
auto *F1 = Function::Create(FTy, GlobalValue::ExternalLinkage, "F1", &M);
auto *BB0 = BasicBlock::Create(Context, "entry", F0);
auto *BB1 = BasicBlock::Create(Context, "entry", F1);
- auto *N0 = MDNode::getDistinct(Context, None);
- auto *N1 = MDNode::getDistinct(Context, None);
+ auto *N0 = MDNode::getDistinct(Context, std::nullopt);
+ auto *N1 = MDNode::getDistinct(Context, std::nullopt);
auto *MAV0 = MetadataAsValue::get(Context, N0);
auto *MAV1 = MetadataAsValue::get(Context, N1);
CallInst::Create(Intrinsic, MAV0, "", BB0);
CI0->dropAllReferences();
auto *R0 = ReturnInst::Create(Context, BB0);
- auto *N0 = MDNode::getDistinct(Context, None);
+ auto *N0 = MDNode::getDistinct(Context, std::nullopt);
R0->setMetadata("md", N0);
// Printing the metadata node would previously result in a failed assertion
auto *StructTy = cast<DICompositeType>(getCompositeType());
DIType *PointerTy = DIDerivedType::getDistinct(
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));
auto *Var = DILocalVariable::get(Context, Scope, "foo", File,
TEST_F(MDNodeTest, NullOperand) {
// metadata !{}
- MDNode *Empty = MDNode::get(Context, None);
+ MDNode *Empty = MDNode::get(Context, std::nullopt);
// metadata !{metadata !{}}
Metadata *Ops[] = {Empty};
TEST_F(MDNodeTest, DistinctOnUniquingCollision) {
// !{}
- MDNode *Empty = MDNode::get(Context, None);
+ MDNode *Empty = MDNode::get(Context, std::nullopt);
ASSERT_TRUE(Empty->isResolved());
EXPECT_FALSE(Empty->isDistinct());
TEST_F(MDNodeTest, UniquedOnDeletedOperand) {
// temp !{}
- TempMDTuple T = MDTuple::getTemporary(Context, None);
+ TempMDTuple T = MDTuple::getTemporary(Context, std::nullopt);
// !{temp !{}}
Metadata *Ops[] = {T.get()};
TEST_F(MDNodeTest, getDistinct) {
// !{}
- MDNode *Empty = MDNode::get(Context, None);
+ MDNode *Empty = MDNode::get(Context, std::nullopt);
ASSERT_TRUE(Empty->isResolved());
ASSERT_FALSE(Empty->isDistinct());
- ASSERT_EQ(Empty, MDNode::get(Context, None));
+ ASSERT_EQ(Empty, MDNode::get(Context, std::nullopt));
// distinct !{}
- MDNode *Distinct1 = MDNode::getDistinct(Context, None);
- MDNode *Distinct2 = MDNode::getDistinct(Context, None);
+ MDNode *Distinct1 = MDNode::getDistinct(Context, std::nullopt);
+ MDNode *Distinct2 = MDNode::getDistinct(Context, std::nullopt);
EXPECT_TRUE(Distinct1->isResolved());
EXPECT_TRUE(Distinct2->isDistinct());
EXPECT_NE(Empty, Distinct1);
EXPECT_NE(Distinct1, Distinct2);
// !{}
- ASSERT_EQ(Empty, MDNode::get(Context, None));
+ ASSERT_EQ(Empty, MDNode::get(Context, std::nullopt));
}
TEST_F(MDNodeTest, isUniqued) {
- MDNode *U = MDTuple::get(Context, None);
- MDNode *D = MDTuple::getDistinct(Context, None);
- auto T = MDTuple::getTemporary(Context, None);
+ MDNode *U = MDTuple::get(Context, std::nullopt);
+ MDNode *D = MDTuple::getDistinct(Context, std::nullopt);
+ auto T = MDTuple::getTemporary(Context, std::nullopt);
EXPECT_TRUE(U->isUniqued());
EXPECT_FALSE(D->isUniqued());
EXPECT_FALSE(T->isUniqued());
}
TEST_F(MDNodeTest, isDistinct) {
- MDNode *U = MDTuple::get(Context, None);
- MDNode *D = MDTuple::getDistinct(Context, None);
- auto T = MDTuple::getTemporary(Context, None);
+ MDNode *U = MDTuple::get(Context, std::nullopt);
+ MDNode *D = MDTuple::getDistinct(Context, std::nullopt);
+ auto T = MDTuple::getTemporary(Context, std::nullopt);
EXPECT_FALSE(U->isDistinct());
EXPECT_TRUE(D->isDistinct());
EXPECT_FALSE(T->isDistinct());
}
TEST_F(MDNodeTest, isTemporary) {
- MDNode *U = MDTuple::get(Context, None);
- MDNode *D = MDTuple::getDistinct(Context, None);
- auto T = MDTuple::getTemporary(Context, None);
+ MDNode *U = MDTuple::get(Context, std::nullopt);
+ MDNode *D = MDTuple::getDistinct(Context, std::nullopt);
+ auto T = MDTuple::getTemporary(Context, std::nullopt);
EXPECT_FALSE(U->isTemporary());
EXPECT_FALSE(D->isTemporary());
EXPECT_TRUE(T->isTemporary());
TEST_F(MDNodeTest, getDistinctWithUnresolvedOperands) {
// temporary !{}
- auto Temp = MDTuple::getTemporary(Context, None);
+ auto Temp = MDTuple::getTemporary(Context, std::nullopt);
ASSERT_FALSE(Temp->isResolved());
// distinct !{temporary !{}}
EXPECT_EQ(Temp.get(), Distinct->getOperand(0));
// temporary !{} => !{}
- MDNode *Empty = MDNode::get(Context, None);
+ MDNode *Empty = MDNode::get(Context, std::nullopt);
Temp->replaceAllUsesWith(Empty);
EXPECT_EQ(Empty, Distinct->getOperand(0));
}
TEST_F(MDNodeTest, handleChangedOperandRecursion) {
// !0 = !{}
- MDNode *N0 = MDNode::get(Context, None);
+ MDNode *N0 = MDNode::get(Context, std::nullopt);
// !1 = !{!3, null}
- auto Temp3 = MDTuple::getTemporary(Context, None);
+ auto Temp3 = MDTuple::getTemporary(Context, std::nullopt);
Metadata *Ops1[] = {Temp3.get(), nullptr};
MDNode *N1 = MDNode::get(Context, Ops1);
// a global value that gets RAUW'ed.
//
// 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()};
MDNode *Empty = MDTuple::get(Context, ArrayRef<Metadata *>());
}
TEST_F(MDNodeTest, replaceWithUniqued) {
- auto *Empty = MDTuple::get(Context, None);
+ auto *Empty = MDTuple::get(Context, std::nullopt);
MDTuple *FirstUniqued;
{
Metadata *Ops[] = {Empty};
EXPECT_EQ(FirstUniqued, Uniqued);
}
{
- auto Unresolved = MDTuple::getTemporary(Context, None);
+ auto Unresolved = MDTuple::getTemporary(Context, std::nullopt);
Metadata *Ops[] = {Unresolved.get()};
auto Temp = MDTuple::getTemporary(Context, Ops);
EXPECT_TRUE(Temp->isTemporary());
TEST_F(MDNodeTest, replaceWithUniquedResolvingOperand) {
// temp !{}
- MDTuple *Op = MDTuple::getTemporary(Context, None).release();
+ MDTuple *Op = MDTuple::getTemporary(Context, std::nullopt).release();
EXPECT_FALSE(Op->isResolved());
// temp !{temp !{}}
TEST_F(MDNodeTest, replaceWithDistinct) {
{
- auto *Empty = MDTuple::get(Context, None);
+ auto *Empty = MDTuple::get(Context, std::nullopt);
Metadata *Ops[] = {Empty};
auto Temp = MDTuple::getTemporary(Context, Ops);
EXPECT_TRUE(Temp->isTemporary());
EXPECT_EQ(Current, Distinct);
}
{
- auto Unresolved = MDTuple::getTemporary(Context, None);
+ auto Unresolved = MDTuple::getTemporary(Context, std::nullopt);
Metadata *Ops[] = {Unresolved.get()};
auto Temp = MDTuple::getTemporary(Context, Ops);
EXPECT_TRUE(Temp->isTemporary());
TrackingMDRef Ref;
EXPECT_EQ(nullptr, Ref.get());
{
- auto Temp = MDTuple::getTemporary(Context, None);
+ auto Temp = MDTuple::getTemporary(Context, std::nullopt);
Ref.reset(Temp.get());
EXPECT_EQ(Temp.get(), Ref.get());
}
}
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);
EXPECT_TRUE(L->isTemporary());
EXPECT_FALSE(L->isResolved());
}
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);
EXPECT_TRUE(L->isTemporary());
auto L2 = L->clone();
}
TEST_F(DILocationTest, discriminatorEncodingNegativeTests) {
- EXPECT_EQ(None, DILocation::encodeDiscriminator(0, 0, 0x1000));
- EXPECT_EQ(None, DILocation::encodeDiscriminator(0x1000, 0, 0));
- EXPECT_EQ(None, DILocation::encodeDiscriminator(0, 0x1000, 0));
- EXPECT_EQ(None, DILocation::encodeDiscriminator(0, 0, 0x1000));
- EXPECT_EQ(None, DILocation::encodeDiscriminator(0x1ff, 0x1ff, 8));
- EXPECT_EQ(None,
- DILocation::encodeDiscriminator(std::numeric_limits<uint32_t>::max(),
- std::numeric_limits<uint32_t>::max(),
- 0));
+ EXPECT_EQ(std::nullopt, DILocation::encodeDiscriminator(0, 0, 0x1000));
+ EXPECT_EQ(std::nullopt, DILocation::encodeDiscriminator(0x1000, 0, 0));
+ EXPECT_EQ(std::nullopt, DILocation::encodeDiscriminator(0, 0x1000, 0));
+ EXPECT_EQ(std::nullopt, DILocation::encodeDiscriminator(0, 0, 0x1000));
+ EXPECT_EQ(std::nullopt, DILocation::encodeDiscriminator(0x1ff, 0x1ff, 8));
+ EXPECT_EQ(std::nullopt, DILocation::encodeDiscriminator(
+ std::numeric_limits<uint32_t>::max(),
+ std::numeric_limits<uint32_t>::max(), 0));
}
TEST_F(DILocationTest, discriminatorSpecialCases) {
->getDuplicationFactor());
// Check we return None for unencodable cases.
- EXPECT_EQ(None, L4->cloneWithBaseDiscriminator(0x1000));
- EXPECT_EQ(None, L4->cloneByMultiplyingDuplicationFactor(0x1000));
+ EXPECT_EQ(std::nullopt, L4->cloneWithBaseDiscriminator(0x1000));
+ EXPECT_EQ(std::nullopt, L4->cloneByMultiplyingDuplicationFactor(0x1000));
}
TEST_F(GenericDINodeTest, get) {
StringRef Header = "header";
- auto *Empty = MDNode::get(Context, None);
+ auto *Empty = MDNode::get(Context, std::nullopt);
Metadata *Ops1[] = {Empty};
auto *N = GenericDINode::get(Context, 15, Header, Ops1);
EXPECT_EQ(15u, N->getTag());
TEST_F(GenericDINodeTest, getEmptyHeader) {
// 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(nullptr, N->getOperand(0));
}
Context, Tag, Name, File, Line, Scope, BaseType, SizeInBits, AlignInBits,
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());
N->replaceElements(Elements);
EXPECT_EQ(Elements, N->getElements().get());
N->replaceVTableHolder(nullptr);
EXPECT_EQ(nullptr, N->getVTableHolder());
- auto *TemplateParams = MDTuple::getDistinct(Context, None);
+ auto *TemplateParams = MDTuple::getDistinct(Context, std::nullopt);
EXPECT_EQ(nullptr, N->getTemplateParams().get());
N->replaceTemplateParams(TemplateParams);
EXPECT_EQ(TemplateParams, N->getTemplateParams().get());
unsigned RuntimeVersion = 2;
StringRef SplitDebugFilename = "another/file";
auto EmissionKind = DICompileUnit::FullDebug;
- MDTuple *EnumTypes = MDTuple::getDistinct(Context, None);
- MDTuple *RetainedTypes = MDTuple::getDistinct(Context, None);
- MDTuple *ImportedEntities = MDTuple::getDistinct(Context, None);
+ MDTuple *EnumTypes = MDTuple::getDistinct(Context, std::nullopt);
+ MDTuple *RetainedTypes = MDTuple::getDistinct(Context, std::nullopt);
+ MDTuple *ImportedEntities = MDTuple::getDistinct(Context, std::nullopt);
uint64_t DWOId = 0xc0ffee;
StringRef SysRoot = "/";
StringRef SDK = "MacOSX.sdk";
RetainedTypes, nullptr, ImportedEntities, nullptr, DWOId, true, false,
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());
N->replaceGlobalVariables(GlobalVariables);
EXPECT_EQ(GlobalVariables, N->getGlobalVariables().get());
N->replaceGlobalVariables(nullptr);
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());
N->replaceMacros(Macros);
EXPECT_EQ(Macros, N->getMacros().get());
} while (false)
// Empty expression should be valid.
- EXPECT_TRUE(DIExpression::get(Context, None));
+ EXPECT_TRUE(DIExpression::get(Context, std::nullopt));
// Valid constructions.
EXPECT_VALID(dwarf::DW_OP_plus_uconst, 6);
typedef MetadataTest MetadataAsValueTest;
TEST_F(MetadataAsValueTest, MDNode) {
- MDNode *N = MDNode::get(Context, None);
+ MDNode *N = MDNode::get(Context, std::nullopt);
auto *V = MetadataAsValue::get(Context, N);
EXPECT_TRUE(V->getType()->isMetadataTy());
EXPECT_EQ(N, V->getMetadata());
}
TEST_F(MetadataAsValueTest, MDNodeMDNode) {
- MDNode *N = MDNode::get(Context, None);
+ MDNode *N = MDNode::get(Context, std::nullopt);
Metadata *Ops[] = {N};
MDNode *N2 = MDNode::get(Context, Ops);
auto *V = MetadataAsValue::get(Context, N2);
ConstantAsMetadata *CI =
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 *N = MDTuple::get(Context, {Temp1.get()});
ConstantAsMetadata::get(ConstantInt::get(Context, APInt(8, 0)));
// 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.
Metadata *Ops1[] = {CI, CI, Temp.get()};
ASSERT_EQ(&PH2, D->getOperand(2));
// Replace them.
- auto *N0 = MDTuple::get(Context, None);
+ auto *N0 = MDTuple::get(Context, std::nullopt);
auto *N1 = MDTuple::get(Context, N0);
PH0.replaceUseWith(N0);
PH1.replaceUseWith(N1);
TEST_F(DistinctMDOperandPlaceholderTest, replaceUseWithNoUser) {
// 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
DILocalVariable *VarB =
DILocalVariable::get(Context, Scope, "B", File, 7, Type, 3, Flags, 8, nullptr);
- DebugVariable DebugVariableA(VarA, None, nullptr);
- DebugVariable DebugVariableInlineA(VarA, None, InlinedLoc);
- DebugVariable DebugVariableB(VarB, None, nullptr);
+ DebugVariable DebugVariableA(VarA, std::nullopt, nullptr);
+ DebugVariable DebugVariableInlineA(VarA, std::nullopt, InlinedLoc);
+ DebugVariable DebugVariableB(VarB, std::nullopt, nullptr);
DebugVariable DebugVariableFragB(VarB, {{16, 16}}, nullptr);
DebugVariableMap.insert({DebugVariableA, 2});
EXPECT_EQ(B->getOperand(3), Value5);
// 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);
Temp1->push_back(Value1);
"exit:\n"
" ret void\n"
"}\n")),
- CallbacksHandle(),
- PB(nullptr, PipelineTuningOptions(), None, &CallbacksHandle.Callbacks),
+ CallbacksHandle(), PB(nullptr, PipelineTuningOptions(), std::nullopt,
+ &CallbacksHandle.Callbacks),
PM(), LAM(), FAM(), CGAM(), AM() {
EXPECT_TRUE(&CallbacksHandle.Callbacks ==
TEST(VerifierTest, MDNodeWrongContext) {
LLVMContext C1, C2;
- auto *Node = MDNode::get(C1, None);
+ auto *Node = MDNode::get(C1, std::nullopt);
Module M("M", C2);
auto *NamedNode = M.getOrInsertNamedMetadata("test");
return nullptr;
TargetOptions Options;
- return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
- T->createTargetMachine(TStr, CPU, FS, Options, None, None)));
+ return std::unique_ptr<LLVMTargetMachine>(
+ static_cast<LLVMTargetMachine *>(T->createTargetMachine(
+ TStr, CPU, FS, Options, std::nullopt, std::nullopt)));
}
TEST(AMDGPUDwarfRegMappingTests, TestWave64DwarfRegMapping) {
TheStreamer->switchSection(C.MOFI->getDwarfLineSection());
MCDwarfLineTableHeader Header;
MCDwarfLineTableParams Params = Assembler.getDWARFLinetableParams();
- Optional<MCDwarfLineStr> LineStr(None);
+ Optional<MCDwarfLineStr> LineStr(std::nullopt);
if (Ctx.getDwarfVersion() >= 5) {
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;
TEST(MCDisassembler, XCOFFSymbolPriorityTest) {
- SymbolInfoTy SIT1(0x100000, "sym1", None, 1, false);
- SymbolInfoTy SIT2(0x110000, "sym2", None, 2, false);
+ SymbolInfoTy SIT1(0x100000, "sym1", std::nullopt, 1, false);
+ SymbolInfoTy SIT2(0x110000, "sym2", std::nullopt, 2, false);
SymbolInfoTy SIT3(0x120000, ".func", XCOFF::XMC_PR, 3, true);
SymbolInfoTy SIT4(0x120000, ".text", XCOFF::XMC_PR, 4, false);
SymbolInfoTy SIT5(0x130000, "TOC", XCOFF::XMC_TC0, 5, false);
return nullptr;
TargetOptions Options;
- return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine*>(
- T->createTargetMachine("AMDGPU", "gfx900", "", Options, None, None,
- CodeGenOpt::Aggressive)));
+ return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+ T->createTargetMachine("AMDGPU", "gfx900", "", Options, std::nullopt,
+ std::nullopt, CodeGenOpt::Aggressive)));
}
std::unique_ptr<Module> parseMIR(LLVMContext &Context,
if (!T)
return nullptr;
TargetOptions Options;
- return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
- T->createTargetMachine(TT, CPU, FS, Options, None, None)));
+ return std::unique_ptr<LLVMTargetMachine>(
+ static_cast<LLVMTargetMachine *>(T->createTargetMachine(
+ TT, CPU, FS, Options, std::nullopt, std::nullopt)));
}
std::unique_ptr<Module> parseMIR(const TargetMachine &TM, StringRef MIRCode,
};
// 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=*/1, Section1BBAddrMaps);
// Check that when no bb-address-map section is found for a text section,
"index: 10");
// Linked sections are not checked when we don't target a specific text
// section.
- DoCheckSucceeds(InvalidLinkedYamlString, /*TextSectionIndex=*/None,
+ DoCheckSucceeds(InvalidLinkedYamlString, /*TextSectionIndex=*/std::nullopt,
AllBBAddrMaps);
// Check that we can detect when bb-address-map decoding fails.
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 decode LEB128 at offset 0x00000008: malformed "
"uleb128, extends past end");
ASSERT_EQ(2u, File.streams().size());
EXPECT_EQ(StreamType::Unused, File.streams()[0].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) {
static void check(const remarks::Remark &R, StringRef ExpectedR,
StringRef ExpectedMeta,
- Optional<remarks::StringTable> StrTab = None) {
+ Optional<remarks::StringTable> StrTab = std::nullopt) {
return check(remarks::SerializerMode::Separate, R, ExpectedR, ExpectedMeta,
std::move(StrTab));
}
-static void checkStandalone(const remarks::Remark &R, StringRef ExpectedR,
- Optional<remarks::StringTable> StrTab = None) {
+static void
+checkStandalone(const remarks::Remark &R, StringRef ExpectedR,
+ Optional<remarks::StringTable> StrTab = std::nullopt) {
return check(remarks::SerializerMode::Standalone, R, ExpectedR,
- /*ExpectedMeta=*/None, std::move(StrTab));
+ /*ExpectedMeta=*/std::nullopt, std::move(StrTab));
}
TEST(BitstreamRemarkSerializer, SeparateRemarkFileNoOptionals) {
Contains
};
-void parseExpectErrorMeta(StringRef Buf, const char *Error, CmpType Cmp,
- Optional<StringRef> ExternalFilePrependPath = None) {
+void parseExpectErrorMeta(
+ StringRef Buf, const char *Error, CmpType Cmp,
+ Optional<StringRef> ExternalFilePrependPath = std::nullopt) {
std::string ErrorStr;
raw_string_ostream Stream(ErrorStr);
Expected<std::unique_ptr<remarks::RemarkParser>> MaybeParser =
remarks::createRemarkParserFromMeta(remarks::Format::YAML, Buf,
- /*StrTab=*/None,
+ /*StrTab=*/std::nullopt,
std::move(ExternalFilePrependPath));
handleAllErrors(MaybeParser.takeError(),
[&](const ErrorInfoBase &EIB) { EIB.log(Stream); });
static void check(remarks::Format SerializerFormat,
remarks::SerializerMode Mode, ArrayRef<remarks::Remark> Rs,
StringRef ExpectedR, Optional<StringRef> ExpectedMeta,
- Optional<remarks::StringTable> StrTab = None) {
+ Optional<remarks::StringTable> StrTab = std::nullopt) {
std::string Buf;
raw_string_ostream OS(Buf);
Expected<std::unique_ptr<remarks::RemarkSerializer>> MaybeS = [&] {
static void check(remarks::Format SerializerFormat, const remarks::Remark &R,
StringRef ExpectedR, StringRef ExpectedMeta,
- Optional<remarks::StringTable> StrTab = None) {
+ Optional<remarks::StringTable> StrTab = std::nullopt) {
return check(SerializerFormat, remarks::SerializerMode::Separate,
makeArrayRef(&R, &R + 1), ExpectedR, ExpectedMeta,
std::move(StrTab));
}
-static void checkStandalone(remarks::Format SerializerFormat,
- const remarks::Remark &R, StringRef ExpectedR,
- Optional<remarks::StringTable> StrTab = None) {
+static void
+checkStandalone(remarks::Format SerializerFormat, const remarks::Remark &R,
+ StringRef ExpectedR,
+ Optional<remarks::StringTable> StrTab = std::nullopt) {
return check(SerializerFormat, remarks::SerializerMode::Standalone,
makeArrayRef(&R, &R + 1), ExpectedR,
- /*ExpectedMeta=*/None, std::move(StrTab));
+ /*ExpectedMeta=*/std::nullopt, std::move(StrTab));
}
TEST(YAMLRemarks, SerializerRemark) {
" DebugLoc: { File: 6, Line: 6, Column: 7 }\n"
"...\n",
561),
- /*ExpectedMeta=*/None, std::move(PreFilledStrTab));
+ /*ExpectedMeta=*/std::nullopt, std::move(PreFilledStrTab));
}
TEST(CheckedArithmetic, CheckedAdd) {
const int64_t Max = std::numeric_limits<int64_t>::max();
const int64_t Min = std::numeric_limits<int64_t>::min();
- EXPECT_EQ(checkedAdd<int64_t>(Max, Max), None);
- EXPECT_EQ(checkedAdd<int64_t>(Min, -1), None);
- EXPECT_EQ(checkedAdd<int64_t>(Max, 1), None);
+ EXPECT_EQ(checkedAdd<int64_t>(Max, Max), std::nullopt);
+ EXPECT_EQ(checkedAdd<int64_t>(Min, -1), std::nullopt);
+ EXPECT_EQ(checkedAdd<int64_t>(Max, 1), std::nullopt);
EXPECT_EQ(checkedAdd<int64_t>(10, 1), Optional<int64_t>(11));
}
TEST(CheckedArithmetic, CheckedAddSmall) {
const int16_t Max = std::numeric_limits<int16_t>::max();
const int16_t Min = std::numeric_limits<int16_t>::min();
- EXPECT_EQ(checkedAdd<int16_t>(Max, Max), None);
- EXPECT_EQ(checkedAdd<int16_t>(Min, -1), None);
- EXPECT_EQ(checkedAdd<int16_t>(Max, 1), None);
+ EXPECT_EQ(checkedAdd<int16_t>(Max, Max), std::nullopt);
+ EXPECT_EQ(checkedAdd<int16_t>(Min, -1), std::nullopt);
+ EXPECT_EQ(checkedAdd<int16_t>(Max, 1), std::nullopt);
EXPECT_EQ(checkedAdd<int16_t>(10, 1), Optional<int64_t>(11));
}
TEST(CheckedArithmetic, CheckedMul) {
const int64_t Max = std::numeric_limits<int64_t>::max();
const int64_t Min = std::numeric_limits<int64_t>::min();
- EXPECT_EQ(checkedMul<int64_t>(Max, 2), None);
- EXPECT_EQ(checkedMul<int64_t>(Max, Max), None);
- EXPECT_EQ(checkedMul<int64_t>(Min, 2), None);
+ EXPECT_EQ(checkedMul<int64_t>(Max, 2), std::nullopt);
+ EXPECT_EQ(checkedMul<int64_t>(Max, Max), std::nullopt);
+ EXPECT_EQ(checkedMul<int64_t>(Min, 2), std::nullopt);
EXPECT_EQ(checkedMul<int64_t>(10, 2), Optional<int64_t>(20));
}
TEST(CheckedArithmetic, CheckedMulAdd) {
const int64_t Max = std::numeric_limits<int64_t>::max();
const int64_t Min = std::numeric_limits<int64_t>::min();
- EXPECT_EQ(checkedMulAdd<int64_t>(Max, 1, 2), None);
- EXPECT_EQ(checkedMulAdd<int64_t>(1, 1, Max), None);
- EXPECT_EQ(checkedMulAdd<int64_t>(1, -1, Min), None);
+ EXPECT_EQ(checkedMulAdd<int64_t>(Max, 1, 2), std::nullopt);
+ EXPECT_EQ(checkedMulAdd<int64_t>(1, 1, Max), std::nullopt);
+ EXPECT_EQ(checkedMulAdd<int64_t>(1, -1, Min), std::nullopt);
EXPECT_EQ(checkedMulAdd<int64_t>(10, 2, 3), Optional<int64_t>(23));
}
TEST(CheckedArithmetic, CheckedMulSmall) {
const int16_t Max = std::numeric_limits<int16_t>::max();
const int16_t Min = std::numeric_limits<int16_t>::min();
- EXPECT_EQ(checkedMul<int16_t>(Max, 2), None);
- EXPECT_EQ(checkedMul<int16_t>(Max, Max), None);
- EXPECT_EQ(checkedMul<int16_t>(Min, 2), None);
+ EXPECT_EQ(checkedMul<int16_t>(Max, 2), std::nullopt);
+ EXPECT_EQ(checkedMul<int16_t>(Max, Max), std::nullopt);
+ EXPECT_EQ(checkedMul<int16_t>(Min, 2), std::nullopt);
EXPECT_EQ(checkedMul<int16_t>(10, 2), Optional<int16_t>(20));
}
TEST(CheckedArithmetic, CheckedMulAddSmall) {
const int16_t Max = std::numeric_limits<int16_t>::max();
const int16_t Min = std::numeric_limits<int16_t>::min();
- EXPECT_EQ(checkedMulAdd<int16_t>(Max, 1, 2), None);
- EXPECT_EQ(checkedMulAdd<int16_t>(1, 1, Max), None);
- EXPECT_EQ(checkedMulAdd<int16_t>(1, -1, Min), None);
+ EXPECT_EQ(checkedMulAdd<int16_t>(Max, 1, 2), std::nullopt);
+ EXPECT_EQ(checkedMulAdd<int16_t>(1, 1, Max), std::nullopt);
+ EXPECT_EQ(checkedMulAdd<int16_t>(1, -1, Min), std::nullopt);
EXPECT_EQ(checkedMulAdd<int16_t>(10, 2, 3), Optional<int16_t>(23));
}
TEST(CheckedArithmetic, CheckedAddUnsigned) {
const uint64_t Max = std::numeric_limits<uint64_t>::max();
- EXPECT_EQ(checkedAddUnsigned<uint64_t>(Max, Max), None);
- EXPECT_EQ(checkedAddUnsigned<uint64_t>(Max, 1), None);
+ EXPECT_EQ(checkedAddUnsigned<uint64_t>(Max, Max), std::nullopt);
+ EXPECT_EQ(checkedAddUnsigned<uint64_t>(Max, 1), std::nullopt);
EXPECT_EQ(checkedAddUnsigned<uint64_t>(10, 1), Optional<uint64_t>(11));
}
TEST(CheckedArithmetic, CheckedMulUnsigned) {
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, Max), llvm::None);
+ EXPECT_EQ(checkedMulUnsigned<uint64_t>(Max, 2), std::nullopt);
+ EXPECT_EQ(checkedMulUnsigned<uint64_t>(Max, Max), std::nullopt);
EXPECT_EQ(checkedMulUnsigned<uint64_t>(10, 2), Optional<uint64_t>(20));
}
TEST(CheckedArithmetic, CheckedMulAddUnsigned) {
const uint64_t Max = std::numeric_limits<uint64_t>::max();
- EXPECT_EQ(checkedMulAddUnsigned<uint64_t>(Max, 1, 2), None);
- EXPECT_EQ(checkedMulAddUnsigned<uint64_t>(1, 1, Max), None);
+ EXPECT_EQ(checkedMulAddUnsigned<uint64_t>(Max, 1, 2), std::nullopt);
+ EXPECT_EQ(checkedMulAddUnsigned<uint64_t>(1, 1, Max), std::nullopt);
EXPECT_EQ(checkedMulAddUnsigned<uint64_t>(10, 2, 3), Optional<uint64_t>(23));
}
TEST(ConvertUTFTest, Empty) {
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(Result.empty());
}
HasBOM = hasUTF16ByteOrderMark(makeArrayRef("\xfe\xff\x00asdf", 6));
EXPECT_TRUE(HasBOM);
- HasBOM = hasUTF16ByteOrderMark(None);
+ HasBOM = hasUTF16ByteOrderMark(std::nullopt);
EXPECT_FALSE(HasBOM);
HasBOM = hasUTF16ByteOrderMark(makeArrayRef("\xfe", 1));
EXPECT_FALSE(HasBOM);
// Failure with no prior value.
EXPECT_THAT_ERROR(makeFailure().moveInto(V), Failed());
- EXPECT_EQ(None, V.Box);
+ EXPECT_EQ(std::nullopt, V.Box);
// Success with no prior value.
EXPECT_THAT_ERROR(make(5).moveInto(V), Succeeded());
// Same cases as above.
Optional<MoveOnlyBox> MaybeV;
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_EQ(MoveOnlyBox(5), MaybeV);
StringRef OutputPath = OutputFile.str();
const std::optional<StringRef> Redirects[] = {
- /*STDIN=*/None, /*STDOUT=*/OutputPath, /*STDERR=*/None};
- int RetCode = ExecuteAndWait(ExePath, argv, /*env=*/llvm::None, Redirects);
+ /*STDIN=*/std::nullopt, /*STDOUT=*/OutputPath, /*STDERR=*/std::nullopt};
+ int RetCode =
+ ExecuteAndWait(ExePath, argv, /*env=*/std::nullopt, Redirects);
ASSERT_EQ(0, RetCode);
int FD = 0;
// Test value extraction
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::max(VThree, VSix), 6);
EXPECT_EQ("null", s(llvm::Optional<double>()));
EXPECT_EQ("2.5", s(llvm::Optional<double>(2.5)));
EXPECT_EQ("[[2.5,null]]", s(std::vector<std::vector<llvm::Optional<double>>>{
- {2.5, llvm::None}}));
+ {2.5, std::nullopt}}));
}
TEST(JSONTest, StringOwnership) {
llvm::Optional<int64_t> AsInt;
llvm::Optional<double> AsNumber;
} TestCases[] = {
- {
- "Non-integer. Stored as double, not convertible.",
- double{1.5},
- "1.5",
- llvm::None,
- 1.5,
- },
+ {
+ "Non-integer. Stored as double, not convertible.",
+ double{1.5},
+ "1.5",
+ std::nullopt,
+ 1.5,
+ },
- {
- "Integer, not exact double. Stored as int64, convertible.",
- int64_t{0x4000000000000001},
- "4611686018427387905",
- int64_t{0x4000000000000001},
- double{0x4000000000000000},
- },
+ {
+ "Integer, not exact double. Stored as int64, convertible.",
+ int64_t{0x4000000000000001},
+ "4611686018427387905",
+ int64_t{0x4000000000000001},
+ double{0x4000000000000000},
+ },
- {
- "Negative integer, not exact double. Stored as int64, convertible.",
- int64_t{-0x4000000000000001},
- "-4611686018427387905",
- int64_t{-0x4000000000000001},
- double{-0x4000000000000000},
- },
+ {
+ "Negative integer, not exact double. Stored as int64, convertible.",
+ int64_t{-0x4000000000000001},
+ "-4611686018427387905",
+ int64_t{-0x4000000000000001},
+ double{-0x4000000000000000},
+ },
// PR46470,
// https://developercommunity.visualstudio.com/content/problem/1093399/incorrect-result-when-printing-6917529027641081856.html
#if !defined(_MSC_VER) || _MSC_VER < 1926
- {
- "Dynamically exact integer. Stored as double, convertible.",
- double{0x6000000000000000},
- "6.9175290276410819e+18",
- int64_t{0x6000000000000000},
- double{0x6000000000000000},
- },
+ {
+ "Dynamically exact integer. Stored as double, convertible.",
+ double{0x6000000000000000},
+ "6.9175290276410819e+18",
+ int64_t{0x6000000000000000},
+ double{0x6000000000000000},
+ },
#endif
- {
- "Dynamically integer, >64 bits. Stored as double, not convertible.",
- 1.5 * double{0x8000000000000000},
- "1.3835058055282164e+19",
- llvm::None,
- 1.5 * double{0x8000000000000000},
- },
+ {
+ "Dynamically integer, >64 bits. Stored as double, not convertible.",
+ 1.5 * double{0x8000000000000000},
+ "1.3835058055282164e+19",
+ std::nullopt,
+ 1.5 * double{0x8000000000000000},
+ },
};
for (const auto &T : TestCases) {
EXPECT_EQ(T.Str, s(T.Val)) << T.Desc;
EXPECT_TRUE(!!Doc);
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.
llvm::Expected<Value> Doc = parse(Str);
EXPECT_TRUE(!!Doc);
- EXPECT_EQ(Doc->getAsInteger(), None);
+ EXPECT_EQ(Doc->getAsInteger(), std::nullopt);
EXPECT_EQ(Doc->getAsUINT64(), uint64_t{18446744073709551615u});
}
llvm::Expected<Value> Doc = parse(Str);
EXPECT_TRUE(!!Doc);
- EXPECT_EQ(Doc->getAsInteger(), None);
- EXPECT_EQ(Doc->getAsUINT64(), None);
+ EXPECT_EQ(Doc->getAsInteger(), std::nullopt);
+ EXPECT_EQ(Doc->getAsUINT64(), std::nullopt);
// The number was parsed as a double.
EXPECT_TRUE(!!Doc->getAsNumber());
}
llvm::Expected<Value> Doc = parse(Str);
EXPECT_TRUE(!!Doc);
- EXPECT_EQ(Doc->getAsInteger(), None);
- EXPECT_EQ(Doc->getAsUINT64(), None);
+ EXPECT_EQ(Doc->getAsInteger(), std::nullopt);
+ EXPECT_EQ(Doc->getAsUINT64(), std::nullopt);
// The number was parsed as a double.
EXPECT_TRUE(!!Doc->getAsNumber());
}
}}};
Expected["foo"] = {
CustomStruct("foo", 42, true),
- CustomStruct("bar", llvm::None, false),
+ CustomStruct("bar", std::nullopt, false),
};
Path::Root Root("CustomStruct");
ASSERT_TRUE(fromJSON(J, R, Root));
namespace {
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(AllOf(Lt(11), Gt(9))));
}
}
std::string format_number(uint64_t N, HexPrintStyle Style,
- Optional<size_t> Width = None) {
+ Optional<size_t> Width = std::nullopt) {
std::string S;
llvm::raw_string_ostream Str(S);
write_hex(Str, N, Style, Width);
}
std::string format_number(double D, FloatStyle Style,
- Optional<size_t> Precision = None) {
+ Optional<size_t> Precision = std::nullopt) {
std::string S;
llvm::raw_string_ostream Str(S);
write_double(Str, D, Style, Precision);
static_cast<SmallVectorImpl<char> *>(&StaysSmall),
};
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(fs::DefaultReadChunkSize + Content.size(), StaysSmall.capacity());
constexpr StringLiteral Prefix = "prefix-";
for (SmallVectorImpl<char> *V : Vectors) {
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()));
}
}
#else
StringRef nul("/dev/null");
#endif
- std::optional<StringRef> redirects[] = {nul, nul, None};
+ std::optional<StringRef> redirects[] = {nul, nul, std::nullopt};
int rc = ExecuteAndWait(my_exe, argv, getEnviron(), redirects,
/*secondsToWait=*/ 10, /*memoryLimit=*/ 0, &error,
&ExecutionFailed);
{
std::string Error;
bool ExecutionFailed;
- int RetCode = ExecuteAndWait(Executable, argv, llvm::None, {}, 0, 0, &Error,
- &ExecutionFailed);
+ int RetCode = ExecuteAndWait(Executable, argv, std::nullopt, {}, 0, 0,
+ &Error, &ExecutionFailed);
ASSERT_LT(RetCode, 0) << "On error ExecuteAndWait should return 0 or "
"positive value indicating the result code";
ASSERT_TRUE(ExecutionFailed);
{
std::string Error;
bool ExecutionFailed;
- ProcessInfo PI = ExecuteNoWait(Executable, argv, llvm::None, {}, 0, &Error,
- &ExecutionFailed);
+ ProcessInfo PI = ExecuteNoWait(Executable, argv, std::nullopt, {}, 0,
+ &Error, &ExecutionFailed);
ASSERT_EQ(PI.Pid, ProcessInfo::InvalidPid)
<< "On error ExecuteNoWait should return an invalid ProcessInfo";
ASSERT_TRUE(ExecutionFailed);
TEST_F(SourceMgrTest, BasicError) {
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"
"aaa bbb\n"
TEST_F(SourceMgrTest, BasicWarning) {
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"
"aaa bbb\n"
TEST_F(SourceMgrTest, BasicRemark) {
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"
"aaa bbb\n"
TEST_F(SourceMgrTest, BasicNote) {
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"
"aaa bbb\n"
TEST_F(SourceMgrTest, LocationAtEndOfLine) {
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"
"aaa bbb\n"
TEST_F(SourceMgrTest, LocationAtNewline) {
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"
"aaa bbb\n"
TEST_F(SourceMgrTest, LocationAtEmptyBuffer) {
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"
"\n"
TEST_F(SourceMgrTest, LocationJustOnSoleNewline) {
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"
"\n"
TEST_F(SourceMgrTest, LocationJustAfterSoleNewline) {
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"
"\n"
TEST_F(SourceMgrTest, LocationJustAfterNonNewline) {
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"
"123\n"
TEST_F(SourceMgrTest, LocationOnFirstLineOfMultiline) {
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"
"1234\n"
TEST_F(SourceMgrTest, LocationOnEOLOfFirstLineOfMultiline) {
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"
"1234\n"
TEST_F(SourceMgrTest, LocationOnSecondLineOfMultiline) {
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"
"6789\n"
TEST_F(SourceMgrTest, LocationOnSecondLineOfMultilineNoSecondEOL) {
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"
"6789\n"
TEST_F(SourceMgrTest, LocationOnEOLOfSecondSecondLineOfMultiline) {
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"
"6789\n"
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
"12" // + 2 = 255 bytes
, "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"
"12\n"
"^\n",
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
"12" // + 2 = 255 bytes
, "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"
"12\n"
" ^\n",
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
"12" // + 2 = 255 bytes
, "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"
"12\n"
" ^\n",
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
"1\n" // + 2 = 255 bytes
, "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"
"1\n"
"^\n",
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
"1\n" // + 2 = 255 bytes
, "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"
"1\n"
" ^\n",
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
"1\n" // + 2 = 255 bytes
, "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"
"\n"
"^\n",
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
"123" // + 3 = 256 bytes
, "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"
"123\n"
" ^\n",
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
"123" // + 3 = 256 bytes
, "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"
"123\n"
" ^\n",
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
"123" // + 3 = 256 bytes
, "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"
"123\n"
" ^\n",
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
"12\n" // + 3 = 256 bytes
, "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"
"12\n"
" ^\n",
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
"12\n" // + 3 = 256 bytes
, "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"
"12\n"
" ^\n",
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
"12\n" // + 3 = 256 bytes
, "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"
"\n"
"^\n",
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
"1234" // + 4 = 257 bytes
, "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"
"1234\n"
" ^\n",
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
"1234" // + 4 = 257 bytes
, "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"
"1234\n"
" ^\n",
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
"1234" // + 4 = 257 bytes
, "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"
"1234\n"
" ^\n",
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
"123\n" // + 4 = 257 bytes
, "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"
"123\n"
" ^\n",
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
"123\n" // + 4 = 257 bytes
, "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"
"123\n"
" ^\n",
setMainBuffer(STRING_LITERAL_253_BYTES // first 253 bytes
"123\n" // + 4 = 257 bytes
, "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"
"\n"
"^\n",
TEST_F(SourceMgrTest, BasicRange) {
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"
"aaa bbb\n"
TEST_F(SourceMgrTest, RangeWithTab) {
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"
"aaa bbb\n"
TEST_F(SourceMgrTest, MultiLineRange) {
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"
"aaa bbb\n"
TEST_F(SourceMgrTest, MultipleRanges) {
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
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"
"aaa bbb\n"
TEST_F(SourceMgrTest, OverlappingRanges) {
setMainBuffer("aaa bbb\nccc ddd\n", "file.in");
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"
"aaa bbb\n"
TEST_F(SourceMgrTest, BasicFixit) {
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")));
EXPECT_EQ("file.in:1:5: error: message\n"
TEST_F(SourceMgrTest, FixitForTab) {
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")));
EXPECT_EQ("file.in:1:4: error: message\n"
}
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");
ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
ASSERT_TRUE(Stat->isDirectory());
}
TEST_F(InMemoryFileSystemTest, AddFileWithFileType) {
- FS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"), None, None,
- sys::fs::file_type::socket_file);
+ FS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"), std::nullopt,
+ std::nullopt, sys::fs::file_type::socket_file);
auto Stat = FS.status("/a");
ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
ASSERT_TRUE(Stat->isDirectory());
}
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);
auto Stat = FS.status("/a");
ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
}
TEST_F(InMemoryFileSystemTest, AddDirectoryThenAddChild) {
- FS.addFile("/a", 0, MemoryBuffer::getMemBuffer(""), /*User=*/None,
- /*Group=*/None, sys::fs::file_type::directory_file);
- FS.addFile("/a/b", 0, MemoryBuffer::getMemBuffer("abc"), /*User=*/None,
- /*Group=*/None, sys::fs::file_type::regular_file);
+ FS.addFile("/a", 0, MemoryBuffer::getMemBuffer(""), /*User=*/std::nullopt,
+ /*Group=*/std::nullopt, sys::fs::file_type::directory_file);
+ FS.addFile("/a/b", 0, MemoryBuffer::getMemBuffer("abc"),
+ /*User=*/std::nullopt,
+ /*Group=*/std::nullopt, sys::fs::file_type::regular_file);
auto Stat = FS.status("/a");
ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
ASSERT_TRUE(Stat->isDirectory());
// was requested (to match the behavior of RealFileSystem).
TEST_F(InMemoryFileSystemTest, StatusName) {
NormalizedFS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"),
- /*User=*/None,
- /*Group=*/None, sys::fs::file_type::regular_file);
+ /*User=*/std::nullopt,
+ /*Group=*/std::nullopt,
+ sys::fs::file_type::regular_file);
NormalizedFS.setCurrentWorkingDirectory("/a/b");
// Access using InMemoryFileSystem::status.
printToString(format_decimal(INT64_MIN, 21), 21));
}
-static std::string formatted_bytes_str(ArrayRef<uint8_t> Bytes,
- llvm::Optional<uint64_t> Offset = None,
- uint32_t NumPerLine = 16,
- uint8_t ByteGroupSize = 4) {
+static std::string
+formatted_bytes_str(ArrayRef<uint8_t> Bytes,
+ llvm::Optional<uint64_t> Offset = std::nullopt,
+ uint32_t NumPerLine = 16, uint8_t ByteGroupSize = 4) {
std::string S;
raw_string_ostream Str(S);
Str << format_bytes(Bytes, Offset, NumPerLine, ByteGroupSize);
return S;
}
-static std::string format_bytes_with_ascii_str(ArrayRef<uint8_t> Bytes,
- Optional<uint64_t> Offset = None,
- uint32_t NumPerLine = 16,
- uint8_t ByteGroupSize = 4) {
+static std::string format_bytes_with_ascii_str(
+ ArrayRef<uint8_t> Bytes, Optional<uint64_t> Offset = std::nullopt,
+ uint32_t NumPerLine = 16, uint8_t ByteGroupSize = 4) {
std::string S;
raw_string_ostream Str(S);
Str << format_bytes_with_ascii(Bytes, Offset, NumPerLine, ByteGroupSize);
formatted_bytes_str(B.take_front(17)));
// Test raw bytes with 1 bytes per line wrapping.
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.
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.
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
//----------------------------------------------------------------------
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.
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.
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.
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.
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
//----------------------------------------------------------------------
- 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.
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.
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.
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.
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.
format_bytes_with_ascii_str(B.take_front(16)));
EXPECT_EQ("61626364 65666768 |abcdefgh|\n"
"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|",
- 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'};
// 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
std::string Error;
const Target *TheTarget = TargetRegistry::lookupTarget(TT, Error);
- return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine*>(
- TheTarget->createTargetMachine(TT, CPU, FS, TargetOptions(), None, None,
- CodeGenOpt::Default)));
+ return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+ TheTarget->createTargetMachine(TT, CPU, FS, TargetOptions(), std::nullopt,
+ std::nullopt, CodeGenOpt::Default)));
}
std::unique_ptr<AArch64InstrInfo> createInstrInfo(TargetMachine *TM) {
std::string Error;
const Target *TheTarget = TargetRegistry::lookupTarget(TT, Error);
- return std::unique_ptr<LLVMTargetMachine>(
- static_cast<LLVMTargetMachine *>(TheTarget->createTargetMachine(
- TT, CPU, FS, TargetOptions(), None, None, CodeGenOpt::Default)));
+ return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+ TheTarget->createTargetMachine(TT, CPU, FS, TargetOptions(), std::nullopt,
+ std::nullopt, CodeGenOpt::Default)));
}
std::unique_ptr<AArch64InstrInfo> createInstrInfo(TargetMachine *TM) {
return nullptr;
TargetOptions Options;
- return std::unique_ptr<GCNTargetMachine>(static_cast<GCNTargetMachine *>(
- T->createTargetMachine(TStr, CPU, FS, Options, None, None)));
+ return std::unique_ptr<GCNTargetMachine>(
+ static_cast<GCNTargetMachine *>(T->createTargetMachine(
+ TStr, CPU, FS, Options, std::nullopt, std::nullopt)));
}
TEST(AMDGPUDwarfRegMappingTests, TestWave64DwarfRegMapping) {
}
TargetOptions Options;
- auto TM = std::unique_ptr<LLVMTargetMachine>(
- static_cast<LLVMTargetMachine *>(T->createTargetMachine(
- TT, "generic", "", Options, None, None, CodeGenOpt::Default)));
+ auto TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+ T->createTargetMachine(TT, "generic", "", Options, std::nullopt,
+ std::nullopt, CodeGenOpt::Default)));
ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
std::string(TM->getTargetFeatureString()),
*static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
}
TargetOptions Options;
- auto TM = std::unique_ptr<LLVMTargetMachine>(
- static_cast<LLVMTargetMachine*>(
- T->createTargetMachine(TT, "generic", "", Options, None, None,
- CodeGenOpt::Default)));
+ auto TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+ T->createTargetMachine(TT, "generic", "", Options, std::nullopt,
+ std::nullopt, CodeGenOpt::Default)));
ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
std::string(TM->getTargetFeatureString()),
*static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
}
TargetOptions Options;
- auto TM = std::unique_ptr<LLVMTargetMachine>(
- static_cast<LLVMTargetMachine*>(
- T->createTargetMachine(TT, "generic", "", Options, None, None,
- CodeGenOpt::Default)));
+ auto TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+ T->createTargetMachine(TT, "generic", "", Options, std::nullopt,
+ std::nullopt, CodeGenOpt::Default)));
ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
std::string(TM->getTargetFeatureString()),
*static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
}
TargetOptions Options;
- auto TM = std::unique_ptr<LLVMTargetMachine>(
- static_cast<LLVMTargetMachine*>(
- T->createTargetMachine(TT, "generic", "", Options, None, None,
- CodeGenOpt::Default)));
+ auto TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+ T->createTargetMachine(TT, "generic", "", Options, std::nullopt,
+ std::nullopt, CodeGenOpt::Default)));
ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
std::string(TM->getTargetFeatureString()),
*static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
}
TargetOptions Options;
- auto TM = std::unique_ptr<LLVMTargetMachine>(
- static_cast<LLVMTargetMachine*>(
- T->createTargetMachine(TT, "generic", "", Options, None, None,
- CodeGenOpt::Default)));
+ auto TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+ T->createTargetMachine(TT, "generic", "", Options, std::nullopt,
+ std::nullopt, CodeGenOpt::Default)));
ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
std::string(TM->getTargetFeatureString()),
*static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
}
TargetOptions Options;
- auto TM = std::unique_ptr<LLVMTargetMachine>(
- static_cast<LLVMTargetMachine *>(T->createTargetMachine(
- TT, "generic", "", Options, None, None, CodeGenOpt::Default)));
+ auto TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+ T->createTargetMachine(TT, "generic", "", Options, std::nullopt,
+ std::nullopt, CodeGenOpt::Default)));
ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
std::string(TM->getTargetFeatureString()),
*static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
}
TargetOptions Options;
- auto TM = std::unique_ptr<LLVMTargetMachine>(
- static_cast<LLVMTargetMachine*>(
- T->createTargetMachine(TT, "generic", "", Options, None, None,
- CodeGenOpt::Default)));
+ auto TM = std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+ T->createTargetMachine(TT, "generic", "", Options, std::nullopt,
+ std::nullopt, CodeGenOpt::Default)));
ARMSubtarget ST(TM->getTargetTriple(), std::string(TM->getTargetCPU()),
std::string(TM->getTargetFeatureString()),
*static_cast<const ARMBaseTargetMachine *>(TM.get()), false);
// relocation model unset.
std::unique_ptr<TargetMachine> Target(TheTarget->createTargetMachine(
/*TT*/ TheTriple.getTriple(), /*CPU*/ "", /*Features*/ "",
- /*Options*/ Options, /*RM*/ None, /*CM*/ None,
+ /*Options*/ Options, /*RM*/ std::nullopt, /*CM*/ std::nullopt,
/*OL*/ CodeGenOpt::Default));
ASSERT_TRUE(Target) << "Could not allocate target machine!";
const Target *TheTarget = TargetRegistry::lookupTarget(TT, Error);
assert(TheTarget);
- return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine*>(
- TheTarget->createTargetMachine(TT, CPU, FS, TargetOptions(), None, None,
- CodeGenOpt::Default)));
+ return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+ TheTarget->createTargetMachine(TT, CPU, FS, TargetOptions(), std::nullopt,
+ std::nullopt, CodeGenOpt::Default)));
}
std::unique_ptr<Module> parseMIR(LLVMContext &Context,
auto TT(Triple::normalize("x86_64--"));
std::string Error;
const Target *TheTarget = TargetRegistry::lookupTarget(TT, Error);
- return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine*>(
- TheTarget->createTargetMachine(TT, "", "", TargetOptions(), None, None,
- CodeGenOpt::Default)));
+ return std::unique_ptr<LLVMTargetMachine>(static_cast<LLVMTargetMachine *>(
+ TheTarget->createTargetMachine(TT, "", "", TargetOptions(), std::nullopt,
+ std::nullopt, CodeGenOpt::Default)));
}
class MachineSizeOptsTest : public testing::Test {
ASSERT_EQ(Path, Dir2->path());
ASSERT_TRUE(sys::fs::exists(Path));
- Dir1 = None;
+ Dir1 = std::nullopt;
ASSERT_TRUE(sys::fs::exists(Path));
- Dir2 = None;
+ Dir2 = std::nullopt;
ASSERT_FALSE(sys::fs::exists(Path));
}
ASSERT_EQ(Path, File2->path());
ASSERT_TRUE(sys::fs::exists(Path));
- File1 = None;
+ File1 = std::nullopt;
ASSERT_TRUE(sys::fs::exists(Path));
- File2 = None;
+ File2 = std::nullopt;
ASSERT_FALSE(sys::fs::exists(Path));
}
ASSERT_EQ(Path, Link2->path());
ASSERT_TRUE(sys::fs::exists(Path));
- Link1 = None;
+ Link1 = std::nullopt;
ASSERT_TRUE(sys::fs::exists(Path));
- Link2 = None;
+ Link2 = std::nullopt;
ASSERT_FALSE(sys::fs::exists(Path));
}
// Function DI
auto *File = DBuilder.createFile("filename.c", "/file/dir/");
- DITypeRefArray ParamTypes = DBuilder.getOrCreateTypeArray(None);
+ DITypeRefArray ParamTypes = DBuilder.getOrCreateTypeArray(std::nullopt);
DISubroutineType *FuncType =
DBuilder.createSubroutineType(ParamTypes);
auto *CU = DBuilder.createCompileUnit(dwarf::DW_LANG_C99,
// Create debug info
auto *File = DBuilder.createFile("filename.c", "/file/dir/");
- DITypeRefArray ParamTypes = DBuilder.getOrCreateTypeArray(None);
+ DITypeRefArray ParamTypes = DBuilder.getOrCreateTypeArray(std::nullopt);
DISubroutineType *DFuncType = DBuilder.createSubroutineType(ParamTypes);
auto *CU = DBuilder.createCompileUnit(dwarf::DW_LANG_C99,
DBuilder.createFile("filename.c",
TEST(ValueMapperTest, mapMDNode) {
LLVMContext Context;
- auto *U = MDTuple::get(Context, None);
+ auto *U = MDTuple::get(Context, std::nullopt);
// The node should be unchanged.
ValueToValueMapTy VM;
TEST(ValueMapperTest, mapMDNodeUnresolved) {
LLVMContext Context;
- TempMDTuple T = MDTuple::getTemporary(Context, None);
+ TempMDTuple T = MDTuple::getTemporary(Context, std::nullopt);
ValueToValueMapTy VM;
EXPECT_EQ(T.get(), ValueMapper(VM, RF_NoModuleLevelChanges).mapMDNode(*T));
TEST(ValueMapperTest, mapMDNodeDistinct) {
LLVMContext Context;
- auto *D = MDTuple::getDistinct(Context, None);
+ auto *D = MDTuple::getDistinct(Context, std::nullopt);
{
// The node should be cloned.
TEST(ValueMapperTest, mapMDNodeDistinctOperands) {
LLVMContext Context;
- Metadata *Old = MDTuple::getDistinct(Context, None);
+ Metadata *Old = MDTuple::getDistinct(Context, std::nullopt);
auto *D = MDTuple::getDistinct(Context, Old);
ASSERT_EQ(Old, D->getOperand(0));
- Metadata *New = MDTuple::getDistinct(Context, None);
+ Metadata *New = MDTuple::getDistinct(Context, std::nullopt);
ValueToValueMapTy VM;
VM.MD()[Old].reset(New);
TEST(ValueMapperTest, mapMDNodeSeeded) {
LLVMContext Context;
- auto *D = MDTuple::getDistinct(Context, None);
+ auto *D = MDTuple::getDistinct(Context, std::nullopt);
// The node should be moved.
ValueToValueMapTy VM;
- EXPECT_EQ(None, VM.getMappedMD(D));
+ EXPECT_EQ(std::nullopt, VM.getMappedMD(D));
VM.MD().insert(std::make_pair(D, TrackingMDRef(D)));
EXPECT_EQ(D, *VM.getMappedMD(D));
TEST(ValueMapperTest, mapMDNodeSeededWithNull) {
LLVMContext Context;
- auto *D = MDTuple::getDistinct(Context, None);
+ auto *D = MDTuple::getDistinct(Context, std::nullopt);
// The node should be moved.
ValueToValueMapTy VM;
- EXPECT_EQ(None, VM.getMappedMD(D));
+ EXPECT_EQ(std::nullopt, VM.getMappedMD(D));
VM.MD().insert(std::make_pair(D, TrackingMDRef()));
EXPECT_EQ(nullptr, *VM.getMappedMD(D));
// Make sure S1 maps to itself, but isn't memoized.
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.
auto *S2 = MDString::get(C, "S2");
TEST(ValueMapperTest, mapMetadataGetMappedMD) {
LLVMContext C;
- auto *N0 = MDTuple::get(C, None);
+ auto *N0 = MDTuple::get(C, std::nullopt);
auto *N1 = MDTuple::get(C, N0);
// Make sure hasMD and getMappedMD work correctly.
EXPECT_EQ(N0, ValueMapper(VM).mapMetadata(*N0));
EXPECT_EQ(N1, ValueMapper(VM).mapMetadata(*N1));
EXPECT_TRUE(VM.hasMD());
- ASSERT_NE(None, VM.getMappedMD(N0));
- ASSERT_NE(None, VM.getMappedMD(N1));
+ ASSERT_NE(std::nullopt, VM.getMappedMD(N0));
+ ASSERT_NE(std::nullopt, VM.getMappedMD(N1));
EXPECT_EQ(N0, *VM.getMappedMD(N0));
EXPECT_EQ(N1, *VM.getMappedMD(N1));
}
TEST(ValueMapperTest, mapMetadataNoModuleLevelChanges) {
LLVMContext C;
- auto *N0 = MDTuple::get(C, None);
+ auto *N0 = MDTuple::get(C, std::nullopt);
auto *N1 = MDTuple::get(C, N0);
// Nothing should be memoized when RF_NoModuleLevelChanges.
EXPECT_EQ(N0, ValueMapper(VM, RF_NoModuleLevelChanges).mapMetadata(*N0));
EXPECT_EQ(N1, ValueMapper(VM, RF_NoModuleLevelChanges).mapMetadata(*N1));
EXPECT_FALSE(VM.hasMD());
- EXPECT_EQ(None, VM.getMappedMD(N0));
- EXPECT_EQ(None, VM.getMappedMD(N1));
+ EXPECT_EQ(std::nullopt, VM.getMappedMD(N0));
+ EXPECT_EQ(std::nullopt, VM.getMappedMD(N1));
}
TEST(ValueMapperTest, mapMetadataConstantAsMetadata) {
EXPECT_FALSE(VM.MD().count(CAM));
// 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);
EXPECT_EQ(N, ValueMapper(VM).mapMetadata(*CAM));
EXPECT_EQ(N, ValueMapper(VM, RF_IgnoreMissingLocals).mapMetadata(*CAM));
// property. To keep RemapInstruction from crashing we need a non-null
// return here, but we also shouldn't reference the unmapped local. Use
// "metadata !{}".
- auto *N0 = MDTuple::get(C, None);
+ auto *N0 = MDTuple::get(C, std::nullopt);
auto *N0AV = MetadataAsValue::get(C, N0);
ValueToValueMapTy VM;
EXPECT_EQ(N0AV, ValueMapper(VM).mapValue(*MAV));
EXPECT_EQ(nullptr, ValueMapper(VM, RF_IgnoreMissingLocals).mapValue(*MAV));
EXPECT_FALSE(VM.count(MAV));
EXPECT_FALSE(VM.count(&A));
- EXPECT_EQ(None, VM.getMappedMD(LAM));
+ EXPECT_EQ(std::nullopt, VM.getMappedMD(LAM));
VM[MAV] = MAV;
EXPECT_EQ(MAV, ValueMapper(VM).mapValue(*MAV));
EXPECT_EQ(MAV, ValueMapper(VM, RF_IgnoreMissingLocals).mapValue(*MAV));
EXPECT_FALSE(VM.count(MAV));
EXPECT_FALSE(VM.count(&A));
- EXPECT_EQ(None, VM.getMappedMD(LAM));
- EXPECT_EQ(None, VM.getMappedMD(ArgList));
+ EXPECT_EQ(std::nullopt, VM.getMappedMD(LAM));
+ EXPECT_EQ(std::nullopt, VM.getMappedMD(ArgList));
VM[MAV] = MAV;
EXPECT_EQ(MAV, ValueMapper(VM).mapValue(*MAV));
/// `llvm-mca` tool to verify result correctness.
/// This function only displays on SummaryView by default.
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);
};