https://bugs.kde.org/show_bug.cgi?id=354854

--- Comment #6 from Milian Wolff <m...@milianw.de> ---
To report uses inside SIGNAL()/SLOT() macros, we have multiple options:

- rewrite uses of qFlagLocation based on the string literal argument it gets
passed:
    CallExpr (103) | type: "const char *" (101) | display: "qFlagLocation" |
loc: test.cpp@[(17,5),(17,23)] | isUse
      UnexposedExpr (100) | type: "const char *(*)(const char *)" (101) |
display: "qFlagLocation" | loc: test.cpp@[(17,5),(17,23)] 
        DeclRefExpr (101) | type: "const char *(const char *)" (111) | display:
"qFlagLocation" | loc: test.cpp@[(17,5),(17,23)] | isUse
      UnexposedExpr (100) | type: "const char *" (101) | loc:
test.cpp@[(17,5),(17,23)] 
        StringLiteral (109) | type: "const char [24]" (112) | canonical type:
"char const[24]" (112) | display: ""2mySignal()\000test.cpp:17"" | loc:
test.cpp@[(17,5),(17,23)] 

- rewrite uses of the macros themselves, assuming we get access to its argument

- we could also overwrite the macros as needed using our new qobjectdefs.h
shim.

The oldcpp plugin has some logic for finding the corresponding signal/slot from
a normalized signature afaik, which we can revive for that purpose.

Once that is done we can look at the nice-to-have things:

For Q_PROPERTY we can leverage the static assert trick that Olivier found and
documented here: https://woboq.com/blog/moc-with-clang.html
This would then be followed by a parsing of the string literal and extracting
the getter, setter and notify signal and reporting uses for them.

For Q_PRIVATE_SLOT we could use a custom macro with a special marker attribute.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to