rizsotto / Bear

Bear is a tool that generates a compilation database for clang tooling.
GNU General Public License v3.0
4.76k stars 312 forks source link

[Feature Request] An option to filter out some compiler commands / cross compilation #459

Closed Havner closed 2 years ago

Havner commented 2 years ago

I recently used bear to generate compile commands for a cross compiled project. They generated fine, without any issues, but neither CCLS nor CLANGD wanted to work with them. The latter gave some hints in the logs and the issue was that it wouldn't work with "-march=NON_NATIVE_ARCH". After I removed "-march" and "-mthumb" from compiled_commands.json, everything started to work.

I do realize that it's not an issue with bear in any way, hence I treat it as a feature request. To make some configurable compiler options that would be filtered out from the resulting file? Maybe some regexp based filters that would be even able to modify the resulting options/paths?

Regards and thanks for this tool. Can't say how many times it saved my ass :-)

rizsotto commented 2 years ago

Hi @Havner , thanks for your message. I'm glad to hear that you find this tool useful for your work. :)

Just to confirm, if I understand well your feature request: you would like to filter out certain compiler flags from the final compilation database. Have you looked into citnames command's configuration options? That allows you to specify the exact compiler flag you wish to replace. (I understand that's not a regexp like filtering. But would that help you for a short term?)

rizsotto commented 2 years ago

Missing feedback, I'm closing it now.