Closed alexander-born closed 1 year ago
Hey! Good to hear form you again, Alexander. Thanks--and thanks for reporting.
To get commands for a header-only library you'll need to instead specify a test or binary target that compiles it (search "header-only" in README.md)--but you may already know that.
I've changed the code to issue a warning to that effect and continue on (rather than crashing).
Could I ask you to check the latest for me, just to make sure that it resolves this crash?
Thanks again for reporting and for using this tool! Chris
Yeah, thanks Christoph.
I have a shortcut which runs this tool for the target of the current file I'm in. That's why I happened to start it for a header only library.
I only use this shortcut, when I am new parts of the codebases which I don't have the compile commands for.
Ooh, interesting! Could I ask you to tell me a bit more about what you're up to with the shortcut? (Understanding what you're using this for helps me better sculpt it to match needs.)
(Some hypotheses in my head, which may or may not be right: Perhaps this is about new parts of the codebase, not yet linked into the main build graph? Or maybe it's about about speed, things being too slow to run over the whole build target?)
Basically just convenience for me, as I had all the necessary building blocks anyways.
In my work repos this tool is not integrated (don't ask why...), so I wrote a little bash function
refresh_compile_commands <target> <additional_flags>
This clones/pulls this repo, patches my work repo's WORKSPACE and BUILD file with the necessary setup, runs this tool and cleans up the modifications it did.
Also I am using neovim and wrote a bazel plugin. There is a method to get the target of the current file, which is needed for building/ running debugging tests.
These combined give me the shortcut to run this tool for the target of the current file I'm in.
Normally I run refresh_compile_commands
for //application/foo/... which is sufficient 99% of the time for me.
But sometimes I need the compile commands for a single specific target, because some targets use linktime polymorphism and clangd selects only one implementation for indexing, which is rarely the one I want.
Or the rare case I want compile commands outside of //application/foo/...
Extracting compile commands for //... is too slow and does not work due to all kinds of different toolchains/ configuration necessary to build other targets.
Got it! Thanks for sharing, If there are things we should merge in, please do lmk. Heh, and if there are ways we can help you get this into your work repo, please do lmk. I would be curious to know what's going on there!
Hey,
great tool <3 wanted to report a crash for a header only library.
It only fails when using
exclude_external_sources
orexclude_headers == "external"