[Libreoffice-commits] core.git: chart2/source compilerplugins/clang connectivity/source dbaccess/source include/dbaccess reportdesign/inc sw/source writerfilter/source xmloff/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 9 05:46:20 UTC 2019


 chart2/source/controller/main/ChartController_Insert.cxx   |    4 +--
 chart2/source/controller/main/ChartController_Position.cxx |    2 -
 chart2/source/controller/main/ChartController_Tools.cxx    |    2 -
 chart2/source/controller/main/ChartModelClone.cxx          |    2 -
 compilerplugins/clang/redundantpointerops.cxx              |   15 +++++++------
 connectivity/source/drivers/mysqlc/mysqlc_connection.hxx   |    2 -
 dbaccess/source/core/dataaccess/datasource.cxx             |    2 -
 dbaccess/source/ui/browser/genericcontroller.cxx           |    2 -
 include/dbaccess/dataview.hxx                              |    2 -
 reportdesign/inc/RptModel.hxx                              |    2 -
 sw/source/core/ole/ndole.cxx                               |    2 -
 writerfilter/source/dmapper/DomainMapper_Impl.hxx          |    3 --
 writerfilter/source/dmapper/StyleSheetTable.cxx            |    2 -
 xmloff/source/core/xmlexp.cxx                              |    4 +--
 xmloff/source/core/xmlmultiimagehelper.cxx                 |    4 +--
 xmloff/source/text/XMLTextFrameContext.cxx                 |    4 +--
 16 files changed, 28 insertions(+), 26 deletions(-)

New commits:
commit 682fdbf1312cf6ca70fe209bf4d7051dad8f5008
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Oct 8 10:30:36 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Oct 9 07:44:49 2019 +0200

    loplugin:redundantpointerops check other pointer types
    
    as well as unique_ptr
    
    Change-Id: I54842bca161ee460fb96c46ca31b6f9c0a7dbbdf
    Reviewed-on: https://gerrit.libreoffice.org/80455
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx
index 5789ebdd27c9..ec45a22eae0e 100644
--- a/chart2/source/controller/main/ChartController_Insert.cxx
+++ b/chart2/source/controller/main/ChartController_Insert.cxx
@@ -195,7 +195,7 @@ void ChartController::executeDispatch_DeleteLegend()
             ActionDescriptionProvider::ActionType::Delete, SchResId( STR_OBJECT_LEGEND )),
         m_xUndoManager );
 
-    ChartModel& rModel = dynamic_cast<ChartModel&>(*getModel().get());
+    ChartModel& rModel = dynamic_cast<ChartModel&>(*getModel());
     LegendHelper::hideLegend(rModel);
     aUndoGuard.commit();
 }
@@ -207,7 +207,7 @@ void ChartController::executeDispatch_InsertLegend()
             ActionDescriptionProvider::ActionType::Insert, SchResId( STR_OBJECT_LEGEND )),
         m_xUndoManager );
 
-    ChartModel& rModel = dynamic_cast<ChartModel&>(*getModel().get());
+    ChartModel& rModel = dynamic_cast<ChartModel&>(*getModel());
     Reference< chart2::XLegend > xLegend = LegendHelper::showLegend(rModel, m_xCC);
     aUndoGuard.commit();
 }
diff --git a/chart2/source/controller/main/ChartController_Position.cxx b/chart2/source/controller/main/ChartController_Position.cxx
index f38bba593a15..410d67461118 100644
--- a/chart2/source/controller/main/ChartController_Position.cxx
+++ b/chart2/source/controller/main/ChartController_Position.cxx
@@ -192,7 +192,7 @@ void ChartController::executeDispatch_PositionAndSize(const ::css::uno::Sequence
             bool bChanged = false;
             if ( eObjectType == OBJECTTYPE_LEGEND )
             {
-                ChartModel& rModel = dynamic_cast<ChartModel&>(*getModel().get());
+                ChartModel& rModel = dynamic_cast<ChartModel&>(*getModel());
                 bChanged = DiagramHelper::switchDiagramPositioningToExcludingPositioning(rModel, false , true);
             }
 
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index 423165322252..74f7e9ab6f79 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -998,7 +998,7 @@ void ChartController::impl_switchDiagramPositioningToExcludingPositioning()
         ActionDescriptionProvider::ActionType::PosSize,
         ObjectNameProvider::getName( OBJECTTYPE_DIAGRAM)),
         m_xUndoManager );
-    ChartModel& rModel = dynamic_cast<ChartModel&>(*m_aModel->getModel().get());
+    ChartModel& rModel = dynamic_cast<ChartModel&>(*m_aModel->getModel());
     if (DiagramHelper::switchDiagramPositioningToExcludingPositioning(rModel, true, true))
         aUndoGuard.commit();
 }
diff --git a/chart2/source/controller/main/ChartModelClone.cxx b/chart2/source/controller/main/ChartModelClone.cxx
index 339547943552..456bd178c81b 100644
--- a/chart2/source/controller/main/ChartModelClone.cxx
+++ b/chart2/source/controller/main/ChartModelClone.cxx
@@ -192,7 +192,7 @@ namespace chart
             Reference< XChartDocument > xDestination( i_model, UNO_QUERY_THROW );
 
             // propagate the correct flag for plotting of hidden values to the data provider and all used sequences
-            ChartModel& rModel = dynamic_cast<ChartModel&>(*i_model.get());
+            ChartModel& rModel = dynamic_cast<ChartModel&>(*i_model);
             ChartModelHelper::setIncludeHiddenCells(ChartModelHelper::isIncludeHiddenCells( i_modelToCopyFrom ), rModel);
 
             // diagram
diff --git a/compilerplugins/clang/redundantpointerops.cxx b/compilerplugins/clang/redundantpointerops.cxx
index 7c82825bd01d..5406989696c5 100644
--- a/compilerplugins/clang/redundantpointerops.cxx
+++ b/compilerplugins/clang/redundantpointerops.cxx
@@ -123,13 +123,16 @@ bool RedundantPointerOps::VisitUnaryOperator(UnaryOperator const * unaryOperator
     if (auto cxxMemberCallExpr = dyn_cast<CXXMemberCallExpr>(subExpr))
     {
         auto methodDecl = cxxMemberCallExpr->getMethodDecl();
-        if (methodDecl->getIdentifier() && methodDecl->getName() == "get"
-            && cxxMemberCallExpr->getRecordDecl()->getName() == "unique_ptr")
-            report(
-                DiagnosticsEngine::Warning, "'*' followed by '.get()', just use '*'",
-                compat::getBeginLoc(unaryOperator))
-                << unaryOperator->getSourceRange();
+        if (methodDecl->getIdentifier() && methodDecl->getName() == "get")
+        {
+            auto className = cxxMemberCallExpr->getRecordDecl()->getName();
+            if (className == "unique_ptr" || className == "shared_ptr" || className == "Reference" || className == "SvRef")
+                report(
+                    DiagnosticsEngine::Warning, "'*' followed by '.get()', just use '*'",
+                    compat::getBeginLoc(unaryOperator))
+                    << unaryOperator->getSourceRange();
 
+        }
     }
     return true;
 }
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_connection.hxx b/connectivity/source/drivers/mysqlc/mysqlc_connection.hxx
index 0e52e9281f4b..283b1d964d4b 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_connection.hxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_connection.hxx
@@ -175,7 +175,7 @@ public:
     const ConnectionSettings& getConnectionSettings() const { return m_settings; }
     OUString transFormPreparedStatement(const OUString& _sSQL);
 
-    const MysqlCDriver& getDriver() const { return *m_xDriver.get(); }
+    const MysqlCDriver& getDriver() const { return *m_xDriver; }
 
 }; /* OConnection */
 // TODO: Not used.
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index edad6f160f7d..95aef3c1a236 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -496,7 +496,7 @@ ODatabaseSource::~ODatabaseSource()
 
 void ODatabaseSource::setName( const Reference< XDocumentDataSource >& _rxDocument, const OUString& _rNewName, DBContextAccess )
 {
-    ODatabaseSource& rModelImpl = dynamic_cast< ODatabaseSource& >( *_rxDocument.get() );
+    ODatabaseSource& rModelImpl = dynamic_cast< ODatabaseSource& >( *_rxDocument );
 
     SolarMutexGuard g;
     if ( rModelImpl.m_pImpl.is() )
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx
index 0989a2c03727..644c3417065e 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -448,7 +448,7 @@ void OGenericUnoController::ImplBroadcastFeatureState(const OUString& _rFeature,
             if ( aFeatureCommands.find( elem.aURL.Complete ) != aFeatureCommands.end() )
             {
                 aEvent.FeatureURL = elem.aURL;
-                lcl_notifyMultipleStates( *elem.xListener.get(), aEvent, aStates );
+                lcl_notifyMultipleStates( *elem.xListener, aEvent, aStates );
             }
         }
     }
diff --git a/include/dbaccess/dataview.hxx b/include/dbaccess/dataview.hxx
index a8da6376da91..738ccc352da1 100644
--- a/include/dbaccess/dataview.hxx
+++ b/include/dbaccess/dataview.hxx
@@ -72,7 +72,7 @@ namespace dbaui
         virtual void StateChanged( StateChangedType nStateChange ) override;
         virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
 
-        IController& getCommandController() const { return *m_xController.get(); }
+        IController& getCommandController() const { return *m_xController; }
 
         const css::uno::Reference< css::uno::XComponentContext >& getORB() const { return m_xContext;}
 
diff --git a/reportdesign/inc/RptModel.hxx b/reportdesign/inc/RptModel.hxx
index 6085e717c074..4c44f5ebe92d 100644
--- a/reportdesign/inc/RptModel.hxx
+++ b/reportdesign/inc/RptModel.hxx
@@ -63,7 +63,7 @@ public:
     /** @returns the numbering type that is used to format page fields in drawing shapes */
     virtual SvxNumType  GetPageNumType() const override;
 
-    OXUndoEnvironment&  GetUndoEnv() { return *m_xUndoEnv.get();}
+    OXUndoEnvironment&  GetUndoEnv() { return *m_xUndoEnv;}
     void                SetModified(bool _bModified);
 
     dbaui::DBSubComponentController* getController() const { return m_pController; }
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
index 02096632ebbb..9000d6ef1b9e 100644
--- a/sw/source/core/ole/ndole.cxx
+++ b/sw/source/core/ole/ndole.cxx
@@ -1124,7 +1124,7 @@ void SwOLEObj::dumpAsXml(xmlTextWriterPtr pWriter) const
 
     xmlTextWriterStartElement(pWriter, BAD_CAST("m_xOLERef"));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("symbol"),
-                                BAD_CAST(typeid(*m_xOLERef.GetObject().get()).name()));
+                                BAD_CAST(typeid(*m_xOLERef.GetObject()).name()));
     xmlTextWriterEndElement(pWriter);
 
     xmlTextWriterEndElement(pWriter);
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 836b3e22b885..1a1be8dc32bd 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -823,8 +823,7 @@ public:
 
     DomainMapperTableManager& getTableManager()
     {
-        tools::SvRef< DomainMapperTableManager > pMngr = m_aTableManagers.top();
-        return *pMngr.get( );
+        return *m_aTableManagers.top();
     }
 
     void appendTableManager( )
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 5dcc856ca564..2a9386ce162f 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -449,7 +449,7 @@ void StyleSheetTable::lcl_attribute(Id Name, Value & val)
             if ( nType == STYLE_TYPE_TABLE )
             {
                 StyleSheetEntryPtr pEntry = m_pImpl->m_pCurrentEntry;
-                tools::SvRef<TableStyleSheetEntry> pTableEntry( new TableStyleSheetEntry( *pEntry.get( ) ) );
+                tools::SvRef<TableStyleSheetEntry> pTableEntry( new TableStyleSheetEntry( *pEntry ) );
                 m_pImpl->m_pCurrentEntry = pTableEntry.get();
             }
             else
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 93ef19a46957..5d7d1910d98a 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -810,7 +810,7 @@ sal_Bool SAL_CALL SvXMLExport::filter( const uno::Sequence< beans::PropertyValue
         OUString sMessage( ex.getValueTypeName() + ": \"" + e.Message + "\"");
         if (e.Context.is())
         {
-            const char* pContext = typeid(*e.Context.get()).name();
+            const char* pContext = typeid(*e.Context).name();
             sMessage += " (context: " + OUString::createFromAscii(pContext) + " )";
         }
         SetError( XMLERROR_FLAG_ERROR | XMLERROR_FLAG_SEVERE | XMLERROR_API,
@@ -1690,7 +1690,7 @@ void SvXMLExport::ExportStyles_( bool )
 
 XMLTextParagraphExport* SvXMLExport::CreateTextParagraphExport()
 {
-    return new XMLTextParagraphExport( *this, *(GetAutoStylePool().get()) );
+    return new XMLTextParagraphExport( *this, *GetAutoStylePool() );
 }
 
 XMLShapeExport* SvXMLExport::CreateShapeExport()
diff --git a/xmloff/source/core/xmlmultiimagehelper.cxx b/xmloff/source/core/xmlmultiimagehelper.cxx
index 36b65fdd7449..af03e7bb1361 100644
--- a/xmloff/source/core/xmlmultiimagehelper.cxx
+++ b/xmloff/source/core/xmlmultiimagehelper.cxx
@@ -113,7 +113,7 @@ SvXMLImportContextRef MultiImageImportHelper::solveMultipleImages()
 
         for(std::vector<SvXMLImportContextRef>::size_type a = 0; a < maImplContextVector.size(); a++)
         {
-            const SvXMLImportContext& rContext = *maImplContextVector[a].get();
+            const SvXMLImportContext& rContext = *maImplContextVector[a];
 
 
             OUString sMimeType;
@@ -152,7 +152,7 @@ SvXMLImportContextRef MultiImageImportHelper::solveMultipleImages()
         // remove the rest from parent
         for(std::vector<SvXMLImportContextRef>::size_type a = 0; a < maImplContextVector.size(); a++)
         {
-            SvXMLImportContext& rCandidate = *maImplContextVector[a].get();
+            SvXMLImportContext& rCandidate = *maImplContextVector[a];
 
             removeGraphicFromImportContext(rCandidate);
         }
diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx
index 7fb33155622b..0f33c760a6ac 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -1522,7 +1522,7 @@ SvXMLImportContextRef XMLTextFrameContext::CreateChildContext(
 
                 if(getSupportsMultipleContents() && XML_TEXT_FRAME_GRAPHIC == nFrameType)
                 {
-                    addContent(*m_xImplContext.get());
+                    addContent(*m_xImplContext);
                 }
             }
         }
@@ -1535,7 +1535,7 @@ SvXMLImportContextRef XMLTextFrameContext::CreateChildContext(
             m_eDefaultAnchorType, XML_TEXT_FRAME_GRAPHIC, m_xAttrList, true);
 
         m_xImplContext = xContext;
-        addContent(*m_xImplContext.get());
+        addContent(*m_xImplContext);
     }
     else if( m_bSupportsReplacement && !m_xReplImplContext.is() &&
              XML_NAMESPACE_DRAW == p_nPrefix &&


More information about the Libreoffice-commits mailing list