Skip to content

Feature Request: add new ways to find compile flags for header files that don't have a sibling #1063

@Fabbi

Description

@Fabbi

We wrote a bit about this in PR #1035 so I thought I'd make a feature request instead of hijacking the PR-thread.

Basically the Idea is to search for entries that include the header file and use their compile commands to parse the header file.

For context check the PR #1035 .

I am also not sure what "search for the nearest source file in db" means.

this means that you search for the next source file that is nearest in the file hierarchy.
If you search for /foo/bar/baz/asd.hpp and find no /foo/bar/baz/asd.c[pp] and no file that includes this file, you search for a /foo/bar/baz/*.c[pp], then /foo/bar/*.c[pp], then /foo/bar/**/*.c[pp] and so on..

Do you have an example that would look for a source file that includes the requested header?

I don't have a good example as every entry has the include flag -I <...>/include, so searching for <...>/include/geometry/linesegment.hpp collects every entry and sorts them by "distance".
It obviously would be better if we could search for a file that actually #include's the header file, but for that we'd need to build some sort of include-tree or something like that.
A quick google yields a way to find all #includes in a file with libclang that could be used?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions