Sarcasm / compdb

The compilation database Swiss army knife
MIT License
292 stars 23 forks source link

General question about how this works #18

Closed unphased closed 4 years ago

unphased commented 4 years ago

It's clear that this tool has a single very useful functionality, which is to generate the header file entries for compile_commands.json compilation databases.

I guess I'm just pushing the boundaries here but it looks to me like it will limit the headers pulled to the headers within the provided project directory, and I'm curious if there is a way to configure it to include more headers.

Sometimes I would prefer to explore the standard library or other dependencies that lie outside of the project tree. I might even want to dig into the libc++/libstdc++. Although that would definitely not be desirable the vast majority of the time.

So my question is, could I hack this somehow, or is it a rigid limitation?

For example when I have /usr/include/boost/geometry/algorithms/detail/overlay/follow.hpp open, ccls complains that it cannot find the overlay_type type, which is in a very easy to find location /usr/include/boost/geometry/algorithms/detail/overlay/overlay_type.hpp. The reason that it cannot find this type is presumably because nothing in boost got included when I generated my compile_commands.json with compdb.

Sarcasm commented 4 years ago

The list of include dirs is just the paths added by -I, so system header aren't searched.

You could try to tweak that here: https://github.com/Sarcasm/compdb/blob/6879a78f48c3b57346379a0fdee82cc5d5829c97/compdb/complementer/headerdb.py#L88

I would be curious to know if the parser can find its way in the boost headers.

Although, in your case, if Boost is installed in the standard location /usr/include, then I think ccls should find the headers, and your issue may be something else.

unphased commented 4 years ago

Thanks for your answer. I think it answers my question well enough that I'll close the issue. I'm prioritizing more now on the integration of compdb into my compiling flow so that I can update the compilation database after performing an incremental build.