[Libreoffice-commits] core.git: compilerplugins/clang sc/qa sd/inc sd/qa sd/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Nov 7 11:08:09 UTC 2017


 compilerplugins/clang/constparams.cxx     |   20 ++++++++++++++++++++
 sc/qa/extras/htmlexporttest.cxx           |    2 +-
 sc/qa/unit/helper/qahelper.cxx            |    2 +-
 sc/qa/unit/helper/qahelper.hxx            |    2 +-
 sd/inc/drawdoc.hxx                        |    4 ++--
 sd/qa/unit/sdmodeltestbase.hxx            |    6 +++---
 sd/source/core/drawdoc2.cxx               |    6 +++---
 sd/source/core/drawdoc4.cxx               |    2 +-
 sd/source/filter/eppt/pptexanimations.cxx |    2 +-
 sd/source/filter/html/pubdlg.cxx          |    2 +-
 sd/source/filter/ppt/pptanimations.hxx    |    2 +-
 sd/source/filter/ppt/pptin.cxx            |    2 +-
 sd/source/filter/ppt/pptin.hxx            |    2 +-
 sd/source/ui/inc/pubdlg.hxx               |    2 +-
 sd/source/ui/slideshow/slideshowimpl.cxx  |    2 +-
 sd/source/ui/slideshow/slideshowimpl.hxx  |    2 +-
 sd/source/ui/view/DocumentRenderer.cxx    |    2 +-
 17 files changed, 41 insertions(+), 21 deletions(-)

New commits:
commit 9610bab09361f506fd7b1a5f81d796a1f2c8afe4
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Nov 6 14:50:36 2017 +0200

    loplugin:constparams in sd
    
    Change-Id: Id4b68ca0509111396ed354f4cda43d663083cad0
    Reviewed-on: https://gerrit.libreoffice.org/44388
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/compilerplugins/clang/constparams.cxx b/compilerplugins/clang/constparams.cxx
index ef97d671f801..f075d0c06edc 100644
--- a/compilerplugins/clang/constparams.cxx
+++ b/compilerplugins/clang/constparams.cxx
@@ -55,6 +55,15 @@ public:
             || startswith(fn, SRCDIR "/sfx2/source/doc/syspath.cxx")
             // ignore this for now
             || startswith(fn, SRCDIR "/libreofficekit")
+            // I end up with a
+            //    CXXMemberCallExpr
+            // to a
+            //    BuiltinType '<bound member function type>'
+            // and the AST gives me no further useful information.
+            || startswith(fn, SRCDIR "/sw/source/core/doc/docfly.cxx")
+            || startswith(fn, SRCDIR "/sw/source/core/doc/DocumentContentOperationsManager.cxx")
+            || startswith(fn, SRCDIR "/sw/source/core/fields/cellfml.cxx")
+            || startswith(fn, SRCDIR "/sw/source/filter/ww8/ww8par6.cxx")
             )
             return;
 
@@ -194,6 +203,12 @@ bool ConstParams::CheckTraverseFunctionDecl(FunctionDecl * functionDecl)
             || name == "egiGraphicExport"
             || name == "etiGraphicExport"
             || name == "epsGraphicExport"
+            // callback for some external code?
+            || name == "ScAddInAsyncCallBack"
+            // used as function pointers
+            || name == "Read_Footnote"
+            || name == "Read_Field"
+            || name == "Read_And"
             )
             return false;
     }
@@ -215,6 +230,9 @@ bool ConstParams::CheckTraverseFunctionDecl(FunctionDecl * functionDecl)
         // since we normally can't change typedefs, just ignore them
         if (isa<TypedefType>(pParmVarDecl->getType()))
             continue;
+        // some typedefs turn into these
+        if (isa<DecayedType>(pParmVarDecl->getType()))
+            continue;
         // TODO ignore these for now, has some effects I don't understand
         if (type.Pointer().Pointer())
             continue;
@@ -224,6 +242,8 @@ bool ConstParams::CheckTraverseFunctionDecl(FunctionDecl * functionDecl)
         // ignore things with template params
         if (pParmVarDecl->getType()->isInstantiationDependentType())
             continue;
+        if (functionDecl->getIdentifier() && functionDecl->getName() == "WW8TransCol")
+            pParmVarDecl->getType()->dump();
         interestingParamSet.insert(pParmVarDecl);
         parmToFunction[pParmVarDecl] = functionDecl;
         foundInterestingParam = true;
diff --git a/sc/qa/extras/htmlexporttest.cxx b/sc/qa/extras/htmlexporttest.cxx
index e264d7b2c28a..23901fb485b8 100644
--- a/sc/qa/extras/htmlexporttest.cxx
+++ b/sc/qa/extras/htmlexporttest.cxx
@@ -43,7 +43,7 @@ class ScHTMLExportTest : public test::BootstrapFixture, public unotest::MacrosTe
         mxComponent = loadFromDesktop(m_directories.getURLFromSrc(pDir) + OUString::createFromAscii(pName), "com.sun.star.comp.Calc.SpreadsheetDocument");
     }
 
-    void save(const OUString& aFilterName, TempFile& rTempFile)
+    void save(const OUString& aFilterName, TempFile const & rTempFile)
     {
         Reference<XStorable> xStorable(mxComponent, UNO_QUERY);
         MediaDescriptor aMediaDescriptor;
diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index b767829086d8..5f4f56dccb11 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -723,7 +723,7 @@ std::shared_ptr<utl::TempFile> ScBootstrapFixture::exportTo( ScDocShell* pShell,
     return pTempFile;
 }
 
-void ScBootstrapFixture::miscRowHeightsTest( TestParam* aTestValues, unsigned int numElems )
+void ScBootstrapFixture::miscRowHeightsTest( TestParam const * aTestValues, unsigned int numElems )
 {
     for ( unsigned int index=0; index<numElems; ++index )
     {
diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx
index 5226478e3411..1dc8e50a6b2e 100644
--- a/sc/qa/unit/helper/qahelper.hxx
+++ b/sc/qa/unit/helper/qahelper.hxx
@@ -242,7 +242,7 @@ public:
 
     static std::shared_ptr<utl::TempFile> exportTo( ScDocShell* pShell, sal_Int32 nFormat );
 
-    void miscRowHeightsTest( TestParam* aTestValues, unsigned int numElems );
+    void miscRowHeightsTest( TestParam const * aTestValues, unsigned int numElems );
 };
 
 #define ASSERT_DOUBLES_EQUAL( expected, result )    \
diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx
index 703c3ef8c467..2ce8fabb9de4 100644
--- a/sd/inc/drawdoc.hxx
+++ b/sd/inc/drawdoc.hxx
@@ -413,7 +413,7 @@ public:
     SAL_DLLPRIVATE void                StopOnlineSpelling();
     SAL_DLLPRIVATE void                StartOnlineSpelling(bool bForceSpelling=true);
 
-    SAL_DLLPRIVATE void                ImpOnlineSpellCallback(SpellCallbackInfo* pInfo, SdrObject* pObj, SdrOutliner const * pOutl);
+    SAL_DLLPRIVATE void                ImpOnlineSpellCallback(SpellCallbackInfo const * pInfo, SdrObject* pObj, SdrOutliner const * pOutl);
 
     SAL_DLLPRIVATE void                InsertObject(SdrObject* pObj);
     SAL_DLLPRIVATE void                RemoveObject(SdrObject* pObj);
@@ -447,7 +447,7 @@ public:
     static     SdAnimationInfo* GetShapeUserData(SdrObject& rObject, bool bCreate = false );
 
     SAL_DLLPRIVATE static SdIMapInfo*  GetIMapInfo( SdrObject const * pObject );
-    SAL_DLLPRIVATE static IMapObject*  GetHitIMapObject( SdrObject* pObject, const Point& rWinPoint );
+    SAL_DLLPRIVATE static IMapObject*  GetHitIMapObject( SdrObject const * pObject, const Point& rWinPoint );
 
     SAL_DLLPRIVATE CharClass*          GetCharClass() const { return mpCharClass.get(); }
 
diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx
index 9b503443337a..49aa48e2a552 100644
--- a/sd/qa/unit/sdmodeltestbase.hxx
+++ b/sd/qa/unit/sdmodeltestbase.hxx
@@ -161,7 +161,7 @@ protected:
         return pFormat;
     }
 
-    void exportTo(sd::DrawDocShell* pShell, FileFormat* pFormat, utl::TempFile& rTempFile)
+    void exportTo(sd::DrawDocShell* pShell, FileFormat const * pFormat, utl::TempFile const & rTempFile)
     {
         SfxMedium aStoreMedium(rTempFile.GetURL(), StreamMode::STD_WRITE);
         SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE;
@@ -180,7 +180,7 @@ protected:
         pShell->DoClose();
     }
 
-    void save(sd::DrawDocShell* pShell, FileFormat* pFormat, utl::TempFile& rTempFile)
+    void save(sd::DrawDocShell* pShell, FileFormat const * pFormat, utl::TempFile const & rTempFile)
     {
         SfxMedium aStoreMedium(rTempFile.GetURL(), StreamMode::STD_WRITE);
         SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE;
@@ -376,7 +376,7 @@ class SdModelTestBaseXML
 {
 
 public:
-    xmlDocPtr parseExport(utl::TempFile & rTempFile, OUString const& rStreamName)
+    xmlDocPtr parseExport(utl::TempFile const & rTempFile, OUString const& rStreamName)
     {
         OUString const url(rTempFile.GetURL());
         uno::Reference<packages::zip::XZipFileAccess2> const xZipNames(
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 1d9b9bcba77e..3b1621799302 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -1030,7 +1030,7 @@ SdIMapInfo* SdDrawDocument::GetIMapInfo( SdrObject const * pObject )
     return pIMapInfo;
 }
 
-IMapObject* SdDrawDocument::GetHitIMapObject( SdrObject* pObj,
+IMapObject* SdDrawDocument::GetHitIMapObject( SdrObject const * pObj,
                                               const Point& rWinPoint )
 {
     SdIMapInfo* pIMapInfo = GetIMapInfo( pObj );
@@ -1073,9 +1073,9 @@ IMapObject* SdDrawDocument::GetHitIMapObject( SdrObject* pObj,
             delete pGeoData;
             bObjSupported = true;
         }
-        else if ( dynamic_cast<const SdrOle2Obj* >(pObj) !=  nullptr ) // OLE object
+        else if ( auto pOleObj = dynamic_cast<const SdrOle2Obj* >(pObj) ) // OLE object
         {
-            aGraphSize = static_cast<SdrOle2Obj*>( pObj )->GetOrigObjSize();
+            aGraphSize = pOleObj->GetOrigObjSize();
             bObjSupported = true;
         }
 
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index 45d82b452a86..516d2054d8fd 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -956,7 +956,7 @@ IMPL_LINK(SdDrawDocument, OnlineSpellEventHdl, EditStatus&, rEditStat, void)
 // Callback for ExecuteSpellPopup()
 
 // removed link and replaced with Imp method
-void SdDrawDocument::ImpOnlineSpellCallback(SpellCallbackInfo* pInfo, SdrObject* pObj, SdrOutliner const * pOutl)
+void SdDrawDocument::ImpOnlineSpellCallback(SpellCallbackInfo const * pInfo, SdrObject* pObj, SdrOutliner const * pOutl)
 {
     mpOnlineSearchItem.reset();
 
diff --git a/sd/source/filter/eppt/pptexanimations.cxx b/sd/source/filter/eppt/pptexanimations.cxx
index 96f1ec40c4c6..3642aae67d7f 100644
--- a/sd/source/filter/eppt/pptexanimations.cxx
+++ b/sd/source/filter/eppt/pptexanimations.cxx
@@ -244,7 +244,7 @@ const sal_Char* AnimationExporter::FindTransitionName( const sal_Int16 nType, co
     return pRet;
 }
 
-SvStream& WriteAnimationNode(SvStream& rOut, AnimationNode& rNode )
+SvStream& WriteAnimationNode(SvStream& rOut, AnimationNode const & rNode )
 {
     rOut.WriteInt32( rNode.mnU1 );
     rOut.WriteInt32( rNode.mnRestart );
diff --git a/sd/source/filter/html/pubdlg.cxx b/sd/source/filter/html/pubdlg.cxx
index 84189022e204..cacef11b2626 100644
--- a/sd/source/filter/html/pubdlg.cxx
+++ b/sd/source/filter/html/pubdlg.cxx
@@ -1360,7 +1360,7 @@ IMPL_LINK_NOARG(SdPublishingDlg, NextPageHdl, Button*, void)
 }
 
 // Sets the Controls in the dialog to the settings in the design
-void SdPublishingDlg::SetDesign( SdPublishingDesign* pDesign )
+void SdPublishingDlg::SetDesign( SdPublishingDesign const * pDesign )
 {
     if(!pDesign)
         return;
diff --git a/sd/source/filter/ppt/pptanimations.hxx b/sd/source/filter/ppt/pptanimations.hxx
index a1277d6e40d8..34d750c42e29 100644
--- a/sd/source/filter/ppt/pptanimations.hxx
+++ b/sd/source/filter/ppt/pptanimations.hxx
@@ -197,7 +197,7 @@ public:
     }
 public:
 
-    friend SvStream& WriteAnimationNode(SvStream& rOut, AnimationNode& rAtom);
+    friend SvStream& WriteAnimationNode(SvStream& rOut, AnimationNode const & rAtom);
 };
 
 } // namespace ppt
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 5345ce50c18a..568d8414b8e3 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -2057,7 +2057,7 @@ OUString ImplSdPPTImport::ReadMedia( sal_uInt32 nMediaRef ) const
 }
 
 // import of objects
-void ImplSdPPTImport::FillSdAnimationInfo( SdAnimationInfo* pInfo, PptInteractiveInfoAtom* pIAtom, const OUString& aMacroName )
+void ImplSdPPTImport::FillSdAnimationInfo( SdAnimationInfo* pInfo, PptInteractiveInfoAtom const * pIAtom, const OUString& aMacroName )
 {
     // set local information into pInfo
     if( pIAtom->nSoundRef )
diff --git a/sd/source/filter/ppt/pptin.hxx b/sd/source/filter/ppt/pptin.hxx
index 90c5f6a686cc..468aae6c53dc 100644
--- a/sd/source/filter/ppt/pptin.hxx
+++ b/sd/source/filter/ppt/pptin.hxx
@@ -61,7 +61,7 @@ class ImplSdPPTImport : public SdrPowerPointImport
     void            SetHeaderFooterPageSettings( SdPage* pPage, const PptSlidePersistEntry* pMasterPersist );
     void            ImportPageEffect( SdPage* pPage, const bool bNewAnimationsUsed );
 
-    void            FillSdAnimationInfo( SdAnimationInfo* pInfo, PptInteractiveInfoAtom* pIAtom, const OUString& aMacroName );
+    void            FillSdAnimationInfo( SdAnimationInfo* pInfo, PptInteractiveInfoAtom const * pIAtom, const OUString& aMacroName );
 
     virtual         SdrObject* ProcessObj( SvStream& rSt, DffObjData& rData, void* pData, ::tools::Rectangle& rTextRect, SdrObject* pObj ) override;
     virtual         SdrObject* ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pText, SdPageCapsule pPage,
diff --git a/sd/source/ui/inc/pubdlg.hxx b/sd/source/ui/inc/pubdlg.hxx
index dc4ecc68f70b..345c96de6908 100644
--- a/sd/source/ui/inc/pubdlg.hxx
+++ b/sd/source/ui/inc/pubdlg.hxx
@@ -173,7 +173,7 @@ private:
     bool    Save();
 
     void    GetDesign( SdPublishingDesign* pDesign );
-    void    SetDesign( SdPublishingDesign* pDesign );
+    void    SetDesign( SdPublishingDesign const * pDesign );
 
     void    LoadPreviewButtons();
 
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index a2de6d4dd8f1..3f2e80b592c2 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -827,7 +827,7 @@ bool SlideshowImpl::startPreview(
     return bRet;
 }
 
-bool SlideshowImpl::startShow( PresentationSettingsEx* pPresSettings )
+bool SlideshowImpl::startShow( PresentationSettingsEx const * pPresSettings )
 {
     const rtl::Reference<SlideshowImpl> this_(this);
 
diff --git a/sd/source/ui/slideshow/slideshowimpl.hxx b/sd/source/ui/slideshow/slideshowimpl.hxx
index b98d4f1cac14..978ab77e596f 100644
--- a/sd/source/ui/slideshow/slideshowimpl.hxx
+++ b/sd/source/ui/slideshow/slideshowimpl.hxx
@@ -247,7 +247,7 @@ private:
     virtual void SAL_CALL disposing() override;
 
     // internal
-    bool startShow( PresentationSettingsEx* pPresSettings );
+    bool startShow( PresentationSettingsEx const * pPresSettings );
     bool startPreview(
         const css::uno::Reference< css::drawing::XDrawPage >& xDrawPage,
         const css::uno::Reference< css::animations::XAnimationNode >& xAnimationNode,
diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
index f708d864d40c..608a4af642bb 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -1582,7 +1582,7 @@ private:
         current slide then that is added.  Otherwise a new printer page is
         started.
     */
-    void PrepareOutline (PrintInfo& rInfo)
+    void PrepareOutline (PrintInfo const & rInfo)
     {
         MapMode aMap (rInfo.maMap);
         Point aPageOfs (rInfo.mpPrinter->GetPageOffset() );


More information about the Libreoffice-commits mailing list