JSON Compilation Database exported from Qt Creator 4.9-beta1 is unsupported #666
Comments
Hi @aportale, thanks for posting this issue. I'm just setting up a testing environment for QT Creator 4.8 to get to a state where we can reproduce your issue. We'll keep you posted on our progress. BTW: Congrats to your issue ID ;) |
We just tested this on the code of our qtc-sourcetrail extension for the qt creator and everything is working fine. So we have not been able to reproduce your issue. Can you please try to
|
However, it is nice to know that the QT Creator now provides this option. I added #668 to keep our users informed. |
I must admit that I generated the compile_commands.json in Qt Creator 4.9-beta1, which then caused the reported issue. But genertaing it now with Qt Creator 4.8, I can confirm that loading that .json file in Sourcetrail it works! Sorry for being unspecific. Good to know that there is such a difference in the exported json files between Qt Creator versions. I will dig around in Qt Creator to find out what the differences are and if there is something to be done to generate files that Sourcetrail accepts. Anyways, here the details of what goes wrong with the Qt Creator 4.9-beta1 generated compile_commands.json: I opened qtc-sourcetrail and generated compile_commands.json.txt. In Sourcetrail, I got then these error messages after importing the .json: PS: Usually I wait to catch that ID, but until now never managed to :) |
I created a Qt Creator task for this issue |
Thank you for taking a deeper look. I just tried to manually add the To make sure that it is not just an issue with Sourcetrail I also tried to feed the same json file to clang-tidy and I get the same issues. This is what the console output looks like:
In Sourcetrail I get some additional errors that look like this:
This would also explain the |
--driver-mode=cl is only used in combination with msvc-style flags. So it's not a surprise that it generates errors with gcc-style command line. I think you can parse Qt Creator 4.9 command line with the current clang 8 or master because it uses "/clang:" prefix to pass some gcc-style options while the cl driver mode is activated. This option was introduced in https://reviews.llvm.org/D53457 (commit https://reviews.llvm.org/rC346393) |
@yvvan, thanks for joining in. So do I understand it correctly that whenever you use the
or
? I just tested the second style with an older version of clang-tidy (5.0.0) and the
is gone from the console output. |
@mlangkabel |
FYI, @yvvan modified the JSON Compilation Database export in Qt Creator 4.9 to match the traditional style. https://codereview.qt-project.org/255604/ I am happy :) Shall we close this? |
Well, supporting such flags could anyways be an improvement for Sourcetrail :) |
Nice to hear that Qt Creator 4.9 is fixed! Ok, just tested this again and it is looking quite good:
-> If I use this converted compilation database with Sourcetrail, it works without an error :) Thanks for closing this issue and also thank you both for your explanation regarding this whole issue! |
Good, some notes:
|
any implementation for the import-export database Android? |
Since Version 4.8, Qt Creator supports exporting and importing of JSON Compilation Databases. Theoretically, this is the missing link to pass a project from Qt Creator to Sourcetrail.
However, there are two flavors of compilation databases: those with "arguments" lists and those with "command" values. Qt Creator exports the prior format and Sourcetrail seems to import the latter. That means that Qt Creator and Sourcetrail can currently not interoperate.
Certainly, Qt Creator can/will allow the user to select one of the two formats for compilation database export in a future version. But I believe, it would also make sense to let Sourcetrail import the "arguments" variant.
The text was updated successfully, but these errors were encountered: