diff options
author | Kazu Hirata <kazu@google.com> | 2023-01-07 20:19:42 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2023-01-07 20:19:42 -0800 |
commit | f71ffd3b735b4d6ae3c12be1806cdd6205b3b378 (patch) | |
tree | 2f23da30b62520864835b00f063b17f4502cfb29 /clang-tools-extra/clang-query | |
parent | 71f557355ddaea358c43b151de3a0e045aaa0863 (diff) | |
download | llvm-f71ffd3b735b4d6ae3c12be1806cdd6205b3b378.zip llvm-f71ffd3b735b4d6ae3c12be1806cdd6205b3b378.tar.gz llvm-f71ffd3b735b4d6ae3c12be1806cdd6205b3b378.tar.bz2 |
[clang-tools-extra] Use std::optional instead of llvm::Optional (NFC)
This patch replaces (llvm::|)Optional< with std::optional<. I'll post
a separate patch to clean up the "using" declarations, #include
"llvm/ADT/Optional.h", etc.
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/clang-query')
-rw-r--r-- | clang-tools-extra/clang-query/Query.cpp | 2 | ||||
-rw-r--r-- | clang-tools-extra/clang-query/QueryParser.cpp | 2 | ||||
-rw-r--r-- | clang-tools-extra/clang-query/tool/ClangQuery.cpp | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/clang-tools-extra/clang-query/Query.cpp b/clang-tools-extra/clang-query/Query.cpp index d1db851..c436d6f 100644 --- a/clang-tools-extra/clang-query/Query.cpp +++ b/clang-tools-extra/clang-query/Query.cpp @@ -184,7 +184,7 @@ bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const { std::vector<BoundNodes> Matches; DynTypedMatcher MaybeBoundMatcher = Matcher; if (QS.BindRoot) { - llvm::Optional<DynTypedMatcher> M = Matcher.tryBind("root"); + std::optional<DynTypedMatcher> M = Matcher.tryBind("root"); if (M) MaybeBoundMatcher = *M; } diff --git a/clang-tools-extra/clang-query/QueryParser.cpp b/clang-tools-extra/clang-query/QueryParser.cpp index 77621d2..4193362 100644 --- a/clang-tools-extra/clang-query/QueryParser.cpp +++ b/clang-tools-extra/clang-query/QueryParser.cpp @@ -276,7 +276,7 @@ QueryRef QueryParser::doParse() { Diagnostics Diag; auto MatcherSource = Line.ltrim(); auto OrigMatcherSource = MatcherSource; - Optional<DynTypedMatcher> Matcher = Parser::parseMatcherExpression( + std::optional<DynTypedMatcher> Matcher = Parser::parseMatcherExpression( MatcherSource, nullptr, &QS.NamedValues, &Diag); if (!Matcher) { return makeInvalidQueryFromDiagnostics(Diag); diff --git a/clang-tools-extra/clang-query/tool/ClangQuery.cpp b/clang-tools-extra/clang-query/tool/ClangQuery.cpp index 6ba2b1a..da7ac27 100644 --- a/clang-tools-extra/clang-query/tool/ClangQuery.cpp +++ b/clang-tools-extra/clang-query/tool/ClangQuery.cpp @@ -169,7 +169,7 @@ int main(int argc, const char **argv) { LE.setListCompleter([&QS](StringRef Line, size_t Pos) { return QueryParser::complete(Line, Pos, QS); }); - while (llvm::Optional<std::string> Line = LE.readLine()) { + while (std::optional<std::string> Line = LE.readLine()) { QueryRef Q = QueryParser::parse(*Line, QS); Q->run(llvm::outs(), QS); llvm::outs().flush(); |