This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by njames93 on Nov 1 2020, 5:21 AM.

Details

Summary

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

Diff Detail

Event Timeline

njames93 created this revision.Nov 1 2020, 5:21 AM
njames93 requested review of this revision.Nov 1 2020, 5:21 AM
sammccall accepted this revision.Nov 4 2020, 9:19 AM
sammccall added inline comments.
clang-tools-extra/clangd/tool/ClangdMain.cpp
812

do you think we should #ifdef this for windows?

maybe like

User = llvm::sys::Process::GetEnv(
#ifdef _WIN32
"USERNAME"
#else
"USER"
)

(or maybe always query USER but only query USERNAME on windows, or something else?)

813

I think this is meant to be USERNAME?

This revision is now accepted and ready to land.Nov 4 2020, 9:19 AM
njames93 updated this revision to Diff 302871.Nov 4 2020, 9:38 AM
njames93 marked an inline comment as done.

Fix typo.

clang-tools-extra/clangd/tool/ClangdMain.cpp
812

I'm not too sure how nicely that would play when using clang with mingw. given there is no harm in calling both I'd rather ere on the safe side.

813

Bad copy and paste error.

sammccall accepted this revision.Nov 6 2020, 1:19 AM

Still LG

clang-tools-extra/clangd/tool/ClangdMain.cpp
812

OK. I'd still suggest #ifdefing the USERNAME part, since that's not meaningful in any sense outside windows.

njames93 marked 2 inline comments as done.Nov 6 2020, 11:57 AM