[clangd] Set the User option for clang-tidy to mimick its behaviour

Probably not essential as afaik only one check uses this field. but still good to have consistent behaviour.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D90552
This commit is contained in:
Nathan James 2020-11-06 19:58:19 +00:00
parent 18805ea951
commit 062b5c598f
No known key found for this signature in database
GPG Key ID: CC007AFCDA90AA5F
1 changed files with 5 additions and 0 deletions

View File

@ -809,6 +809,11 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var
if (EnableClangTidy) {
auto EmptyDefaults = tidy::ClangTidyOptions::getDefaults();
EmptyDefaults.Checks.reset(); // So we can tell if checks were ever set.
EmptyDefaults.User = llvm::sys::Process::GetEnv("USER");
#ifdef _WIN32
if (!EmptyDefaults.User)
EmptyDefaults.User = llvm::sys::Process::GetEnv("USERNAME");
#endif
tidy::ClangTidyOptions OverrideClangTidyOptions;
if (!ClangTidyChecks.empty())
OverrideClangTidyOptions.Checks = ClangTidyChecks;