summaryrefslogtreecommitdiff
path: root/clang-tools-extra/pseudo
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2022-12-03 11:54:50 -0800
committerKazu Hirata <kazu@google.com>2022-12-03 11:54:50 -0800
commit059a23c0f01fd6e5bcef0e403d8108a761ad66f5 (patch)
treefa6e0cf4e0e4bcd36fc8bb3e634a4bbaac77bb3a /clang-tools-extra/pseudo
parentcd8702efe7e6cacfd82cc4909e42718224bcd5d0 (diff)
downloadllvm-059a23c0f01fd6e5bcef0e403d8108a761ad66f5.tar.gz
[clang-tools-extra] 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 'clang-tools-extra/pseudo')
-rw-r--r--clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h2
-rw-r--r--clang-tools-extra/pseudo/lib/DirectiveTree.cpp8
-rw-r--r--clang-tools-extra/pseudo/lib/Forest.cpp4
-rw-r--r--clang-tools-extra/pseudo/lib/grammar/Grammar.cpp2
4 files changed, 8 insertions, 8 deletions
diff --git a/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h b/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h
index fc21eff35792..ac911be45de9 100644
--- a/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h
+++ b/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h
@@ -222,7 +222,7 @@ private:
Word KeyMask = Word(1) << (Key % WordBits);
unsigned KeyWord = Key / WordBits;
if ((HasValue[KeyWord] & KeyMask) == 0)
- return llvm::None;
+ return std::nullopt;
// Count the number of values since the checkpoint.
Word BelowKeyMask = KeyMask - 1;
unsigned CountSinceCheckpoint =
diff --git a/clang-tools-extra/pseudo/lib/DirectiveTree.cpp b/clang-tools-extra/pseudo/lib/DirectiveTree.cpp
index c9e0198227fa..2d0199c63099 100644
--- a/clang-tools-extra/pseudo/lib/DirectiveTree.cpp
+++ b/clang-tools-extra/pseudo/lib/DirectiveTree.cpp
@@ -92,7 +92,7 @@ private:
Tree->Chunks.push_back(std::move(Directive));
}
}
- return None;
+ return std::nullopt;
}
// Parse the rest of a conditional section, after seeing the If directive.
@@ -292,7 +292,7 @@ private:
case clang::tok::pp_else:
return true;
default: // #ifdef etc
- return llvm::None;
+ return std::nullopt;
}
const auto &Tokens = Code.tokens(Dir.Tokens);
@@ -301,11 +301,11 @@ private:
const Token &Value = Name.nextNC();
// Does the condition consist of exactly one token?
if (&Value >= Tokens.end() || &Value.nextNC() < Tokens.end())
- return llvm::None;
+ return std::nullopt;
return llvm::StringSwitch<llvm::Optional<bool>>(Value.text())
.Cases("true", "1", true)
.Cases("false", "0", false)
- .Default(llvm::None);
+ .Default(std::nullopt);
}
const TokenStream &Code;
diff --git a/clang-tools-extra/pseudo/lib/Forest.cpp b/clang-tools-extra/pseudo/lib/Forest.cpp
index 131dd4dca839..d24a90fd1fe0 100644
--- a/clang-tools-extra/pseudo/lib/Forest.cpp
+++ b/clang-tools-extra/pseudo/lib/Forest.cpp
@@ -167,12 +167,12 @@ std::string ForestNode::dumpRecursive(const Grammar &G,
LineDec.Subsequent = "│ ";
}
Dump(Children[I], P->kind() == Sequence ? EndOfElement(I) : End,
- llvm::None, LineDec);
+ std::nullopt, LineDec);
}
LineDec.Prefix.resize(OldPrefixSize);
};
LineDecoration LineDec;
- Dump(this, KEnd, llvm::None, LineDec);
+ Dump(this, KEnd, std::nullopt, LineDec);
return Result;
}
diff --git a/clang-tools-extra/pseudo/lib/grammar/Grammar.cpp b/clang-tools-extra/pseudo/lib/grammar/Grammar.cpp
index 19fefac206b7..8c1338cff037 100644
--- a/clang-tools-extra/pseudo/lib/grammar/Grammar.cpp
+++ b/clang-tools-extra/pseudo/lib/grammar/Grammar.cpp
@@ -51,7 +51,7 @@ llvm::Optional<SymbolID> Grammar::findNonterminal(llvm::StringRef Name) const {
[&](const GrammarTable::Nonterminal &X) { return X.Name < Name; });
if (It != T->Nonterminals.end() && It->Name == Name)
return It - T->Nonterminals.begin();
- return llvm::None;
+ return std::nullopt;
}
std::string Grammar::dumpRule(RuleID RID) const {