rizsotto / scan-build

Clang's scan-build re-implementation in python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flag for generating "command" instead of "arguments"

LiSongMWO opened this issue · comments

I use intercept-build for irony-mode in emacs in a multi-arch project where different files need to be compiled with different compilers.

One of the archs is AVR and it needs to be compiled with avr-gcc to get all the SFR stuff in.

For this purpose I would i like to have a flag for intercept-build that generates a "command" entry in the compilation database for each file instead of "arguments" list as this would to my understanding allow irony-mode to work for me. I realise other functionality of scan-build would not work but they wouldn't work anyway without the right compiler.

Thanks for the report.
First I would recommend to use my other project Bear to generate the compilation database. (Use scan-build only if you are facing with difficulties on your OS to run bear.)
But neither of these tools are creating compilation database with command attribute for an entry. There are several drawbacks to do that. Besides, the compilation database specification allows to use arguments for many years. Therefore I would recommend to open issue on irony-mode to support the compilation database specification. (I would be surprised if it does not support it already.)
Your other option could be to use a tool to convert the compilation database. (You can write one easy.)

I think you misunderstood me, irony mode supports the spec, but args contains no info about which compiler should be used where command does. I'm also not asking to change the default to allow generating this alternate form.

Thanks to come back. I am not aware that there would be any difference between the content of arguments and command fields. (If want to original compiler name, that's nothing to do what field contains it.)
To solve this problem, I would recommend the Bear tool version 2.3.12 (will be released soon) which emits the original compiler name. Or still recommend to write a small python script to transform the compilation database and replace the compiler name to the desired one.