diff options
Diffstat (limited to 'clang-tools-extra/clangd/TidyProvider.cpp')
-rw-r--r-- | clang-tools-extra/clangd/TidyProvider.cpp | 7 |
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) |