Qt signal/slots checker impelmentation question


recently I submit patch to review that implement
Qt signal/slot checker:


It basically checks that if you call QObject connect
method, like this:
connect(&send, SIGNAL(f2(int, double*)), &recv, SLOT(onf2(int,

then `decltype(send)` have method `f2` with such signature
and `decltype(recv)` have method `onf2` with matched signature,
plus signatures of `f2` and `onf2` matches each other (actually
param pack of `onf2` should be prefix of param pack of `f2`).

SIGNAL and SLOT macroses convert their arguments to string,
so in the checker I have two string and have to normalize them,
for example convert types of function argument like this:
`int const` -> `int`
`const int` -> `int`

Currently for normalization I use algorithm, similar to Qt:
handed written parser around ~ 200 lines of code (
of course it has some unhandled cases, like handling of `volatile`).

The expected input and output of such normalize algorithm
can be found via patch review URL in file:

And I wonder how many efforts and lines of code will be take
"parse + print in desired way"
inside Checker with libclang help?

By `libclang help` I mean I receive control via
`void checkPostCall(const CallEvent &Call, CheckerContext &C) const`

and I found `connect` call with string like this:
"f(const QString&, QVarint)"

after that I ask libclang parse such forward function declaration:
"extern void f(const QString&, QVariant);"
and use types like `QString` and `QVariant` from current context.

Just fyi: I do believe this would be simpler as a clang tidy check, as it seems to be purely AST based, and doesn’t need path diagnostics.