diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-05-26 20:42:08 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-05-26 22:33:02 +0200 |
commit | fe6cce01c88d045a1fcf09acf049c34c22299b02 (patch) | |
tree | c118594a43386096bca55179f31b2b61e64dfa48 /oox/source/ole/vbacontrol.cxx | |
parent | b894a3d7f991dd248dfd8935b31da8bccfd130b2 (diff) |
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 <noel.grandin@collabora.co.uk>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'oox/source/ole/vbacontrol.cxx')
-rw-r--r-- | oox/source/ole/vbacontrol.cxx | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx index c48e701e1dae..d0a5952ba486 100644 --- a/oox/source/ole/vbacontrol.cxx +++ b/oox/source/ole/vbacontrol.cxx @@ -279,7 +279,7 @@ ControlModelRef VbaSiteModel::createControlModel( const AxClassTable& rClassTabl } } - if( xCtrlModel.get() ) + if( xCtrlModel ) { // user form controls are AWT models xCtrlModel->setAwtModelMode(); @@ -324,14 +324,14 @@ VbaFormControl::~VbaFormControl() void VbaFormControl::importModelOrStorage( BinaryInputStream& rInStrm, StorageBase& rStrg, const AxClassTable& rClassTable ) { - if( !mxSiteModel.get() ) + if( !mxSiteModel ) return; if( mxSiteModel->isContainer() ) { StorageRef xSubStrg = rStrg.openSubStorage( mxSiteModel->getSubStorageName(), false ); OSL_ENSURE( xSubStrg.get(), "VbaFormControl::importModelOrStorage - cannot find storage for embedded control" ); - if( xSubStrg.get() ) + if( xSubStrg ) importStorage( *xSubStrg, rClassTable ); } else if( !rInStrm.isEof() ) @@ -344,13 +344,13 @@ void VbaFormControl::importModelOrStorage( BinaryInputStream& rInStrm, StorageBa OUString VbaFormControl::getControlName() const { - return mxSiteModel.get() ? mxSiteModel->getName() : OUString(); + return mxSiteModel ? mxSiteModel->getName() : OUString(); } void VbaFormControl::createAndConvert( sal_Int32 nCtrlIndex, const Reference< XNameContainer >& rxParentNC, const ControlConverter& rConv ) const { - if( !(rxParentNC.is() && mxSiteModel.get() && mxCtrlModel.get()) ) + if( !(rxParentNC.is() && mxSiteModel && mxCtrlModel) ) return; try @@ -379,7 +379,7 @@ void VbaFormControl::createAndConvert( sal_Int32 nCtrlIndex, void VbaFormControl::importControlModel( BinaryInputStream& rInStrm, const AxClassTable& rClassTable ) { createControlModel( rClassTable ); - if( mxCtrlModel.get() ) + if( mxCtrlModel ) mxCtrlModel->importBinaryModel( rInStrm ); } @@ -442,7 +442,7 @@ void VbaFormControl::importStorage( StorageBase& rStrg, const AxClassTable& rCla if (elem->getControlType() == API_CONTROL_PAGE) { VbaSiteModelRef xPageSiteRef = control->mxSiteModel; - if ( xPageSiteRef.get() ) + if ( xPageSiteRef ) idToPage[ xPageSiteRef->getId() ] = control; } else @@ -484,7 +484,7 @@ void VbaFormControl::importStorage( StorageBase& rStrg, const AxClassTable& rCla bool VbaFormControl::convertProperties( const Reference< XControlModel >& rxCtrlModel, const ControlConverter& rConv, sal_Int32 nCtrlIndex ) const { - if( rxCtrlModel.is() && mxSiteModel.get() && mxCtrlModel.get() ) + if( rxCtrlModel.is() && mxSiteModel && mxCtrlModel ) { const OUString& rCtrlName = mxSiteModel->getName(); OSL_ENSURE( !rCtrlName.isEmpty(), "VbaFormControl::convertProperties - control without name" ); @@ -524,7 +524,7 @@ bool VbaFormControl::convertProperties( const Reference< XControlModel >& rxCtrl void VbaFormControl::createControlModel( const AxClassTable& rClassTable ) { // derived classes may have created their own control model - if( !mxCtrlModel && mxSiteModel.get() ) + if( !mxCtrlModel && mxSiteModel ) mxCtrlModel = mxSiteModel->createControlModel( rClassTable ); } @@ -603,7 +603,7 @@ void VbaFormControl::finalizeEmbeddedControls() VbaControlNameInserter aInserter( aControlNames ); maControls.forEach( aInserter ); for (auto const& control : maControls) - if( control->mxCtrlModel.get() && (control->mxCtrlModel->getControlType() == API_CONTROL_GROUPBOX) ) + if( control->mxCtrlModel && (control->mxCtrlModel->getControlType() == API_CONTROL_GROUPBOX) ) control->maControls.forEach( aInserter ); /* Reprocess the sorted list and collect all option button controls that @@ -689,13 +689,13 @@ void VbaFormControl::finalizeEmbeddedControls() void VbaFormControl::moveRelative( const AxPairData& rDistance ) { - if( mxSiteModel.get() ) + if( mxSiteModel ) mxSiteModel->moveRelative( rDistance ); } void VbaFormControl::moveEmbeddedToAbsoluteParent() { - if( !(mxSiteModel.get() && !maControls.empty()) ) + if( !(mxSiteModel && !maControls.empty()) ) return; // distance to move is equal to position of this control in its parent @@ -718,8 +718,8 @@ void VbaFormControl::moveEmbeddedToAbsoluteParent() bool VbaFormControl::compareByTabIndex( const VbaFormControlRef& rxLeft, const VbaFormControlRef& rxRight ) { // sort controls without model to the end - sal_Int32 nLeftTabIndex = rxLeft->mxSiteModel.get() ? rxLeft->mxSiteModel->getTabIndex() : SAL_MAX_INT32; - sal_Int32 nRightTabIndex = rxRight->mxSiteModel.get() ? rxRight->mxSiteModel->getTabIndex() : SAL_MAX_INT32; + sal_Int32 nLeftTabIndex = rxLeft->mxSiteModel ? rxLeft->mxSiteModel->getTabIndex() : SAL_MAX_INT32; + sal_Int32 nRightTabIndex = rxRight->mxSiteModel ? rxRight->mxSiteModel->getTabIndex() : SAL_MAX_INT32; return nLeftTabIndex < nRightTabIndex; } |