Integrate LLVM Clang 4.x.x / 5.x.x / 6.x.x into Visual Studio 2017

前端 未结 7 922
南笙
南笙 2020-12-23 18:40

The official LLVM 4.0 build for Windows integrates with Visual Studio up to Visual Studio 2015. Unfortunately it still doesn\'t support Visual Studio 2017.

When you

7条回答
  •  鱼传尺愫
    2020-12-23 19:10

    I have figured out how to integrate LLVM Clang 7.0 with Visual Studio 2017 update 15.5.6. v1913 with full support for PDB based debugging using the latest LLVM builds.

    i.e., lld-link /DEBUG:GHASH; clang-cl -mllvm -emit-codeview-ghash-section flag to clang-cl.

    It is a three step process.

    1. Install latest llvm
    2. Update the toolset.props, toolset.targets in VS to support latest clang
    3. Select the new toolset to use for building your C/C++ or other lang project

    As of Visual Studio 2017 update 15.4.5 the Microsoft "experimental" Clang C2 no longer works. Thus, the above fixes are necessary to use clang to compile code that has full PDB (not just CodeView /Z7 limited) debuggability. This also now becomes a more complete suite for portability testing cross-platform builds since you can build and PDB debug for windows using all LLVM components from the clang compiler front end to the LLVM codegen backend and LLVM linker.

    Cheers, David

提交回复
热议问题