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

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 4 09:39:01 PST 2020


njames93 added inline comments.


================
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");
----------------
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.


================
Comment at: clang-tools-extra/clangd/tool/ClangdMain.cpp:813
+    if (!EmptyDefaults.User)
+      EmptyDefaults.User = llvm::sys::Process::GetEnv("USEUSERNAMER");
     tidy::ClangTidyOptions OverrideClangTidyOptions;
----------------
sammccall wrote:
> I think this is meant to be USERNAME?
Bad copy and paste error.


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