New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can you make the filed "arguments" turn to "command"? #196
Comments
|
Thanks for the feature request! May I ask what is the reason to ask for this? |
|
Thank your for your replay. The reason why I need to use command is because of the Clang Cross Translation Unit project: The script files under the folder can not support field "arguments": I have already adapt "arguments" to "command" by myself on the project: But, do you think it's a good idea to add the field "command" to the compilation database json file? Thanks |
|
Very nice, I agree that the CTU tool shall implement the compilation database interface if it's using it. I would not spend time to repeat history in Bear (and implement the Was planing to write a separate tool which takes a compilation database (CDB), manipulate the entries and write it back to another file. The manipulations can be: filtering entries, change paths to relative to a directory, etc... To convert |
|
Thank you! |
|
I wish this would be reopened as an enhancement... I am using the static analyzer cppcheck and it (silently) assumes the "command" form. It looks like it would probably be easier to update this generator than to change the cppcheck parser. Thank you! |
|
Sure we can reopen this. The solution will be another tool which helps to transform compilation database from one form to another. (Will not be part of |
|
Thank you, and I agree. |
|
Not sure if self-promotion is welcomed here, but writing different output formats is what I'd like to have in https://github.com/Sarcasm/compdb one day, I had in mind something like: This can be added fairly easily I believe. |
|
Hey Guillaume, thanks for the head up! Was not know about your tool. And from its small description looks you are targeting this scenario. (Which I'm glad not to code if that exists elsewhere.) If you could dump a bit more doc around I got a couple of candidate what kind of conversion were asked beside this. Shall I create a ticket on your repo about them? |
Yes please, I would be curious to hear about them. |
|
I stumbled onto this while trying to generate compilation databases for the CTU and for others like me I'd like to point out that the compilation database expected by the XTU scripts can be generated by using intercept-build. |
|
@Shreeasish I don't recommend the Clang version of scan-build. Mainly because it's not released, neither really maintained. (I wrote it, but don't update it anymore.) @Sarcasm created an issue on your compdb repo with the feature ideas. We can continue there. :) |
|
ale is another tool which assumes compile_commands.json uses 'command' rather than 'arguments': https://github.com/w0rp/ale/blob/9d7c48038cbbc696fe2d1e9c4b2d9eff2dd726c3/autoload/ale/c.vim#L175 |
|
FWIW, I've been bitten by this also -- in order to support the "arguments" format I would need to rewrite the tools at https://github.com/btorpey/static to read JSON format, and frankly I have no appetite (nor time) for that. Some of us still prefer plain old text formats ... Hope you'll reconsider. |
|
There is a release candidate on master branch now, which suppose to fix this issue. To have the So instead of just say $ intercept --output commands.json -- make
$ citnames --input commands.json --output compile_commands.json --config config.jsonwhere the content of the {
"compilation": {
},
"output": {
"content": {
"include_only_existing_source": true
},
"format": {
"command_as_array": false,
"drop_output_field": false
}
}
} |
can you make the field "arguments" turn to "command"?
Or add the field "command" to the compilation database json file?
like:
[
{
"directory": "/usr1/developer_codes/workspace/open_source/cppcheck/cppcheck-1.81/build/externals/tinyxml",
"command": "/usr/bin/c++ -DCFGDIR=\"/usr/local/share/CppCheck\" -D_GLIBCXX_DEBUG -I/usr1/developer_codes/workspace/open_source/cppcheck/cppcheck-1.81/build/externals/tinyxml -I/usr1/developer_codes/workspace/open_source/cppcheck/cppcheck-1.81/externals/tinyxml -Wabi -Wcast-qual -Wconversion -Wfloat-equal -Winline -Wmissing-declarations -Wmissing-format-attribute -Woverloaded-virtual -Wpacked -Wredundant-decls -Wshadow -Wsign-promo -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wextra -pedantic -Wno-long-long -Wall -std=c++0x -g -DDEBUG -O0 -o CMakeFiles/tinyxml_objs.dir/tinyxml2.cpp.o -c /usr1/developer_codes/workspace/open_source/cppcheck/cppcheck-1.81/externals/tinyxml/tinyxml2.cpp",
"file": "/usr1/developer_codes/workspace/open_source/cppcheck/cppcheck-1.81/externals/tinyxml/tinyxml2.cpp"
},
]
The text was updated successfully, but these errors were encountered: