aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/ValueMapper.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2022-12-02 21:11:37 -0800
committerKazu Hirata <kazu@google.com>2022-12-02 21:11:37 -0800
commit343de6856e16b58bcbd16d479fc633f54e22fadc (patch)
tree31e3fbef03aa0e4c5ea9582d0eacc650aba3073d /llvm/lib/Transforms/Utils/ValueMapper.cpp
parent998960ee1f2c8bc3830df4849ab89ec9d6217f26 (diff)
downloadllvm-343de6856e16b58bcbd16d479fc633f54e22fadc.zip
llvm-343de6856e16b58bcbd16d479fc633f54e22fadc.tar.gz
llvm-343de6856e16b58bcbd16d479fc633f54e22fadc.tar.bz2
[Transforms] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::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/lib/Transforms/Utils/ValueMapper.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/ValueMapper.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp
index 8947303..3d9fd56 100644
--- a/llvm/lib/Transforms/Utils/ValueMapper.cpp
+++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp
@@ -391,8 +391,9 @@ Value *Mapper::mapValue(const Value *V) {
// ensures metadata operands only reference defined SSA values.
return (Flags & RF_IgnoreMissingLocals)
? nullptr
- : MetadataAsValue::get(V->getContext(),
- MDTuple::get(V->getContext(), None));
+ : MetadataAsValue::get(
+ V->getContext(),
+ MDTuple::get(V->getContext(), std::nullopt));
}
if (auto *AL = dyn_cast<DIArgList>(MD)) {
SmallVector<ValueAsMetadata *, 4> MappedArgs;
@@ -578,7 +579,7 @@ Optional<Metadata *> MDNodeMapper::tryToMapOperand(const Metadata *Op) {
const MDNode &N = *cast<MDNode>(Op);
if (N.isDistinct())
return mapDistinctNode(N);
- return None;
+ return std::nullopt;
}
MDNode *MDNodeMapper::mapDistinctNode(const MDNode &N) {
@@ -619,7 +620,7 @@ Optional<Metadata *> MDNodeMapper::getMappedOp(const Metadata *Op) const {
if (auto *CMD = dyn_cast<ConstantAsMetadata>(Op))
return wrapConstantAsMetadata(*CMD, M.getVM().lookup(CMD->getValue()));
- return None;
+ return std::nullopt;
}
Metadata &MDNodeMapper::UniquedGraph::getFwdReference(MDNode &Op) {
@@ -848,7 +849,7 @@ Optional<Metadata *> Mapper::mapSimpleMetadata(const Metadata *MD) {
assert(isa<MDNode>(MD) && "Expected a metadata node");
- return None;
+ return std::nullopt;
}
Metadata *Mapper::mapMetadata(const Metadata *MD) {