From 343de6856e16b58bcbd16d479fc633f54e22fadc Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Fri, 2 Dec 2022 21:11:37 -0800 Subject: [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 --- llvm/lib/Transforms/Utils/Local.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Transforms/Utils/Local.cpp') diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index c9fe093..d4d061a 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -2174,7 +2174,7 @@ bool llvm::replaceAllDbgUsesWith(Instruction &From, Value &To, // Without knowing signedness, sign/zero extension isn't possible. auto Signedness = Var->getSignedness(); if (!Signedness) - return None; + return std::nullopt; bool Signed = *Signedness == DIBasicType::Signedness::Signed; return DIExpression::appendExt(DII.getExpression(), ToBits, FromBits, @@ -2912,7 +2912,7 @@ void llvm::copyRangeMetadata(const DataLayout &DL, const LoadInst &OldLI, unsigned BitWidth = DL.getPointerTypeSizeInBits(NewTy); if (!getConstantRangeFromMetadata(*N).contains(APInt(BitWidth, 0))) { - MDNode *NN = MDNode::get(OldLI.getContext(), None); + MDNode *NN = MDNode::get(OldLI.getContext(), std::nullopt); NewLI.setMetadata(LLVMContext::MD_nonnull, NN); } } @@ -3021,7 +3021,7 @@ collectBitParts(Value *V, bool MatchBSwaps, bool MatchBitReversals, if (I != BPS.end()) return I->second; - auto &Result = BPS[V] = None; + auto &Result = BPS[V] = std::nullopt; auto BitWidth = V->getType()->getScalarSizeInBits(); // Can't do integer/elements > 128 bits. @@ -3057,7 +3057,7 @@ collectBitParts(Value *V, bool MatchBSwaps, bool MatchBitReversals, if (A->Provenance[BitIdx] != BitPart::Unset && B->Provenance[BitIdx] != BitPart::Unset && A->Provenance[BitIdx] != B->Provenance[BitIdx]) - return Result = None; + return Result = std::nullopt; if (A->Provenance[BitIdx] == BitPart::Unset) Result->Provenance[BitIdx] = B->Provenance[BitIdx]; -- cgit v1.1