aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/YAMLParser.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/Support/YAMLParser.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/Support/YAMLParser.cpp')
-rw-r--r--llvm/lib/Support/YAMLParser.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/llvm/lib/Support/YAMLParser.cpp b/llvm/lib/Support/YAMLParser.cpp
index e9619f5..5046074 100644
--- a/llvm/lib/Support/YAMLParser.cpp
+++ b/llvm/lib/Support/YAMLParser.cpp
@@ -259,8 +259,9 @@ public:
Token getNext();
void printError(SMLoc Loc, SourceMgr::DiagKind Kind, const Twine &Message,
- ArrayRef<SMRange> Ranges = None) {
- SM.PrintMessage(Loc, Kind, Message, Ranges, /* FixIts= */ None, ShowColors);
+ ArrayRef<SMRange> Ranges = std::nullopt) {
+ SM.PrintMessage(Loc, Kind, Message, Ranges, /* FixIts= */ std::nullopt,
+ ShowColors);
}
void setError(const Twine &Message, StringRef::iterator Position) {
@@ -771,7 +772,7 @@ llvm::Optional<bool> yaml::parseBool(StringRef S) {
case 'N':
return false;
default:
- return None;
+ return std::nullopt;
}
case 2:
switch (S.front()) {
@@ -782,7 +783,7 @@ llvm::Optional<bool> yaml::parseBool(StringRef S) {
case 'o':
if (S[1] == 'n') //[Oo]n
return true;
- return None;
+ return std::nullopt;
case 'N':
if (S[1] == 'O') // NO
return false;
@@ -790,9 +791,9 @@ llvm::Optional<bool> yaml::parseBool(StringRef S) {
case 'n':
if (S[1] == 'o') //[Nn]o
return false;
- return None;
+ return std::nullopt;
default:
- return None;
+ return std::nullopt;
}
case 3:
switch (S.front()) {
@@ -803,7 +804,7 @@ llvm::Optional<bool> yaml::parseBool(StringRef S) {
case 'o':
if (S.drop_front() == "ff") //[Oo]ff
return false;
- return None;
+ return std::nullopt;
case 'Y':
if (S.drop_front() == "ES") // YES
return true;
@@ -811,9 +812,9 @@ llvm::Optional<bool> yaml::parseBool(StringRef S) {
case 'y':
if (S.drop_front() == "es") //[Yy]es
return true;
- return None;
+ return std::nullopt;
default:
- return None;
+ return std::nullopt;
}
case 4:
switch (S.front()) {
@@ -824,9 +825,9 @@ llvm::Optional<bool> yaml::parseBool(StringRef S) {
case 't':
if (S.drop_front() == "rue") //[Tt]rue
return true;
- return None;
+ return std::nullopt;
default:
- return None;
+ return std::nullopt;
}
case 5:
switch (S.front()) {
@@ -837,12 +838,12 @@ llvm::Optional<bool> yaml::parseBool(StringRef S) {
case 'f':
if (S.drop_front() == "alse") //[Ff]alse
return false;
- return None;
+ return std::nullopt;
default:
- return None;
+ return std::nullopt;
}
default:
- return None;
+ return std::nullopt;
}
}