New loplugin:unoaggregation

Desktop / LibreOffice - Stephan Bergmann [] - 20 January 2023 20:26 UTC

"Find classes that derive from css::uno::XAggregation, but which implement queryInterface in violation of the protocol laid out in the documentation at udkapi/com/sun/star/uno/XAggregation.idl (which implies that such a class either doesn't actually make use of the deprecated XAggregation mechanism, which should thus be removed from that class hierarchy, or that its implementation of queryInterface needs to be fixed)." (compilerplugins/clang/unoaggregation.cxx)

The basesHaveOnlyPureQueryInterface check in compilerplugins/clang/unoaggregation.cxx is "a crude approximation (but which appears to work OK)" to filter out any queryInterface base implementations of class hierarchies supporting XAggregation (i.e., cppu::OWeakAggObject::queryInterface). It only fails for the odd ChartDocumentWrapper::queryInterface, which manually implements the XAggregation functionality rather than (indirectly) deriving from OWeakAggObject. But changing that manual implementation looks tricky, so leave that alone for now and add a loplugin warning suppression there, and leave proper clean up for later.

Change-Id: Ib16e26237bd703e60b0d9cb7134cb39840842d54 Reviewed-on:

022085ece414 New loplugin:unoaggregation
.../chartapiwrapper/ChartDocumentWrapper.cxx | 1 +
compilerplugins/clang/check.cxx | 4 +-
compilerplugins/clang/check.hxx | 5 +-
compilerplugins/clang/test/unoaggregation.cxx | 42 ++++
compilerplugins/clang/unoaggregation.cxx | 215 +++++++++++++++++++++
solenv/ | 1 +
6 files changed, 264 insertions(+), 4 deletions(-)


  • Share