Reputation: 42275
Under Visual Studio 2015 or later, we can use clang in two ways:
Select
Clang with Microsoft CodeGen
as thePlatform Toolset
;Install
LLVM-3.8-win64.exe
, and selectLLVM-vs2014
as thePlatform Toolset
;
I know both of the two ways use the same compiler: clang 3.8
. However, I don't know what the difference is between them.
My experience shows Clang with Microsoft CodeGen
is more debugging-friendily than LLVM-vs2014
. In other words:
I can debug a program built by
Clang with Microsoft CodeGen
step by step as VC++ does;A program built by "LLVM-vs2014" cannot be debugged step by step at source-level, but the program can direct run as expected.
So, my questions are:
Does LLVM-vs2014
not support source-level debugging under Visual Studio?
Is Clang with Microsoft CodeGen
provided by Microsoft only for supporting source-level debugging under Visual Studio?
Upvotes: 8
Views: 2766
Reputation: 34401
I know both of the two ways use the same compiler: clang 3.8. However, I don't know what the difference is between them.
The difference is how they use it.
Clang with Microsoft CodeGen
is using Clang to parse the source into an AST. But then MSVC's code generator kicks in, so anything related to LLVM is not used.
LLVM-vs2014
is fully using Clang, for every compiling stage. It uses LLVM to generate the code. So, no wonder debugging info is not compatible with what Visual Studio expects.
it is important to note, that they both use the same runtime. Clang has clang-cl
mode that enables it to parse Microsoft headers and use their language extensions.
So, the main difference is middle- and back-end stages.
Upvotes: 10