[polly] 043aa1d - [polly] Use std::nullopt instead of None (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 3 18:50:41 PST 2022
Author: Kazu Hirata
Date: 2022-12-03T18:50:29-08:00
New Revision: 043aa1dbba158dd99edbc4fa878e338c4ab5c34a
URL: https://github.com/llvm/llvm-project/commit/043aa1dbba158dd99edbc4fa878e338c4ab5c34a
DIFF: https://github.com/llvm/llvm-project/commit/043aa1dbba158dd99edbc4fa878e338c4ab5c34a.diff
LOG: [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
Added:
Modified:
polly/lib/Analysis/ScopInfo.cpp
polly/lib/Support/ScopHelper.cpp
Removed:
################################################################################
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index bbbb17714ea1..210f8168fcc6 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -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
diff erent from ISL's.
diff --git a/polly/lib/Support/ScopHelper.cpp b/polly/lib/Support/ScopHelper.cpp
index f9dbdb9c4d03..ec9155e06280 100644
--- a/polly/lib/Support/ScopHelper.cpp
+++ b/polly/lib/Support/ScopHelper.cpp
@@ -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();
}
More information about the llvm-commits
mailing list