aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/lib/Tooling/Transformer/Parsing.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/clang/lib/Tooling/Transformer/Parsing.cpp')
-rw-r--r--contrib/llvm-project/clang/lib/Tooling/Transformer/Parsing.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/contrib/llvm-project/clang/lib/Tooling/Transformer/Parsing.cpp b/contrib/llvm-project/clang/lib/Tooling/Transformer/Parsing.cpp
index 66fa04a15594..53a78e8df22a 100644
--- a/contrib/llvm-project/clang/lib/Tooling/Transformer/Parsing.cpp
+++ b/contrib/llvm-project/clang/lib/Tooling/Transformer/Parsing.cpp
@@ -14,11 +14,11 @@
#include "clang/Lex/Lexer.h"
#include "clang/Tooling/Transformer/RangeSelector.h"
#include "clang/Tooling/Transformer/SourceCode.h"
-#include "llvm/ADT/None.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Error.h"
+#include <optional>
#include <string>
#include <utility>
#include <vector>
@@ -33,7 +33,6 @@ using namespace transformer;
// much as possible with the AST Matchers parsing.
namespace {
-using llvm::Error;
using llvm::Expected;
template <typename... Ts> using RangeSelectorOp = RangeSelector (*)(Ts...);
@@ -47,7 +46,7 @@ struct ParseState {
};
// Represents an intermediate result returned by a parsing function. Functions
-// that don't generate values should use `llvm::None`
+// that don't generate values should use `std::nullopt`
template <typename ResultType> struct ParseProgress {
ParseState State;
// Intermediate result generated by the Parser.
@@ -121,11 +120,11 @@ getBinaryRangeSelectors() {
}
template <typename Element>
-llvm::Optional<Element> findOptional(const llvm::StringMap<Element> &Map,
- llvm::StringRef Key) {
+std::optional<Element> findOptional(const llvm::StringMap<Element> &Map,
+ llvm::StringRef Key) {
auto it = Map.find(Key);
if (it == Map.end())
- return llvm::None;
+ return std::nullopt;
return it->second;
}
@@ -153,19 +152,19 @@ static StringRef consumeWhitespace(StringRef S) {
// Parses a single expected character \c c from \c State, skipping preceding
// whitespace. Error if the expected character isn't found.
-static ExpectedProgress<llvm::NoneType> parseChar(char c, ParseState State) {
+static ExpectedProgress<std::nullopt_t> parseChar(char c, ParseState State) {
State.Input = consumeWhitespace(State.Input);
if (State.Input.empty() || State.Input.front() != c)
return makeParseError(State,
("expected char not found: " + llvm::Twine(c)).str());
- return makeParseProgress(advance(State, 1), llvm::None);
+ return makeParseProgress(advance(State, 1), std::nullopt);
}
// Parses an identitifer "token" -- handles preceding whitespace.
static ExpectedProgress<std::string> parseId(ParseState State) {
State.Input = consumeWhitespace(State.Input);
auto Id = State.Input.take_while(
- [](char c) { return isASCII(c) && isIdentifierBody(c); });
+ [](char c) { return isASCII(c) && isAsciiIdentifierContinue(c); });
if (Id.empty())
return makeParseError(State, "failed to parse name");
return makeParseProgress(advance(State, Id.size()), Id.str());