diff options
author | Kazu Hirata <kazu@google.com> | 2023-01-02 15:54:57 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2023-01-02 15:54:57 -0800 |
commit | 9cf4419e2451febf09acdf28c7d52ebf436d3a7e (patch) | |
tree | e5ae17540340d0eac703dee9ca77f8f77b867914 /clang/unittests | |
parent | d2ab0134ed541beec2ff40df49cb7279801bbf16 (diff) | |
download | llvm-9cf4419e2451febf09acdf28c7d52ebf436d3a7e.zip llvm-9cf4419e2451febf09acdf28c7d52ebf436d3a7e.tar.gz llvm-9cf4419e2451febf09acdf28c7d52ebf436d3a7e.tar.bz2 |
[clang] Use std::optional instead of llvm::Optional (NFC)
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/unittests')
-rw-r--r-- | clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp | 3 | ||||
-rw-r--r-- | clang/unittests/libclang/LibclangTest.cpp | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp b/clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp index 53361a1..4ad6f80 100644 --- a/clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp +++ b/clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp @@ -15,6 +15,7 @@ #include <condition_variable> #include <future> #include <mutex> +#include <optional> #include <thread> using namespace llvm; @@ -177,7 +178,7 @@ struct VerifyingConsumer { } // Not locking - caller has to lock Mtx. - llvm::Optional<bool> result() const { + std::optional<bool> result() const { if (ExpectedInitial.empty() && ExpectedNonInitial.empty() && UnexpectedInitial.empty() && UnexpectedNonInitial.empty()) return true; diff --git a/clang/unittests/libclang/LibclangTest.cpp b/clang/unittests/libclang/LibclangTest.cpp index 0845476..809426a 100644 --- a/clang/unittests/libclang/LibclangTest.cpp +++ b/clang/unittests/libclang/LibclangTest.cpp @@ -19,6 +19,7 @@ #include <functional> #include <map> #include <memory> +#include <optional> #include <set> #define DEBUG_TYPE "libclang-test" @@ -934,7 +935,7 @@ void Class1::fun() {} ClangTU = clang_parseTranslationUnit(Index, fileName.c_str(), Args, 1, nullptr, 0, TUFlags); - llvm::Optional<CXCursor> typeRefCsr; + std::optional<CXCursor> typeRefCsr; Traverse([&](CXCursor cursor, CXCursor parent) -> CXChildVisitResult { if (cursor.kind == CXCursor_TypeRef) { typeRefCsr.emplace(cursor); |