From fe6cce01c88d045a1fcf09acf049c34c22299b02 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 26 May 2020 20:42:08 +0200 Subject: Fix loplugin:simplifypointertobool for libstdc++ std::shared_ptr ...where the get member function is defined on a std::__shared_ptr base class, so loplugin:simplifypointertobool used to miss those until now. (While e.g. using libc++ on macOS found those cases.) 366d08f2f6d4de922f6099c62bb81b49d89e0a68 "new loplugin:simplifypointertobool" was mistaken in breaking isSmartPointerType(const clang::Type* t) out of isSmartPointerType(const Expr* e); c874294ad9fb178df47c66875bfbdec466e39763 "Fix detection of std::unique_ptr/shared_ptr in loplugin:redundantpointerops" had introduced that indivisible two-step algorithm on purpose. The amount of additional hits (on Linux) apparently asked for turning loplugin:simplifypointertobool into a rewriting plugin. Which in turn showed that the naive adivce to just "drop the get()" is not sufficient in places that are not contextually converted to bool, as those places need to be wrapped in a bool(...) functional cast now. If the expression was already wrapped in parentheses, those could be reused as part of the functional cast, but implementing that showed that such cases are not yet found at all by the existing loplugin:simplifypointertobool. Lets leave that TODO for another commit. Besides the changes to compilerplugins/ itself, this change has been generated fully automatically with the rewriting plugin on Linux. Change-Id: I83107d6f634fc9ac232986f49044d7017df83e2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94888 Reviewed-by: Noel Grandin Reviewed-by: Stephan Bergmann Tested-by: Jenkins --- slideshow/source/engine/animationnodes/generateevent.cxx | 8 ++++---- slideshow/source/engine/slideshowimpl.cxx | 2 +- slideshow/source/engine/transitions/slidetransitionfactory.cxx | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'slideshow/source') diff --git a/slideshow/source/engine/animationnodes/generateevent.cxx b/slideshow/source/engine/animationnodes/generateevent.cxx index b228f041a93e..6d61c0c251e9 100644 --- a/slideshow/source/engine/animationnodes/generateevent.cxx +++ b/slideshow/source/engine/animationnodes/generateevent.cxx @@ -127,7 +127,7 @@ EventSharedPtr generateEvent( case animations::EventTrigger::ON_CLICK: // try to extract XShape event source event2shape(); - if (pShape.get()) + if (pShape) { pEvent = makeDelay( rFunctor, nDelay2 + nAdditionalDelay, @@ -143,7 +143,7 @@ EventSharedPtr generateEvent( case animations::EventTrigger::ON_DBL_CLICK: // try to extract XShape event source event2shape(); - if (pShape.get()) + if (pShape) { pEvent = makeDelay( rFunctor, nDelay2 + nAdditionalDelay, @@ -159,7 +159,7 @@ EventSharedPtr generateEvent( case animations::EventTrigger::ON_MOUSE_ENTER: // try to extract XShape event source event2shape(); - if (pShape.get()) + if (pShape) { pEvent = makeDelay( rFunctor, nDelay2 + nAdditionalDelay, @@ -175,7 +175,7 @@ EventSharedPtr generateEvent( case animations::EventTrigger::ON_MOUSE_LEAVE: // try to extract XShape event source event2shape(); - if (pShape.get()) + if (pShape) { pEvent = makeDelay( rFunctor, nDelay2 + nAdditionalDelay, diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index b06a05bf06b1..ebae0d83276d 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -1808,7 +1808,7 @@ void SlideShowImpl::addShapeEventListener( } // add new listener to broadcaster - if( aIter->second.get() ) + if( aIter->second ) aIter->second->addInterface( xListener ); maEventMultiplexer.notifyShapeListenerAdded(xShape); diff --git a/slideshow/source/engine/transitions/slidetransitionfactory.cxx b/slideshow/source/engine/transitions/slidetransitionfactory.cxx index 66faf10e09b3..3ec2c8089e6f 100644 --- a/slideshow/source/engine/transitions/slidetransitionfactory.cxx +++ b/slideshow/source/engine/transitions/slidetransitionfactory.cxx @@ -924,7 +924,7 @@ NumberAnimationSharedPtr TransitionFactory::createSlideTransition( pSoundPlayer, rEventMultiplexer )); - if( pTransition.get() ) + if( pTransition ) return pTransition; } -- cgit v1.2.3