aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2022-12-20 15:42:32 -0800
committerKazu Hirata <kazu@google.com>2022-12-20 15:42:32 -0800
commit77c90c8ce0fe763b6ee2809a6dc437d6f18e1af2 (patch)
tree15a121e20136c30cacf9258d23b34d61c46a79bd /llvm/unittests
parent0b401ba71325c06a61f948c801685de021455b13 (diff)
downloadllvm-77c90c8ce0fe763b6ee2809a6dc437d6f18e1af2.zip
llvm-77c90c8ce0fe763b6ee2809a6dc437d6f18e1af2.tar.gz
llvm-77c90c8ce0fe763b6ee2809a6dc437d6f18e1af2.tar.bz2
[llvm] Use std::optional instead of Optional
This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Diffstat (limited to 'llvm/unittests')
-rw-r--r--llvm/unittests/ADT/STLForwardCompatTest.cpp14
-rw-r--r--llvm/unittests/DebugInfo/DWARF/DWARFDebugFrameTest.cpp2
-rw-r--r--llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp4
-rw-r--r--llvm/unittests/DebugInfo/DWARF/DwarfGenerator.h2
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp2
-rw-r--r--llvm/unittests/IR/CFGBuilder.cpp4
-rw-r--r--llvm/unittests/IR/CFGBuilder.h4
-rw-r--r--llvm/unittests/IR/ConstantRangeTest.cpp54
-rw-r--r--llvm/unittests/IR/DominatorTreeTest.cpp20
-rw-r--r--llvm/unittests/IR/VPIntrinsicTest.cpp4
-rw-r--r--llvm/unittests/Remarks/YAMLRemarksSerializerTest.cpp8
-rw-r--r--llvm/unittests/Support/TypeTraitsTest.cpp2
-rw-r--r--llvm/unittests/Testing/Support/TempPathTest.cpp6
13 files changed, 60 insertions, 66 deletions
diff --git a/llvm/unittests/ADT/STLForwardCompatTest.cpp b/llvm/unittests/ADT/STLForwardCompatTest.cpp
index a024012..e9cd88c 100644
--- a/llvm/unittests/ADT/STLForwardCompatTest.cpp
+++ b/llvm/unittests/ADT/STLForwardCompatTest.cpp
@@ -82,13 +82,15 @@ TEST(TransformTest, MoveTransformStd) {
}
TEST(TransformTest, TransformLlvm) {
- llvm::Optional<int> A;
+ std::optional<int> A;
- llvm::Optional<int> B = llvm::transformOptional(A, [&](int N) { return N + 1; });
+ std::optional<int> B =
+ llvm::transformOptional(A, [&](int N) { return N + 1; });
EXPECT_FALSE(B.has_value());
A = 3;
- llvm::Optional<int> C = llvm::transformOptional(A, [&](int N) { return N + 1; });
+ std::optional<int> C =
+ llvm::transformOptional(A, [&](int N) { return N + 1; });
EXPECT_TRUE(C.has_value());
EXPECT_EQ(4, *C);
}
@@ -96,10 +98,10 @@ TEST(TransformTest, TransformLlvm) {
TEST(TransformTest, MoveTransformLlvm) {
using llvm::MoveOnly;
- llvm::Optional<MoveOnly> A;
+ std::optional<MoveOnly> A;
MoveOnly::ResetCounts();
- llvm::Optional<int> B = llvm::transformOptional(
+ std::optional<int> B = llvm::transformOptional(
std::move(A), [&](const MoveOnly &M) { return M.val + 2; });
EXPECT_FALSE(B.has_value());
EXPECT_EQ(0u, MoveOnly::MoveConstructions);
@@ -108,7 +110,7 @@ TEST(TransformTest, MoveTransformLlvm) {
A = MoveOnly(5);
MoveOnly::ResetCounts();
- llvm::Optional<int> C = llvm::transformOptional(
+ std::optional<int> C = llvm::transformOptional(
std::move(A), [&](const MoveOnly &M) { return M.val + 2; });
EXPECT_TRUE(C.has_value());
EXPECT_EQ(7, *C);
diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugFrameTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugFrameTest.cpp
index d061381..ebfba7c 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugFrameTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugFrameTest.cpp
@@ -128,7 +128,7 @@ TEST(DWARFDebugFrame, DumpEH64FDE) {
}
static Error parseCFI(dwarf::CIE &C, ArrayRef<uint8_t> Instructions,
- Optional<uint64_t> Size = std::nullopt) {
+ std::optional<uint64_t> Size = std::nullopt) {
DWARFDataExtractor Data(Instructions, /*IsLittleEndian=*/true,
/*AddressSize=*/8);
uint64_t Offset = 0;
diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp
index d14b303..2129915 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp
@@ -147,8 +147,8 @@ SmallString<0> DWARFExpressionCopyBytesTest::emitObjFile(StringRef ExprBytes) {
void DWARFExpressionCopyBytesTest::parseCFIsAndCheckExpression(
const llvm::object::ObjectFile &E, ArrayRef<uint8_t> Expected) {
- auto FetchFirstCfaExpression =
- [](const DWARFDebugFrame &EHFrame) -> Optional<CFIProgram::Instruction> {
+ auto FetchFirstCfaExpression = [](const DWARFDebugFrame &EHFrame)
+ -> std::optional<CFIProgram::Instruction> {
for (const dwarf::FrameEntry &Entry : EHFrame.entries()) {
const auto *CurFDE = dyn_cast<dwarf::FDE>(&Entry);
if (!CurFDE)
diff --git a/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.h b/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.h
index e55dc07..4d97059b 100644
--- a/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.h
+++ b/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.h
@@ -220,7 +220,7 @@ private:
// Calculate the number of bytes the Contents will take up.
size_t getContentsSize() const;
- llvm::Optional<DWARFDebugLine::Prologue> Prologue;
+ std::optional<DWARFDebugLine::Prologue> Prologue;
std::vector<ValueAndLength> CustomPrologue;
std::vector<ValueAndLength> Contents;
diff --git a/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
index 3cd0504..d094bd3 100644
--- a/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
@@ -99,7 +99,7 @@ TEST_F(CoreAPIsStandardTest, MaterializationSideEffctsOnlyBasic) {
// results.
std::unique_ptr<MaterializationResponsibility> FooR;
- Optional<SymbolMap> Result;
+ std::optional<SymbolMap> Result;
cantFail(JD.define(std::make_unique<SimpleMaterializationUnit>(
SymbolFlagsMap(
diff --git a/llvm/unittests/IR/CFGBuilder.cpp b/llvm/unittests/IR/CFGBuilder.cpp
index fb05a9d..6a4e0874 100644
--- a/llvm/unittests/IR/CFGBuilder.cpp
+++ b/llvm/unittests/IR/CFGBuilder.cpp
@@ -126,13 +126,13 @@ void CFGBuilder::buildCFG(const std::vector<Arc> &NewArcs) {
}
}
-Optional<CFGBuilder::Update> CFGBuilder::getNextUpdate() const {
+std::optional<CFGBuilder::Update> CFGBuilder::getNextUpdate() const {
if (UpdateIdx == Updates.size())
return std::nullopt;
return Updates[UpdateIdx];
}
-Optional<CFGBuilder::Update> CFGBuilder::applyUpdate() {
+std::optional<CFGBuilder::Update> CFGBuilder::applyUpdate() {
if (UpdateIdx == Updates.size())
return std::nullopt;
Update NextUpdate = Updates[UpdateIdx++];
diff --git a/llvm/unittests/IR/CFGBuilder.h b/llvm/unittests/IR/CFGBuilder.h
index 97be4a1..6fb03ee 100644
--- a/llvm/unittests/IR/CFGBuilder.h
+++ b/llvm/unittests/IR/CFGBuilder.h
@@ -72,8 +72,8 @@ public:
std::vector<Update> Updates);
BasicBlock *getOrAddBlock(StringRef BlockName);
- Optional<Update> getNextUpdate() const;
- Optional<Update> applyUpdate();
+ std::optional<Update> getNextUpdate() const;
+ std::optional<Update> applyUpdate();
void dump(raw_ostream &OS = dbgs()) const;
private:
diff --git a/llvm/unittests/IR/ConstantRangeTest.cpp b/llvm/unittests/IR/ConstantRangeTest.cpp
index 6d2d85c..cb53801 100644
--- a/llvm/unittests/IR/ConstantRangeTest.cpp
+++ b/llvm/unittests/IR/ConstantRangeTest.cpp
@@ -175,7 +175,7 @@ static void TestRange(const ConstantRange &CR, const SmallBitVector &Elems,
}
using UnaryRangeFn = llvm::function_ref<ConstantRange(const ConstantRange &)>;
-using UnaryIntFn = llvm::function_ref<Optional<APInt>(const APInt &)>;
+using UnaryIntFn = llvm::function_ref<std::optional<APInt>(const APInt &)>;
static void TestUnaryOpExhaustive(UnaryRangeFn RangeFn, UnaryIntFn IntFn,
PreferFn PreferenceFn = PreferSmallest) {
@@ -183,7 +183,7 @@ static void TestUnaryOpExhaustive(UnaryRangeFn RangeFn, UnaryIntFn IntFn,
EnumerateConstantRanges(Bits, [&](const ConstantRange &CR) {
SmallBitVector Elems(1 << Bits);
ForeachNumInConstantRange(CR, [&](const APInt &N) {
- if (Optional<APInt> ResultN = IntFn(N))
+ if (std::optional<APInt> ResultN = IntFn(N))
Elems.set(ResultN->getZExtValue());
});
TestRange(RangeFn(CR), Elems, PreferenceFn, {CR});
@@ -192,8 +192,8 @@ static void TestUnaryOpExhaustive(UnaryRangeFn RangeFn, UnaryIntFn IntFn,
using BinaryRangeFn = llvm::function_ref<ConstantRange(const ConstantRange &,
const ConstantRange &)>;
-using BinaryIntFn = llvm::function_ref<Optional<APInt>(const APInt &,
- const APInt &)>;
+using BinaryIntFn =
+ llvm::function_ref<std::optional<APInt>(const APInt &, const APInt &)>;
using BinaryCheckFn = llvm::function_ref<bool(const ConstantRange &,
const ConstantRange &)>;
@@ -233,7 +233,7 @@ static void TestBinaryOpExhaustive(BinaryRangeFn RangeFn, BinaryIntFn IntFn,
SmallBitVector Elems(1 << Bits);
ForeachNumInConstantRange(CR1, [&](const APInt &N1) {
ForeachNumInConstantRange(CR2, [&](const APInt &N2) {
- if (Optional<APInt> ResultN = IntFn(N1, N2))
+ if (std::optional<APInt> ResultN = IntFn(N1, N2))
Elems.set(ResultN->getZExtValue());
});
});
@@ -773,15 +773,14 @@ TEST_F(ConstantRangeTest, AddWithNoWrap) {
[](const ConstantRange &CR1, const ConstantRange &CR2) {
return CR1.addWithNoWrap(CR2, OBO::NoSignedWrap);
},
- [](const APInt &N1, const APInt &N2) -> Optional<APInt> {
+ [](const APInt &N1, const APInt &N2) -> std::optional<APInt> {
bool IsOverflow;
APInt Res = N1.sadd_ov(N2, IsOverflow);
if (IsOverflow)
return std::nullopt;
return Res;
},
- PreferSmallest,
- CheckNonSignWrappedOnly);
+ PreferSmallest, CheckNonSignWrappedOnly);
EXPECT_EQ(Empty.addWithNoWrap(Some, OBO::NoUnsignedWrap), Empty);
EXPECT_EQ(Some.addWithNoWrap(Empty, OBO::NoUnsignedWrap), Empty);
@@ -827,15 +826,14 @@ TEST_F(ConstantRangeTest, AddWithNoWrap) {
[](const ConstantRange &CR1, const ConstantRange &CR2) {
return CR1.addWithNoWrap(CR2, OBO::NoUnsignedWrap);
},
- [](const APInt &N1, const APInt &N2) -> Optional<APInt> {
+ [](const APInt &N1, const APInt &N2) -> std::optional<APInt> {
bool IsOverflow;
APInt Res = N1.uadd_ov(N2, IsOverflow);
if (IsOverflow)
return std::nullopt;
return Res;
},
- PreferSmallest,
- CheckNonWrappedOnly);
+ PreferSmallest, CheckNonWrappedOnly);
EXPECT_EQ(ConstantRange(APInt(8, 50), APInt(8, 100))
.addWithNoWrap(ConstantRange(APInt(8, 20), APInt(8, 70)),
@@ -867,7 +865,7 @@ TEST_F(ConstantRangeTest, AddWithNoWrap) {
[](const ConstantRange &CR1, const ConstantRange &CR2) {
return CR1.addWithNoWrap(CR2, OBO::NoUnsignedWrap | OBO::NoSignedWrap);
},
- [](const APInt &N1, const APInt &N2) -> Optional<APInt> {
+ [](const APInt &N1, const APInt &N2) -> std::optional<APInt> {
bool IsOverflow1, IsOverflow2;
APInt Res1 = N1.uadd_ov(N2, IsOverflow1);
APInt Res2 = N1.sadd_ov(N2, IsOverflow2);
@@ -876,8 +874,7 @@ TEST_F(ConstantRangeTest, AddWithNoWrap) {
assert(Res1 == Res2 && "Addition results differ?");
return Res1;
},
- PreferSmallest,
- CheckNonWrappedOrSignWrappedOnly);
+ PreferSmallest, CheckNonWrappedOrSignWrappedOnly);
}
TEST_F(ConstantRangeTest, Sub) {
@@ -916,33 +913,31 @@ TEST_F(ConstantRangeTest, SubWithNoWrap) {
[](const ConstantRange &CR1, const ConstantRange &CR2) {
return CR1.subWithNoWrap(CR2, OBO::NoSignedWrap);
},
- [](const APInt &N1, const APInt &N2) -> Optional<APInt> {
+ [](const APInt &N1, const APInt &N2) -> std::optional<APInt> {
bool IsOverflow;
APInt Res = N1.ssub_ov(N2, IsOverflow);
if (IsOverflow)
return std::nullopt;
return Res;
},
- PreferSmallest,
- CheckNonSignWrappedOnly);
+ PreferSmallest, CheckNonSignWrappedOnly);
TestBinaryOpExhaustive(
[](const ConstantRange &CR1, const ConstantRange &CR2) {
return CR1.subWithNoWrap(CR2, OBO::NoUnsignedWrap);
},
- [](const APInt &N1, const APInt &N2) -> Optional<APInt> {
+ [](const APInt &N1, const APInt &N2) -> std::optional<APInt> {
bool IsOverflow;
APInt Res = N1.usub_ov(N2, IsOverflow);
if (IsOverflow)
return std::nullopt;
return Res;
},
- PreferSmallest,
- CheckNonWrappedOnly);
+ PreferSmallest, CheckNonWrappedOnly);
TestBinaryOpExhaustive(
[](const ConstantRange &CR1, const ConstantRange &CR2) {
return CR1.subWithNoWrap(CR2, OBO::NoUnsignedWrap | OBO::NoSignedWrap);
},
- [](const APInt &N1, const APInt &N2) -> Optional<APInt> {
+ [](const APInt &N1, const APInt &N2) -> std::optional<APInt> {
bool IsOverflow1, IsOverflow2;
APInt Res1 = N1.usub_ov(N2, IsOverflow1);
APInt Res2 = N1.ssub_ov(N2, IsOverflow2);
@@ -951,8 +946,7 @@ TEST_F(ConstantRangeTest, SubWithNoWrap) {
assert(Res1 == Res2 && "Subtraction results differ?");
return Res1;
},
- PreferSmallest,
- CheckNonWrappedOrSignWrappedOnly);
+ PreferSmallest, CheckNonWrappedOrSignWrappedOnly);
}
TEST_F(ConstantRangeTest, Multiply) {
@@ -1246,13 +1240,12 @@ TEST_F(ConstantRangeTest, URem) {
[](const ConstantRange &CR1, const ConstantRange &CR2) {
return CR1.urem(CR2);
},
- [](const APInt &N1, const APInt &N2) -> Optional<APInt> {
+ [](const APInt &N1, const APInt &N2) -> std::optional<APInt> {
if (N2.isZero())
return std::nullopt;
return N1.urem(N2);
},
- PreferSmallest,
- CheckSingleElementsOnly);
+ PreferSmallest, CheckSingleElementsOnly);
}
TEST_F(ConstantRangeTest, SRem) {
@@ -1322,13 +1315,12 @@ TEST_F(ConstantRangeTest, SRem) {
[](const ConstantRange &CR1, const ConstantRange &CR2) {
return CR1.srem(CR2);
},
- [](const APInt &N1, const APInt &N2) -> Optional<APInt> {
+ [](const APInt &N1, const APInt &N2) -> std::optional<APInt> {
if (N2.isZero())
return std::nullopt;
return N1.srem(N2);
},
- PreferSmallest,
- CheckSingleElementsOnly);
+ PreferSmallest, CheckSingleElementsOnly);
}
TEST_F(ConstantRangeTest, Shl) {
@@ -1360,7 +1352,7 @@ TEST_F(ConstantRangeTest, Shl) {
[](const ConstantRange &CR1, const ConstantRange &CR2) {
return CR1.shl(CR2);
},
- [](const APInt &N1, const APInt &N2) -> Optional<APInt> {
+ [](const APInt &N1, const APInt &N2) -> std::optional<APInt> {
if (N2.uge(N2.getBitWidth()))
return std::nullopt;
return N1.shl(N2);
@@ -2397,7 +2389,7 @@ TEST_F(ConstantRangeTest, Abs) {
TestUnaryOpExhaustive(
[](const ConstantRange &CR) { return CR.abs(/*IntMinIsPoison=*/true); },
- [](const APInt &N) -> Optional<APInt> {
+ [](const APInt &N) -> std::optional<APInt> {
if (N.isMinSignedValue())
return std::nullopt;
return N.abs();
diff --git a/llvm/unittests/IR/DominatorTreeTest.cpp b/llvm/unittests/IR/DominatorTreeTest.cpp
index 21f11c8..6260ce2 100644
--- a/llvm/unittests/IR/DominatorTreeTest.cpp
+++ b/llvm/unittests/IR/DominatorTreeTest.cpp
@@ -722,7 +722,7 @@ TEST(DominatorTree, InsertReachable) {
PostDominatorTree PDT(*Holder.F);
EXPECT_TRUE(PDT.verify());
- Optional<CFGBuilder::Update> LastUpdate;
+ std::optional<CFGBuilder::Update> LastUpdate;
while ((LastUpdate = B.applyUpdate())) {
EXPECT_EQ(LastUpdate->Action, Insert);
BasicBlock *From = B.getOrAddBlock(LastUpdate->Edge.From);
@@ -748,7 +748,7 @@ TEST(DominatorTree, InsertReachable2) {
PostDominatorTree PDT(*Holder.F);
EXPECT_TRUE(PDT.verify());
- Optional<CFGBuilder::Update> LastUpdate = B.applyUpdate();
+ std::optional<CFGBuilder::Update> LastUpdate = B.applyUpdate();
EXPECT_TRUE(LastUpdate);
EXPECT_EQ(LastUpdate->Action, Insert);
@@ -776,7 +776,7 @@ TEST(DominatorTree, InsertUnreachable) {
PostDominatorTree PDT(*Holder.F);
EXPECT_TRUE(PDT.verify());
- Optional<CFGBuilder::Update> LastUpdate;
+ std::optional<CFGBuilder::Update> LastUpdate;
while ((LastUpdate = B.applyUpdate())) {
EXPECT_EQ(LastUpdate->Action, Insert);
BasicBlock *From = B.getOrAddBlock(LastUpdate->Edge.From);
@@ -797,7 +797,7 @@ TEST(DominatorTree, InsertFromUnreachable) {
PostDominatorTree PDT(*Holder.F);
EXPECT_TRUE(PDT.verify());
- Optional<CFGBuilder::Update> LastUpdate = B.applyUpdate();
+ std::optional<CFGBuilder::Update> LastUpdate = B.applyUpdate();
EXPECT_TRUE(LastUpdate);
EXPECT_EQ(LastUpdate->Action, Insert);
@@ -827,7 +827,7 @@ TEST(DominatorTree, InsertMixed) {
PostDominatorTree PDT(*Holder.F);
EXPECT_TRUE(PDT.verify());
- Optional<CFGBuilder::Update> LastUpdate;
+ std::optional<CFGBuilder::Update> LastUpdate;
while ((LastUpdate = B.applyUpdate())) {
EXPECT_EQ(LastUpdate->Action, Insert);
BasicBlock *From = B.getOrAddBlock(LastUpdate->Edge.From);
@@ -857,7 +857,7 @@ TEST(DominatorTree, InsertPermut) {
PostDominatorTree PDT(*Holder.F);
EXPECT_TRUE(PDT.verify());
- Optional<CFGBuilder::Update> LastUpdate;
+ std::optional<CFGBuilder::Update> LastUpdate;
while ((LastUpdate = B.applyUpdate())) {
EXPECT_EQ(LastUpdate->Action, Insert);
BasicBlock *From = B.getOrAddBlock(LastUpdate->Edge.From);
@@ -884,7 +884,7 @@ TEST(DominatorTree, DeleteReachable) {
PostDominatorTree PDT(*Holder.F);
EXPECT_TRUE(PDT.verify());
- Optional<CFGBuilder::Update> LastUpdate;
+ std::optional<CFGBuilder::Update> LastUpdate;
while ((LastUpdate = B.applyUpdate())) {
EXPECT_EQ(LastUpdate->Action, Delete);
BasicBlock *From = B.getOrAddBlock(LastUpdate->Edge.From);
@@ -910,7 +910,7 @@ TEST(DominatorTree, DeleteUnreachable) {
PostDominatorTree PDT(*Holder.F);
EXPECT_TRUE(PDT.verify());
- Optional<CFGBuilder::Update> LastUpdate;
+ std::optional<CFGBuilder::Update> LastUpdate;
while ((LastUpdate = B.applyUpdate())) {
EXPECT_EQ(LastUpdate->Action, Delete);
BasicBlock *From = B.getOrAddBlock(LastUpdate->Edge.From);
@@ -940,7 +940,7 @@ TEST(DominatorTree, InsertDelete) {
PostDominatorTree PDT(*Holder.F);
EXPECT_TRUE(PDT.verify());
- Optional<CFGBuilder::Update> LastUpdate;
+ std::optional<CFGBuilder::Update> LastUpdate;
while ((LastUpdate = B.applyUpdate())) {
BasicBlock *From = B.getOrAddBlock(LastUpdate->Edge.From);
BasicBlock *To = B.getOrAddBlock(LastUpdate->Edge.To);
@@ -978,7 +978,7 @@ TEST(DominatorTree, InsertDeleteExhaustive) {
PostDominatorTree PDT(*Holder.F);
EXPECT_TRUE(PDT.verify());
- Optional<CFGBuilder::Update> LastUpdate;
+ std::optional<CFGBuilder::Update> LastUpdate;
while ((LastUpdate = B.applyUpdate())) {
BasicBlock *From = B.getOrAddBlock(LastUpdate->Edge.From);
BasicBlock *To = B.getOrAddBlock(LastUpdate->Edge.To);
diff --git a/llvm/unittests/IR/VPIntrinsicTest.cpp b/llvm/unittests/IR/VPIntrinsicTest.cpp
index 6ef9ccc..5abead9 100644
--- a/llvm/unittests/IR/VPIntrinsicTest.cpp
+++ b/llvm/unittests/IR/VPIntrinsicTest.cpp
@@ -163,7 +163,7 @@ protected:
/// Check that the property scopes include/llvm/IR/VPIntrinsics.def are closed.
TEST_F(VPIntrinsicTest, VPIntrinsicsDefScopes) {
- Optional<Intrinsic::ID> ScopeVPID;
+ std::optional<Intrinsic::ID> ScopeVPID;
#define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) \
ASSERT_FALSE(ScopeVPID.has_value()); \
ScopeVPID = Intrinsic::VPID;
@@ -172,7 +172,7 @@ TEST_F(VPIntrinsicTest, VPIntrinsicsDefScopes) {
ASSERT_EQ(*ScopeVPID, Intrinsic::VPID); \
ScopeVPID = std::nullopt;
- Optional<ISD::NodeType> ScopeOPC;
+ std::optional<ISD::NodeType> ScopeOPC;
#define BEGIN_REGISTER_VP_SDNODE(SDOPC, ...) \
ASSERT_FALSE(ScopeOPC.has_value()); \
ScopeOPC = ISD::SDOPC;
diff --git a/llvm/unittests/Remarks/YAMLRemarksSerializerTest.cpp b/llvm/unittests/Remarks/YAMLRemarksSerializerTest.cpp
index 6ad665b..fef1a93 100644
--- a/llvm/unittests/Remarks/YAMLRemarksSerializerTest.cpp
+++ b/llvm/unittests/Remarks/YAMLRemarksSerializerTest.cpp
@@ -24,8 +24,8 @@ using namespace llvm;
static void check(remarks::Format SerializerFormat,
remarks::SerializerMode Mode, ArrayRef<remarks::Remark> Rs,
- StringRef ExpectedR, Optional<StringRef> ExpectedMeta,
- Optional<remarks::StringTable> StrTab = std::nullopt) {
+ StringRef ExpectedR, std::optional<StringRef> ExpectedMeta,
+ std::optional<remarks::StringTable> StrTab = std::nullopt) {
std::string Buf;
raw_string_ostream OS(Buf);
Expected<std::unique_ptr<remarks::RemarkSerializer>> MaybeS = [&] {
@@ -53,7 +53,7 @@ static void check(remarks::Format SerializerFormat,
static void check(remarks::Format SerializerFormat, const remarks::Remark &R,
StringRef ExpectedR, StringRef ExpectedMeta,
- Optional<remarks::StringTable> StrTab = std::nullopt) {
+ std::optional<remarks::StringTable> StrTab = std::nullopt) {
return check(SerializerFormat, remarks::SerializerMode::Separate,
makeArrayRef(&R, &R + 1), ExpectedR, ExpectedMeta,
std::move(StrTab));
@@ -62,7 +62,7 @@ static void check(remarks::Format SerializerFormat, const remarks::Remark &R,
static void
checkStandalone(remarks::Format SerializerFormat, const remarks::Remark &R,
StringRef ExpectedR,
- Optional<remarks::StringTable> StrTab = std::nullopt) {
+ std::optional<remarks::StringTable> StrTab = std::nullopt) {
return check(SerializerFormat, remarks::SerializerMode::Standalone,
makeArrayRef(&R, &R + 1), ExpectedR,
/*ExpectedMeta=*/std::nullopt, std::move(StrTab));
diff --git a/llvm/unittests/Support/TypeTraitsTest.cpp b/llvm/unittests/Support/TypeTraitsTest.cpp
index 845c38d..85f985d 100644
--- a/llvm/unittests/Support/TypeTraitsTest.cpp
+++ b/llvm/unittests/Support/TypeTraitsTest.cpp
@@ -120,7 +120,7 @@ TEST(Triviality, ADT) {
TrivialityTester<llvm::PointerIntPair<int *, 2>, true, true>();
#if defined(_LIBCPP_VERSION) || \
(defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE >= 8)
- TrivialityTester<llvm::Optional<int>, true, true>();
+ TrivialityTester<std::optional<int>, true, true>();
#endif
}
diff --git a/llvm/unittests/Testing/Support/TempPathTest.cpp b/llvm/unittests/Testing/Support/TempPathTest.cpp
index 11820b0..37186f5 100644
--- a/llvm/unittests/Testing/Support/TempPathTest.cpp
+++ b/llvm/unittests/Testing/Support/TempPathTest.cpp
@@ -19,7 +19,7 @@ using llvm::unittest::TempLink;
namespace {
TEST(TempPathTest, TempDir) {
- Optional<TempDir> Dir1, Dir2;
+ std::optional<TempDir> Dir1, Dir2;
StringRef Prefix = "temp-path-test";
Dir1.emplace(Prefix, /*Unique=*/true);
EXPECT_EQ(Prefix,
@@ -44,7 +44,7 @@ TEST(TempPathTest, TempFile) {
TempDir D("temp-path-test", /*Unique=*/true);
ASSERT_TRUE(sys::fs::exists(D.path()));
- Optional<TempFile> File1, File2;
+ std::optional<TempFile> File1, File2;
File1.emplace(D.path("file"), "suffix", "content");
EXPECT_EQ("file.suffix", sys::path::filename(File1->path()));
{
@@ -73,7 +73,7 @@ TEST(TempPathTest, TempLink) {
ASSERT_TRUE(sys::fs::exists(D.path()));
TempFile File(D.path("file"), "suffix", "content");
- Optional<TempLink> Link1, Link2;
+ std::optional<TempLink> Link1, Link2;
Link1.emplace(File.path(), D.path("link"));
EXPECT_EQ("link", sys::path::filename(Link1->path()));
{