xmllmx
xmllmx

Reputation: 42275

What's the difference between "Clang with Microsoft CodeGen" and "LLVM-vs2014"?

Under Visual Studio 2015 or later, we can use clang in two ways:

  1. Select Clang with Microsoft CodeGen as the Platform Toolset;

  2. Install LLVM-3.8-win64.exe, and select LLVM-vs2014 as the Platform 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:

  1. I can debug a program built by Clang with Microsoft CodeGen step by step as VC++ does;

  2. 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

Answers (1)

arrowd
arrowd

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

Related Questions