[Qbs] Tighter clang tooling integration

Christian Kandeler christian.kandeler at qt.io
Tue Nov 21 10:46:06 CET 2017


On Tue, 21 Nov 2017 18:01:32 +1300
Christian Gagneraud <chgans at gmail.com> wrote:

> Qbs can generate a clang compilation database.
> Some (most) clang-based tools are not multi-cpu aware.
> 
> For example a typical use of clang-check is
> cd repo.git
> qbs generate -g clangdb profile:someprofile # or cmake 
> -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
> find path/to/some/code -name '*.cpp' | xargs clang-check -analyze 
> -p=someprofile
> 
> There are a few annoying things with this:
> - First you need to give clang-check which file you want to check
> - clang-check will process all the files one after another, even if you 
> have multi CPU

This one you can probably work around, e.g. using GNU parallel.

> - find path/to/some/code -name '*.cpp' might retun files that should not 
> be compiled.
> 
> Wouldn't it be nice if we could ask qbs to run a clang-based tools on 
> all the source files and with proper load distribution?
> 
> Is this something that looks doable? Is it even wanted?

This has come up before. It looked deceptively tempting at first to just set the compiler to the clang tool and then "build" as normal, but upon closer inspection, there were some issues. The most obvious one would be that you'd have to somehow stop after the "compile" step, but there were others as well (I forgot the details). If you play around a bit in that area (perhaps with a dedicated module?), you'll probably get more insight into where the problems lie.


Christian



More information about the Qbs mailing list