[polly] 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
This commit is contained in:
Kazu Hirata 2022-12-03 18:50:29 -08:00
parent 1a36588ec6
commit 043aa1dbba
2 changed files with 6 additions and 6 deletions

View File

@ -1599,7 +1599,7 @@ Scop::Scop(Region &R, ScalarEvolution &ScalarEvolution, LoopInfo &LI,
DominatorTree &DT, ScopDetection::DetectionContext &DC,
OptimizationRemarkEmitter &ORE, int ID)
: IslCtx(isl_ctx_alloc(), isl_ctx_free), SE(&ScalarEvolution), DT(&DT),
R(R), name(None), HasSingleExitEdge(R.getExitingBlock()), DC(DC),
R(R), name(std::nullopt), HasSingleExitEdge(R.getExitingBlock()), DC(DC),
ORE(ORE), Affinator(this, LI), ID(ID) {
// Options defaults that are different from ISL's.

View File

@ -703,7 +703,7 @@ static Optional<const MDOperand *> findNamedMetadataArg(MDNode *LoopID,
StringRef Name) {
MDNode *MD = findNamedMetadataNode(LoopID, Name);
if (!MD)
return None;
return std::nullopt;
switch (MD->getNumOperands()) {
case 1:
return nullptr;
@ -718,7 +718,7 @@ Optional<Metadata *> polly::findMetadataOperand(MDNode *LoopMD,
StringRef Name) {
MDNode *MD = findNamedMetadataNode(LoopMD, Name);
if (!MD)
return None;
return std::nullopt;
switch (MD->getNumOperands()) {
case 1:
return nullptr;
@ -733,7 +733,7 @@ static Optional<bool> getOptionalBoolLoopAttribute(MDNode *LoopID,
StringRef Name) {
MDNode *MD = findNamedMetadataNode(LoopID, Name);
if (!MD)
return None;
return std::nullopt;
switch (MD->getNumOperands()) {
case 1:
return true;
@ -755,11 +755,11 @@ llvm::Optional<int> polly::getOptionalIntLoopAttribute(MDNode *LoopID,
const MDOperand *AttrMD =
findNamedMetadataArg(LoopID, Name).value_or(nullptr);
if (!AttrMD)
return None;
return std::nullopt;
ConstantInt *IntMD = mdconst::extract_or_null<ConstantInt>(AttrMD->get());
if (!IntMD)
return None;
return std::nullopt;
return IntMD->getSExtValue();
}