From 043aa1dbba158dd99edbc4fa878e338c4ab5c34a Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 3 Dec 2022 18:50:29 -0800 Subject: [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 --- polly/lib/Analysis/ScopInfo.cpp | 2 +- polly/lib/Support/ScopHelper.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'polly') diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index bbbb177..210f816 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 different from ISL's. diff --git a/polly/lib/Support/ScopHelper.cpp b/polly/lib/Support/ScopHelper.cpp index f9dbdb9..ec9155e 100644 --- a/polly/lib/Support/ScopHelper.cpp +++ b/polly/lib/Support/ScopHelper.cpp @@ -703,7 +703,7 @@ static Optional 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 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 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 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(AttrMD->get()); if (!IntMD) - return None; + return std::nullopt; return IntMD->getSExtValue(); } -- cgit v1.1