Skip to content

Fix incorrect compiler type with USE_CLANG_CL on windows. - #858

Open
UebelAndre wants to merge 2 commits into
bazelbuild:mainfrom
UebelAndre:dump
Open

Fix incorrect compiler type with USE_CLANG_CL on windows.#858
UebelAndre wants to merge 2 commits into
bazelbuild:mainfrom
UebelAndre:dump

Conversation

@UebelAndre

@UebelAndre UebelAndre commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

This change affects the auto configured toolchains which was setting the incorrect toolchain type when --repo_env=USE_CLANG_CL=1 is set.

@UebelAndre
UebelAndre marked this pull request as ready for review August 30, 2026 18:25
@UebelAndre

Copy link
Copy Markdown
Contributor Author

CI will need an approval.

Comment thread cc/private/toolchain/BUILD.windows.tpl Outdated
name = "msvc_x64",
cpu = "x64_windows",
compiler = "msvc-cl",
compiler = "%{msvc_compiler_x64}",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possibly naive question: what is the point of the arch suffix on these template variables?

AFAICT this is only ever set to msvc-cl or clang-cl based on the repo_env.

Additionally since one possible value is "clang-cl" can this just be "%{compiler}"?

@UebelAndre UebelAndre Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was mostly trying to follow the current precedent by the other template variables which are arch specific for the naming but since the compiler is common I chose an arbitrary one. Refactored this to use %{compiler} and operate outside of the cpu branches.

Comment thread tests/compiler_settings/main.cc Outdated
// clang-cl while it still declares itself msvc-cl.
#if defined(_MSC_VER)
#if defined(__clang__)
static_assert(StrEq(kDeclaredCompiler, "clang-cl"),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could this be an issue with how clang versions binaries with like clang-21?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I relaxed this, let me know what you think!

@UebelAndre
UebelAndre requested review from keith and trybka August 31, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants