Trick-17 / clang-build

Clang-based cross platform build system written in Python
https://clang-build.readthedocs.io
MIT License
8 stars 3 forks source link

Get compilation-database entries from clang instead of writing them ourselves? #135

Open GPMueller opened 3 years ago

GPMueller commented 3 years ago

This is a continuation of issue #109.

I discovered that clang, since version 5.0, contains a -MJ flag which outputs compilation database entries:

-MJ<arg> Write a compilation database entry per input

It is not immediately clear to me how this could/should be used in clang-build and whether that would make sense currently. It seems we would have to use it for each file in the project, and then merge the outputs into a JSON-formatted compilation database, see also https://github.com/Sarcasm/notes/blob/master/dev/compilation-database.rst#clang


It seems that for example gcc does not have this command line option, so maybe it would not be beneficial to let clang do it - we should ideally be able to generate a database for any toolchain.