Questions tagged [clang-cl]

clang-cl is an alternative command line interface to Clang, which is part of the LLVM project. It is designed for compatibility with Microsoft's cl.exe. Use this tag for problems encountered that are specific to using clang-cl.

clang-cl is an alternative command line interface to Clang. Part of the LLVM project, it is designed for compatibility with Microsoft's Visual C++ compiler, cl.exe.

See the documentation for details on setting up and configuring your system to use it.

46 questions
0
votes
0 answers

Clang - disable using nearby reference to access another reference

When compiling for size on clang, I came across this code that was produced: mov edx, 0xfffffff4 mov eax, 0x10002020[edx] In this case 0x10002020 is a global variable, which is 4 bytes long, yet it is used to access a nearby variable (0xfffffff4 +…
rr432
  • 1
  • 1
0
votes
0 answers

Changing compiler from MSVC to clangCL

We have a project, that has lots of dependencies - third party libraries. We get the source code and build them ourselves. Currently we are using MSVC compiler, but looking into transitioning to using clang-cl (so the one installed through Visual…
user3007875
  • 123
  • 7
0
votes
0 answers

Does Clang support SEH?

Edit: I don't mean SEH I mean asynchronous exception handling. As commented SEH is supported by __try, __except. The following example requires asynchronous exception handling (-EHa) which appears to be not available. I tried the structured…
maybourne
  • 23
  • 5
0
votes
0 answers

Building Win32 C++ GUI programs using clang-cl

I am trying to use LLVM's clang-cl, giving its MSVC compatibility skills a go. I am in Visual Studio and I use CMake for this. I used file below from LLVM project to configure my CMake settings, needed some modifications because my VSCode setup…
meguli
  • 1,426
  • 1
  • 18
  • 35
0
votes
1 answer

lld-link: warning: Cannot use debug info for clang_rt.profile-i386.lib

For easily (hopefully) reproducing this issue, I've created a minimal Github repo. I am trying to get test coverage reporting working using clang, llvm-cov, etc. At one point it was working and I either don't remember what I could've done to cause…
E-rich
  • 9,243
  • 11
  • 48
  • 79
0
votes
0 answers

Is there a way to force CLang to use unaligned load/store x86 instructions?

I'm trying to use CLang in a large Visual Studio project. There's a lot of MS-specific code, including C++/CLI and MStest that can't be compiled with CLang, so it's a mix of libraries compiled by Microsoft compiler (version 17.2 / VS 2022) and…
Sergei Ozerov
  • 460
  • 5
  • 12
0
votes
2 answers

Mixing cl, clang-cl and clang in the same project

Context I am developing a cross-platform project that depends on a highly performance sensitive open-source library. This library supports a number of different compilers, but the most performant version is compiled via clang, due to inline assembly…
blockchaindev
  • 3,134
  • 3
  • 22
  • 30
0
votes
0 answers

clang/clang-cl undefined symbol "__tls_index" (custom CRT implementation)

I'm currently implementing my own CRT using Visual Studio 2022 and clang-cl (12.0.0 (ships with VS now) and 13.0.0) and when using /NODEFAULTLIB I'm getting undefined symbols on certain variables/functions despite implementing them. //…
f4rw3llvv
  • 53
  • 5
0
votes
1 answer

clang-cl error: lld-link : error : undefined symbol: __divti3

When compile int128 division method with clang-cl (Clang-11.0 and MSVC2019), it occurs this error. Code like: __int128 a, b; auto c = a / b; and compiler outputs: 1>lld-link :error : undefined symbol: __divti3 1>>>> referenced by…
X.Zheng
  • 59
  • 6
0
votes
0 answers

Jumping to C++ error works in VSCode when using cl, but not clang-cl (using the -FC flag)

I have the following line for a simple build: cl -FC "../main.cpp" /link /SUBSYSTEM:CONSOLE If there is an error in the program, I can alt/ctrl-click the error, and jump right to it. However, if I change the build line to the following, it doesn't…
Lo-Phi
  • 85
  • 6
0
votes
1 answer

Clang options in VS2019

I am trying the Clang-CL compiler built into VS2019 under Windows 10, but cannot see how to set the compiler options, in particular, long doubles of more than 64-bits. In the Project settings, the Platform Toolset is LLVM (clang-cl). Then in C/C++ >…
user1683586
  • 373
  • 2
  • 12
0
votes
2 answers

Missing ATL::CStringT function in MFC/DLL Builds with Clang/VS-2019

Recently installed the new LLVM/clang-cl toolset in Visual Studio 2019, which is a potentially brilliant addition! However, when building my EXE and DLL files, I get the following error at link time: lld-link : error : undefined symbol:…
Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
0
votes
1 answer

QBS build system, can't initialize environment with vcvars64.bat

I'm trying to implement my own module to build C++ on Windows with clang-cl toolchain as there's no built-in support in QBS right now. I chose to use lld-link instead of microsoft linker, so I have to supply it with all the MS library include paths…
sunny moon
  • 1,313
  • 3
  • 16
  • 30
0
votes
1 answer

What flag do I pass to clang-cl to get time.h, _CSTD, correct wint_t and mbstate_t?

I am trying to compile a large linear algebra package, Trilinos, with clang-cl. I configure it with -DCMAKE_C_COMPILER:FILEPATH='C:/Program Files/LLVM/bin/clang-cl.exe' \ -DCMAKE_CXX_COMPILER:FILEPATH='C:/Program Files/LLVM/bin/clang-cl.exe'…
jrcary
  • 21
  • 4
0
votes
1 answer

How to build clang compiler-rt on Windows linked against dynamic Visual C++ runtimes?

I want to use clang-cl with address sanitizers on Windows. When trying with the prebuilt llvm/clang packages from the official installers, I get linker errors because my application needs linking to the dynamic CRT (/MD) instead of the static CRT…
FourtyTwo
  • 1,616
  • 2
  • 15
  • 43