summaryrefslogtreecommitdiff
path: root/clang-tools-extra/clangd/TidyProvider.cpp
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@quicinc.com>2022-12-06 09:53:37 -0800
committerKrzysztof Parzyszek <kparzysz@quicinc.com>2022-12-06 09:56:14 -0800
commit3c255f679c90e332fe0b38b09d5811a64db3f0f6 (patch)
tree824a5b686ddb65c32accffd5e60b394700d61947 /clang-tools-extra/clangd/TidyProvider.cpp
parentaa6ea6009fc50b02dbf3788ee9fe605081b154f6 (diff)
downloadllvm-3c255f679c90e332fe0b38b09d5811a64db3f0f6.tar.gz
Process: convert Optional to std::optional
This applies to GetEnv and FindInEnvPath.
Diffstat (limited to 'clang-tools-extra/clangd/TidyProvider.cpp')
-rw-r--r--clang-tools-extra/clangd/TidyProvider.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/clang-tools-extra/clangd/TidyProvider.cpp b/clang-tools-extra/clangd/TidyProvider.cpp
index a0a37e86ba01..7f134d923266 100644
--- a/clang-tools-extra/clangd/TidyProvider.cpp
+++ b/clang-tools-extra/clangd/TidyProvider.cpp
@@ -149,12 +149,13 @@ static void mergeCheckList(llvm::Optional<std::string> &Checks,
TidyProviderRef provideEnvironment() {
static const llvm::Optional<std::string> User = [] {
- llvm::Optional<std::string> Ret = llvm::sys::Process::GetEnv("USER");
+ std::optional<std::string> Ret = llvm::sys::Process::GetEnv("USER");
#ifdef _WIN32
if (!Ret)
- return llvm::sys::Process::GetEnv("USERNAME");
+ Ret = llvm::sys::Process::GetEnv("USERNAME");
#endif
- return Ret;
+ return Ret ? llvm::Optional<std::string>(*Ret)
+ : llvm::Optional<std::string>();
}();
if (User)