C++ Logo

sg15

Advanced search

Re: [isocpp-sg15] P2977R2: Build database files

From: Boris Kolpackov <boris_at_[hidden]>
Date: Tue, 29 Oct 2024 15:49:20 +0200
Ben Boeckel <ben.boeckel_at_[hidden]> writes:

> I suspect compile commands will still be *useful* for simple things like
> `clang-tidy` (when the build is using a compatible `clang` compiler), but
> not if one is doing things like `clang-tidy` on a `gcc` build (as
> `clang-tidy` would need to discover how to make its own BMIs instead of the
> `gcc`-flavored BMIs the build is going to use.

If the compilation database also includes the command lines for
compiling all the BMIs used by a project, then a tool could
conceivably figure out how to build its own BMI versions. We
have a mode like this in build2: dump BMI command lines for
dependencies but other TUs only for this project.


> I still don't know what a command line would look like for such a
> thing though.

My current thinking is that a header command line should be derived
from a library/executable to which it belongs (at least in build2
headers are prerequisites of libraries/executables so we can
establish this relationship). And "derive" probably would mean
"as if we compiled an imaginary TU of this library/executable".

Received on 2024-10-29 13:48:21