aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/AsmParser/LLParser.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2022-12-02 21:11:44 -0800
committerKazu Hirata <kazu@google.com>2022-12-02 21:11:44 -0800
commitaadaaface2ec96ee30d92bf46faa41dd9e68b64d (patch)
treee8da5e8b9e241f764c8fcd8d047b1a3b4f22ce3e /llvm/lib/AsmParser/LLParser.cpp
parented88e60b373383322c4b7465d43dc6c06092facb (diff)
downloadllvm-aadaaface2ec96ee30d92bf46faa41dd9e68b64d.zip
llvm-aadaaface2ec96ee30d92bf46faa41dd9e68b64d.tar.gz
llvm-aadaaface2ec96ee30d92bf46faa41dd9e68b64d.tar.bz2
[llvm] 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/AsmParser/LLParser.cpp')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 70f1ccb..0ac42a4 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -783,7 +783,7 @@ bool LLParser::parseMDNodeID(MDNode *&Result) {
// Otherwise, create MDNode forward reference.
auto &FwdRef = ForwardRefMDNodes[MID];
- FwdRef = std::make_pair(MDTuple::getTemporary(Context, None), IDLoc);
+ FwdRef = std::make_pair(MDTuple::getTemporary(Context, std::nullopt), IDLoc);
Result = FwdRef.first.get();
NumberedMetadata[MID].reset(Result);
@@ -2132,7 +2132,7 @@ bool LLParser::parseOptionalFunctionMetadata(Function &F) {
/// ::= /* empty */
/// ::= 'align' 4
bool LLParser::parseOptionalAlignment(MaybeAlign &Alignment, bool AllowParens) {
- Alignment = None;
+ Alignment = std::nullopt;
if (!EatIfPresent(lltok::kw_align))
return false;
LocTy AlignLoc = Lex.getLoc();
@@ -2244,7 +2244,7 @@ static Optional<MemoryEffects::Location> keywordToLoc(lltok::Kind Tok) {
case lltok::kw_inaccessiblemem:
return MemoryEffects::InaccessibleMem;
default:
- return None;
+ return std::nullopt;
}
}
@@ -2259,7 +2259,7 @@ static Optional<ModRefInfo> keywordToModRef(lltok::Kind Tok) {
case lltok::kw_readwrite:
return ModRefInfo::ModRef;
default:
- return None;
+ return std::nullopt;
}
}
@@ -2274,7 +2274,7 @@ Optional<MemoryEffects> LLParser::parseMemoryAttr() {
Lex.Lex();
if (!EatIfPresent(lltok::lparen)) {
tokError("expected '('");
- return None;
+ return std::nullopt;
}
bool SeenLoc = false;
@@ -2284,7 +2284,7 @@ Optional<MemoryEffects> LLParser::parseMemoryAttr() {
Lex.Lex();
if (!EatIfPresent(lltok::colon)) {
tokError("expected ':' after location");
- return None;
+ return std::nullopt;
}
}
@@ -2295,7 +2295,7 @@ Optional<MemoryEffects> LLParser::parseMemoryAttr() {
"or access kind (none, read, write, readwrite)");
else
tokError("expected access kind (none, read, write, readwrite)");
- return None;
+ return std::nullopt;
}
Lex.Lex();
@@ -2305,7 +2305,7 @@ Optional<MemoryEffects> LLParser::parseMemoryAttr() {
} else {
if (SeenLoc) {
tokError("default access kind must be specified first");
- return None;
+ return std::nullopt;
}
ME = MemoryEffects(*MR);
}
@@ -2315,7 +2315,7 @@ Optional<MemoryEffects> LLParser::parseMemoryAttr() {
} while (EatIfPresent(lltok::comma));
tokError("unterminated memory attribute");
- return None;
+ return std::nullopt;
}
/// parseOptionalCommaAlign
@@ -2392,7 +2392,7 @@ bool LLParser::parseAllocSizeArguments(unsigned &BaseSizeArg,
"'allocsize' indices can't refer to the same parameter");
HowManyArg = HowMany;
} else
- HowManyArg = None;
+ HowManyArg = std::nullopt;
auto EndParen = Lex.getLoc();
if (!EatIfPresent(lltok::rparen))