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

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 6 01:19:15 PST 2020


sammccall accepted this revision.
sammccall added a comment.

Still LG



================
Comment at: clang-tools-extra/clangd/tool/ClangdMain.cpp:812
+    EmptyDefaults.User = llvm::sys::Process::GetEnv("USER");
+    if (!EmptyDefaults.User)
+      EmptyDefaults.User = llvm::sys::Process::GetEnv("USEUSERNAMER");
----------------
njames93 wrote:
> sammccall wrote:
> > 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?)
> 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.
OK. I'd still suggest #ifdefing the USERNAME part, since that's not meaningful in any sense outside windows.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90552/new/

https://reviews.llvm.org/D90552



More information about the cfe-commits mailing list