I've heard about clang-cl as a "microsoft-flavoured" version of clang but looking at my configuration I'm observing the following:
What are the differences between these versions? (Ultimately I'd like to see if it's worth the effort to add support for clang-cl in my compilation framework)
Additional data:
Calling each of them with -v gives me Target: x86_64-w64-windows-gnu
for the first one and Target: x86_64-pc-windows-msvc
for all the others.
clang
[++
] vs clang-cl
normally only affects the style of command-line arguments. clang
[++
] is GCC-like and is the primary interface. clang-cl
is MSVC-like (MSVC = cl.exe
).
Apparently in MSYS2 Clang it also switches it from MinGW-compatible mode to MSVC-compatible (see --target
below).
You can use both clang
[++
] and clang-cl
to compile MSVC-compatible programs. (Though the former requires knowing what flags to pass, which aren't obvious.) I doubt it makes sense to use clang-cl
to compile non-MSVC-comatible programs (such as MinGW-compatible or not for Windows at all).
The official build of Clang vs MSYS2 Clang affects the default --target=...
(using MSVC ABI and libraries vs MinGW ABI and libraries). This can be seen in clang --version
.
Clang installed by Visual Studio, like the one from Clang's official installer, uses MSVC-compatible --target
by default. I don't know if there's any difference between them.
if it's worth the effort to add support for clang-cl in my compilation framework
If you support MSVC (cl.exe
), then supporting clang-cl
is trivial, because the flags are (mostly?) the same.