[Qbs] Tighter clang tooling integration

Christian Gagneraud chgans at gmail.com
Thu Nov 23 03:57:13 CET 2017


On 22/11/2017 11:17 PM, Christian Kandeler wrote:
> On Wed, 22 Nov 2017 17:42:23 +1300 Christian Gagneraud
> <chgans at gmail.com> wrote:
> 
>> I could maybe use a custom Rule item, one that "transform" every
>> .cpp file into, say a .clazy file (output of clazy on the .cpp
>> file).
> 
> The interesting question here is how to get at the fully expanded
> command lines without code duplication. This code is in the compiler
> rules of the cpp module; that's why it appears that there needs to be
> some tight integration with that module. 

The clang db plugin can do exactly that [1], so what about:

jobqueue.start()
for each project
  for each product
    for each group
      for each source
        command= userCommand(project.ruleCommands(product, source))
        jobqueue.append(makeJob(command))

jobqueue.wait()
...

Or something along these lines, i am not familiar with Qbs internals.

> However, clazy for example
> is really just a compiler, so you can use it already today by simply
> setting cpp.compilerName to "clazy".

OK, clazy might not be the best example, let's consider clang-check or 
clang-tidy then or any other (custom) clang-based tool not designed to 
be run this way.

Chris

[1] 
https://github.com/qbs/qbs/blob/master/src/plugins/generator/clangcompilationdb/clangcompilationdbgenerator.cpp#L70



More information about the Qbs mailing list