[clang-tools-extra] 062b5c5 - [clangd] Set the User option for clang-tidy to mimick its behaviour
Nathan James via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 6 11:58:33 PST 2020
Author: Nathan James
Date: 2020-11-06T19:58:21Z
New Revision: 062b5c598f21c1591b10362219e3c89e934367b0
URL: https://github.com/llvm/llvm-project/commit/062b5c598f21c1591b10362219e3c89e934367b0
DIFF: https://github.com/llvm/llvm-project/commit/062b5c598f21c1591b10362219e3c89e934367b0.diff
LOG: [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
Added:
Modified:
clang-tools-extra/clangd/tool/ClangdMain.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp
index ae5b16ebce7f..08d498f30873 100644
--- a/clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -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;
More information about the cfe-commits
mailing list