using ChildItTy = typename GT::ChildIteratorType;
// First element is the node reference, second is the next child to visit.
- using QueueElement = std::pair<NodeRef, Optional<ChildItTy>>;
+ using QueueElement = std::pair<NodeRef, std::optional<ChildItTy>>;
// Visit queue - used to maintain BFS ordering.
- // Optional<> because we need markers for levels.
- std::queue<Optional<QueueElement>> VisitQueue;
+ // std::optional<> because we need markers for levels.
+ std::queue<std::optional<QueueElement>> VisitQueue;
// Current level.
unsigned Level = 0;
inline bf_iterator() = default;
inline void toNext() {
- Optional<QueueElement> Head = VisitQueue.front();
+ std::optional<QueueElement> Head = VisitQueue.front();
QueueElement H = *Head;
NodeRef Node = H.first;
- Optional<ChildItTy> &ChildIt = H.second;
+ std::optional<ChildItTy> &ChildIt = H.second;
if (!ChildIt)
ChildIt.emplace(GT::child_begin(Node));
// First element is node reference, second is the 'next child' to visit.
// The second child is initialized lazily to pick up graph changes during the
// DFS.
- using StackElement = std::pair<NodeRef, Optional<ChildItTy>>;
+ using StackElement = std::pair<NodeRef, std::optional<ChildItTy>>;
// VisitStack - Used to maintain the ordering. Top = current block
std::vector<StackElement> VisitStack;
inline void toNext() {
do {
NodeRef Node = VisitStack.back().first;
- Optional<ChildItTy> &Opt = VisitStack.back().second;
+ std::optional<ChildItTy> &Opt = VisitStack.back().second;
if (!Opt)
Opt.emplace(GT::child_begin(Node));
#include <optional>
namespace llvm {
-/// A simple null object to allow implicit construction of Optional<T>
+/// A simple null object to allow implicit construction of std::optional<T>
/// and similar types without having to spell out the specialization's name.
LLVM_DEPRECATED("Use std::nullopt_t instead", "std::nullopt_t")
typedef std::nullopt_t NoneType;
uint8_t Kind;
uint32_t Flags;
// For undefined symbols the module of the import
- Optional<StringRef> ImportModule;
+ std::optional<StringRef> ImportModule;
// For undefined symbols the name of the import
- Optional<StringRef> ImportName;
+ std::optional<StringRef> ImportName;
// For symbols to be exported from the final module
- Optional<StringRef> ExportName;
+ std::optional<StringRef> ExportName;
union {
// For function, table, or global symbols, the index in function, table, or
// global index space.
// dwo_id field. This resides in the header only if Version >= 5.
// In earlier versions, it is read from DW_AT_GNU_dwo_id.
- Optional<uint64_t> Signature = std::nullopt;
+ std::optional<uint64_t> Signature = std::nullopt;
// Derived from the length of Length field.
dwarf::DwarfFormat Format = dwarf::DwarfFormat::DWARF32;
sys::RWMutex DebugBinariesMutex;
StringMap<std::string> DebugBinaries;
Error findBinaries(StringRef Path);
- Expected<Optional<std::string>> getDebugBinaryPath(object::BuildIDRef);
- Expected<Optional<std::string>> getBinaryPath(object::BuildIDRef);
+ Expected<std::optional<std::string>> getDebugBinaryPath(object::BuildIDRef);
+ Expected<std::optional<std::string>> getBinaryPath(object::BuildIDRef);
// If the collection has not been updated since MinInterval, call update() and
// return true. Otherwise return false. If update returns an error, return the
// error.
std::optional<bool> HasRequiresUnifiedSharedMemory;
// Flag for specifying if offloading is mandatory.
- Optional<bool> OpenMPOffloadMandatory;
+ std::optional<bool> OpenMPOffloadMandatory;
/// First separator used between the initial two parts of a name.
std::optional<StringRef> FirstSeparator;
class InjectorIRStrategy : public IRMutationStrategy {
std::vector<fuzzerop::OpDescriptor> Operations;
- Optional<fuzzerop::OpDescriptor> chooseOperation(Value *Src,
- RandomIRBuilder &IB);
+ std::optional<fuzzerop::OpDescriptor> chooseOperation(Value *Src,
+ RandomIRBuilder &IB);
public:
InjectorIRStrategy(std::vector<fuzzerop::OpDescriptor> &&Operations)
/// Reads a line.
///
- /// \return The line, or llvm::Optional<std::string>() on EOF.
- llvm::Optional<std::string> readLine() const;
+ /// \return The line, or std::optional<std::string>() on EOF.
+ std::optional<std::string> readLine() const;
void saveHistory();
void loadHistory();
/// Uses of this method are potentially indicative of problems: perhaps the
/// error should be propagated further, or the error-producer should just
/// return an Optional in the first place.
-template <typename T> Optional<T> expectedToOptional(Expected<T> &&E) {
+template <typename T> std::optional<T> expectedToOptional(Expected<T> &&E) {
if (E)
return std::move(*E);
consumeError(E.takeError());
const FunctionAddressMap &getFunctionAddresses() { return FunctionAddresses; }
/// Returns an XRay computed function id, provided a function address.
- Optional<int32_t> getFunctionId(uint64_t Addr) const;
+ std::optional<int32_t> getFunctionId(uint64_t Addr) const;
/// Returns the function address for a function id.
- Optional<uint64_t> getFunctionAddr(int32_t FuncId) const;
+ std::optional<uint64_t> getFunctionAddr(int32_t FuncId) const;
/// Provide read-only access to the entries of the instrumentation map.
const SledContainer &sleds() const { return Sleds; };
bool getBBClusterInfoForFunction(
const MachineFunction &MF,
BasicBlockSectionsProfileReader *BBSectionsProfileReader,
- std::vector<Optional<BBClusterInfo>> &V) {
+ std::vector<std::optional<BBClusterInfo>> &V) {
// Find the assoicated cluster information.
std::pair<bool, SmallVector<BBClusterInfo, 4>> P =
// and "Cold" succeeding all other clusters.
// FuncBBClusterInfo represent the cluster information for basic blocks. If this
// is empty, it means unique sections for all basic blocks in the function.
-static void
-assignSections(MachineFunction &MF,
- const std::vector<Optional<BBClusterInfo>> &FuncBBClusterInfo) {
+static void assignSections(
+ MachineFunction &MF,
+ const std::vector<std::optional<BBClusterInfo>> &FuncBBClusterInfo) {
assert(MF.hasBBSections() && "BB Sections is not set for function.");
// This variable stores the section ID of the cluster containing eh_pads (if
// all eh_pads are one cluster). If more than one cluster contain eh_pads, we
BBSectionsProfileReader = &getAnalysis<BasicBlockSectionsProfileReader>();
- std::vector<Optional<BBClusterInfo>> FuncBBClusterInfo;
+ std::vector<std::optional<BBClusterInfo>> FuncBBClusterInfo;
if (BBSectionsType == BasicBlockSection::List &&
!getBBClusterInfoForFunction(MF, BBSectionsProfileReader,
FuncBBClusterInfo))
std::unique_ptr<Spiller> SpillerInstance;
PQueue Queue;
std::unique_ptr<VirtRegAuxInfo> VRAI;
- Optional<ExtraRegInfo> ExtraInfo;
+ std::optional<ExtraRegInfo> ExtraInfo;
std::unique_ptr<RegAllocEvictionAdvisor> EvictAdvisor;
std::unique_ptr<RegAllocPriorityAdvisor> PriorityAdvisor;
return Error::success();
}
-Expected<Optional<std::string>>
+Expected<std::optional<std::string>>
DebuginfodCollection::getBinaryPath(BuildIDRef ID) {
Log.push("getting binary path of ID " + buildIDToString(ID));
std::shared_lock<sys::RWMutex> Guard(BinariesMutex);
return std::nullopt;
}
-Expected<Optional<std::string>>
+Expected<std::optional<std::string>>
DebuginfodCollection::getDebugBinaryPath(BuildIDRef ID) {
Log.push("getting debug binary path of ID " + buildIDToString(ID));
std::shared_lock<sys::RWMutex> Guard(DebugBinariesMutex);
Expected<std::string> DebuginfodCollection::findBinaryPath(BuildIDRef ID) {
{
// Check collection; perform on-demand update if stale.
- Expected<Optional<std::string>> PathOrErr = getBinaryPath(ID);
+ Expected<std::optional<std::string>> PathOrErr = getBinaryPath(ID);
if (!PathOrErr)
return PathOrErr.takeError();
- Optional<std::string> Path = *PathOrErr;
+ std::optional<std::string> Path = *PathOrErr;
if (!Path) {
Expected<bool> UpdatedOrErr = updateIfStale();
if (!UpdatedOrErr)
Expected<std::string> DebuginfodCollection::findDebugBinaryPath(BuildIDRef ID) {
// Check collection; perform on-demand update if stale.
- Expected<Optional<std::string>> PathOrErr = getDebugBinaryPath(ID);
+ Expected<std::optional<std::string>> PathOrErr = getDebugBinaryPath(ID);
if (!PathOrErr)
return PathOrErr.takeError();
- Optional<std::string> Path = *PathOrErr;
+ std::optional<std::string> Path = *PathOrErr;
if (!Path) {
Expected<bool> UpdatedOrErr = updateIfStale();
if (!UpdatedOrErr)
// context based on the match kind selected by the user via
// `implementation={extensions(match_[all,any,none])}'
auto HandleTrait = [MK](TraitProperty Property,
- bool WasFound) -> Optional<bool> /* Result */ {
+ bool WasFound) -> std::optional<bool> /* Result */ {
// For kind "any" a single match is enough but we ignore non-matched
// properties.
if (MK == MK_ANY) {
return Ctx.matchesISATrait(RawString);
});
- if (Optional<bool> Result = HandleTrait(Property, IsActiveTrait))
+ if (std::optional<bool> Result = HandleTrait(Property, IsActiveTrait))
return *Result;
}
if (ConstructMatches)
ConstructMatches->push_back(ConstructIdx - 1);
- if (Optional<bool> Result = HandleTrait(Property, FoundInOrder))
+ if (std::optional<bool> Result = HandleTrait(Property, FoundInOrder))
return *Result;
if (!FoundInOrder) {
return Ops;
}
-Optional<fuzzerop::OpDescriptor>
+std::optional<fuzzerop::OpDescriptor>
InjectorIRStrategy::chooseOperation(Value *Src, RandomIRBuilder &IB) {
auto OpMatchesPred = [&Src](fuzzerop::OpDescriptor &Op) {
return Op.SourcePreds[0].matches({}, Src);
}
}
-Optional<std::string> LineEditor::readLine() const {
+std::optional<std::string> LineEditor::readLine() const {
// Call el_gets to prompt the user and read the user's input.
int LineLen = 0;
const char *Line = ::el_gets(Data->EL, &LineLen);
void LineEditor::saveHistory() {}
void LineEditor::loadHistory() {}
-Optional<std::string> LineEditor::readLine() const {
+std::optional<std::string> LineEditor::readLine() const {
::fprintf(Data->Out, "%s", Prompt.c_str());
std::string Line;
return std::nullopt;
}
- Optional<RedirectingFileSystem::RootRelativeKind>
+ std::optional<RedirectingFileSystem::RootRelativeKind>
parseRootRelativeKind(yaml::Node *N) {
SmallString<12> Storage;
StringRef Value;
return getMachine(Triple(sys::getDefaultTargetTriple()));
}
-Optional<std::string> getPrefix(StringRef Argv0) {
+std::optional<std::string> getPrefix(StringRef Argv0) {
StringRef ProgName = llvm::sys::path::stem(Argv0);
// x86_64-w64-mingw32-dlltool -> x86_64-w64-mingw32
// llvm-dlltool -> None
}
COFF::MachineTypes Machine = getDefaultMachine();
- if (Optional<std::string> Prefix = getPrefix(ArgsArr[0])) {
+ if (std::optional<std::string> Prefix = getPrefix(ArgsArr[0])) {
Triple T(*Prefix);
if (T.getArch() != Triple::UnknownArch)
Machine = getMachine(T);
bool DetectUseAfterScope;
bool UsePageAliases;
- llvm::Optional<uint8_t> MatchAllTag;
+ std::optional<uint8_t> MatchAllTag;
unsigned PointerTagShift;
uint64_t TagMaskByte;
using namespace llvm;
using namespace xray;
-Optional<int32_t> InstrumentationMap::getFunctionId(uint64_t Addr) const {
+std::optional<int32_t> InstrumentationMap::getFunctionId(uint64_t Addr) const {
auto I = FunctionIds.find(Addr);
if (I != FunctionIds.end())
return I->second;
return std::nullopt;
}
-Optional<uint64_t> InstrumentationMap::getFunctionAddr(int32_t FuncId) const {
+std::optional<uint64_t>
+InstrumentationMap::getFunctionAddr(int32_t FuncId) const {
auto I = FunctionAddresses.find(FuncId);
if (I != FunctionAddresses.end())
return I->second;
}
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);
}
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);
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);
}
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;
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)
// 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;
// results.
std::unique_ptr<MaterializationResponsibility> FooR;
- Optional<SymbolMap> Result;
+ std::optional<SymbolMap> Result;
cantFail(JD.define(std::make_unique<SimpleMaterializationUnit>(
SymbolFlagsMap(
}
}
-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++];
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:
}
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) {
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});
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 &)>;
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());
});
});
[](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);
[](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)),
[](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);
assert(Res1 == Res2 && "Addition results differ?");
return Res1;
},
- PreferSmallest,
- CheckNonWrappedOrSignWrappedOnly);
+ PreferSmallest, CheckNonWrappedOrSignWrappedOnly);
}
TEST_F(ConstantRangeTest, Sub) {
[](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);
assert(Res1 == Res2 && "Subtraction results differ?");
return Res1;
},
- PreferSmallest,
- CheckNonWrappedOrSignWrappedOnly);
+ PreferSmallest, CheckNonWrappedOrSignWrappedOnly);
}
TEST_F(ConstantRangeTest, Multiply) {
[](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) {
[](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) {
[](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);
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();
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
/// 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;
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;
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 = [&] {
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));
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));
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
}
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,
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()));
{
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()));
{
std::vector<std::unique_ptr<Node>> Children;
std::string Name;
Node *Parent = nullptr;
- llvm::Optional<char32_t> Value;
+ std::optional<char32_t> Value;
};
std::unique_ptr<Node> Root = std::make_unique<Node>("");