[clang-tools-extra] [clangd] Log environment variables that influence compilation at startup (PR #204990)

via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 21 09:37:34 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- clang-tools-extra/clangd/tool/ClangdMain.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp
index af6022856..13fe4d391 100644
--- a/clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -916,10 +916,18 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var
   // This helps diagnose missing-include issues, especially on Windows.
   for (const char *EnvVar : {
            // MSVC environment variables (set by vcvarsall.bat)
-           "INCLUDE", "LIB", "LIBPATH", "CL", "_CL_",
+           "INCLUDE",
+           "LIB",
+           "LIBPATH",
+           "CL",
+           "_CL_",
            // GCC/Clang environment variables
-           "CPATH", "C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH",
-           "OBJC_INCLUDE_PATH", "LIBRARY_PATH", "GCC_EXEC_PREFIX",
+           "CPATH",
+           "C_INCLUDE_PATH",
+           "CPLUS_INCLUDE_PATH",
+           "OBJC_INCLUDE_PATH",
+           "LIBRARY_PATH",
+           "GCC_EXEC_PREFIX",
        }) {
     if (auto Val = llvm::sys::Process::GetEnv(EnvVar))
       log("Env {0}: {1}", EnvVar, *Val);

``````````

</details>


https://github.com/llvm/llvm-project/pull/204990


More information about the cfe-commits mailing list