From e3b557809604d036af6e00c60f012c2025b59a5e Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 11 Feb 2023 13:38:04 +0100 Subject: Vendor import of llvm-project main llvmorg-16-init-18548-gb0daacf58f41, the last commit before the upstream release/17.x branch was created. --- llvm/tools/llvm-sim/llvm-sim.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'llvm/tools/llvm-sim/llvm-sim.cpp') diff --git a/llvm/tools/llvm-sim/llvm-sim.cpp b/llvm/tools/llvm-sim/llvm-sim.cpp index 2b717d72e48a..d09e51561253 100644 --- a/llvm/tools/llvm-sim/llvm-sim.cpp +++ b/llvm/tools/llvm-sim/llvm-sim.cpp @@ -41,13 +41,13 @@ static cl::opt InputSourceFile(cl::Positional, /// \param LLVMInstNum - The mapping of Instructions to their location in the /// module represented by an unsigned integer. /// \returns The instruction number for \p I if it exists. -Optional +std::optional getPositionInModule(const Instruction *I, const DenseMap &LLVMInstNum) { assert(I && "Instruction is nullptr!"); DenseMap::const_iterator It = LLVMInstNum.find(I); if (It == LLVMInstNum.end()) - return None; + return std::nullopt; return It->second; } @@ -80,9 +80,9 @@ exportToFile(const StringRef FilePath, // For each file there is a list of the range where the similarity // exists. for (const IRSimilarityCandidate &C : G) { - Optional Start = + std::optional Start = getPositionInModule((*C.front()).Inst, LLVMInstNum); - Optional End = + std::optional End = getPositionInModule((*C.back()).Inst, LLVMInstNum); assert(Start && @@ -90,8 +90,8 @@ exportToFile(const StringRef FilePath, assert(End && "Could not find instruction number for last instruction"); J.object([&] { - J.attribute("start", Start.value()); - J.attribute("end", End.value()); + J.attribute("start", *Start); + J.attribute("end", *End); }); } J.arrayEnd(); -- cgit v1.2.3