"Clang with Microsoft CodeGen" 和 "LLVM-vs2014" 有什么区别?

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

在Visual Studio2015或以后,我们可以通过两种方式使用clang:

  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;

我知道这两种方式都使用相同的编译器:clang 3.8。但是,我不知道它们之间有什么区别。

我的经验表明 Clang with Microsoft CodeGenLLVM-vs2014 更易于调试。换句话说:

  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.

所以,我的问题是:

LLVM-vs2014是否不支持Visual Studio下的源代码级调试?

微软提供Clang with Microsoft CodeGen只是为了支持Visual Studio下的源码级调试吗?

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.

区别在于他们如何使用它。

Clang with Microsoft CodeGen 正在使用 Clang 将源代码解析 为 AST。但是随后 MSVC 的代码生成器开始运行,所以与 LLVM 相关的任何东西都没有被使用。

LLVM-vs2014 在每个编译阶段都完全使用 Clang。它使用 LLVM 生成代码。所以,难怪调试信息与 Visual Studio 期望的不兼容。

请务必注意,它们都使用相同的运行时。 Clang 具有 clang-cl 模式,使其能够解析 Microsoft headers 并使用他们的语言扩展。

因此,主要区别在于中期和 back-end 阶段。