[Qt-creator] Qt Creator Clang Code Model with compile_commands.json

Nikolai Kosjar nikolai.kosjar at qt.io
Fri Jun 16 14:58:20 CEST 2017

On 06/16/2017 10:31 AM, Bryan Bennetts wrote:
> Hi guys,
> It was suggested that I redirect my Qt Forum Question
> <https://forum.qt.io/topic/79805/qtcreator-clang-code-model-with-compile_commands-json/4> to
> this mailing list.
> Essentially I am wondering if it is feasible to get the Clang Code Model
> within Qt Creator reading a compile_commands.json file for its
> configuration.

While there is some libclang API to read a compilation database, we do 
not use it. We rely on the information from the project manager plugins 
(qbs, cmake, qmake, ...).

Note that in the general case it's not possible to just forward the 
compiler flags to (lib)clang. While this might work well if your 
compiler is clang or gcc (since clang tries to mimic its interface), 
parse errors in header files might affect you one or the other way.

Still, having an option to rely on compile_commands.json is certainly 
valuable. Please create a suggestion at https://bugreports.qt.io/


More information about the Qt-creator mailing list