Is it possible to use a newer clang-cl than MS publishes with VS2022?

I’m encountering a compiler bug that causes a crash in the current 16.0.5 version of clang-cl that’s bundled with VS2022. I checked via Compiler Explorer and the crash has been fixed in 17.0.1, but MS hasn’t seen fit to ship binaries for v17+ yet.

As far as I know, clang-cl isn’t a black-box internal MS fork of clang, just a different build. Is it possible to get a newer version (from… somewhere?) and manually put it into the right bin folder(s)?

Yes you can download the binaries from github and just point Visual Studio to your installation. Instructions are on MSDN:

Clang/LLVM support in Visual Studio projects | Microsoft Learn

1 Like

Those instructions only explain how to switch between versions currently bundled with MSVC. They say nothing about how to install a later version of clang-cl (not clang) than they have bundled.

Edit: I’m a blind idiot. See below.

Did you read the header called “Set a custom LLVM location and toolset”

1 Like

Okay, picture me with a very sheepish look on my face. I have no idea how I managed to scroll past that. :sweat_smile: I have no excuse. Thanks, and sorry for doubting!

Also, wow, that’s reaaallly easy to do! Kind of amazing, I don’t usually expect dev stuff to just slide into place like that. Very nice!

Thanks again!

3 Likes