aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/tools/llvm-sim/llvm-sim.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/tools/llvm-sim/llvm-sim.cpp')
-rw-r--r--contrib/llvm-project/llvm/tools/llvm-sim/llvm-sim.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/contrib/llvm-project/llvm/tools/llvm-sim/llvm-sim.cpp b/contrib/llvm-project/llvm/tools/llvm-sim/llvm-sim.cpp
index 2b717d72e48a..d09e51561253 100644
--- a/contrib/llvm-project/llvm/tools/llvm-sim/llvm-sim.cpp
+++ b/contrib/llvm-project/llvm/tools/llvm-sim/llvm-sim.cpp
@@ -41,13 +41,13 @@ static cl::opt<std::string> 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<unsigned>
+std::optional<unsigned>
getPositionInModule(const Instruction *I,
const DenseMap<Instruction *, unsigned> &LLVMInstNum) {
assert(I && "Instruction is nullptr!");
DenseMap<Instruction *, unsigned>::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<unsigned> Start =
+ std::optional<unsigned> Start =
getPositionInModule((*C.front()).Inst, LLVMInstNum);
- Optional<unsigned> End =
+ std::optional<unsigned> 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();