Search code examples
visual-studiovisual-studio-2015clang

Generate clang compilation database for a Visual Studio project


Visual Studio was added a lot of support for Clang.

I want to use clang-tidy.exe for a Visual-Studio project. In order to do that I need the JSON "compilation database".

Is there some way to export this database from a visual studio (2015) project?


Solution

  • To export the JSON compilation Database you can use the Clang Power Tools VS extension.

    All you need to do is to select your VS project from Solution Explorer, open the context menu by pressing right-click on it, and then search for Clang Power Tools. In the submenu search for the Export Compilation Database option. The JSON compilation database will be automatically generated for you.

    More details about this feature can be found in this article.

    The extension is compatible with Visual Studio 2015, 2017 and 2019.