[Libreoffice-commits] core.git: compilerplugins/clang dbaccess/source include/svtools sc/source sfx2/inc sfx2/source svl/unx svtools/source

Noel (via logerrit) logerrit at kemper.freedesktop.org
Tue Nov 17 11:12:41 UTC 2020


 compilerplugins/clang/stringviewparam.cxx |   42 +++++++++++++++++++++++++++++-
 dbaccess/source/ui/dlg/UserAdmin.cxx      |    4 +-
 include/svtools/querydelete.hxx           |    2 -
 sc/source/ui/dbgui/sortdlg.cxx            |    2 -
 sc/source/ui/inc/sortdlg.hxx              |    2 -
 sfx2/inc/guisaveas.hxx                    |    2 -
 sfx2/source/dialog/alienwarn.cxx          |    2 -
 sfx2/source/doc/guisaveas.cxx             |    2 -
 sfx2/source/inc/alienwarn.hxx             |    2 -
 svl/unx/source/svdde/ddedummy.cxx         |   12 ++++----
 svtools/source/contnr/querydelete.cxx     |    2 -
 11 files changed, 57 insertions(+), 17 deletions(-)

New commits:
commit 0c7ac93103f69373a7e7639f4cf3ad464c0b727e
Author:     Noel <noelgrandin at gmail.com>
AuthorDate: Tue Nov 17 10:09:40 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Nov 17 12:12:03 2020 +0100

    loplugin:stringviewparam extend to constructors
    
    Change-Id: Ia573921566ec6079b843cbcc0401d9d0f5c62089
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105969
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/compilerplugins/clang/stringviewparam.cxx b/compilerplugins/clang/stringviewparam.cxx
index 76c34cd2adb9..040f8f63b502 100644
--- a/compilerplugins/clang/stringviewparam.cxx
+++ b/compilerplugins/clang/stringviewparam.cxx
@@ -222,7 +222,6 @@ public:
         return ret;
     }
 
-    // TODO Need to duplicate this method for CXXConstructorDecl
     bool TraverseCXXMethodDecl(CXXMethodDecl* decl)
     {
         if (ignoreLocation(decl))
@@ -264,6 +263,47 @@ public:
         return ret;
     }
 
+    bool TraverseCXXConstructorDecl(CXXConstructorDecl* decl)
+    {
+        if (ignoreLocation(decl))
+        {
+            return true;
+        }
+        if (!relevantFunctionDecl(decl))
+        {
+            return FunctionAddress::TraverseCXXConstructorDecl(decl);
+        }
+        auto const oldParams = currentParams_;
+        auto const n = decl->getNumParams();
+        for (unsigned i = 0; i != n; ++i)
+        {
+            auto const d = decl->getParamDecl(i);
+            if (relevantParmVarDecl(d))
+            {
+                currentParams_.insert(d);
+            }
+        }
+        auto const ret = FunctionAddress::TraverseCXXConstructorDecl(decl);
+        if (ret)
+        {
+            for (unsigned i = 0; i != n; ++i)
+            {
+                auto const d1 = decl->getParamDecl(i);
+                if (currentParams_.find(d1) == currentParams_.end())
+                {
+                    continue;
+                }
+                if (containsPreprocessingConditionalInclusion(decl->getSourceRange()))
+                {
+                    break;
+                }
+                badParams_.push_back(d1);
+            }
+        }
+        currentParams_ = oldParams;
+        return ret;
+    }
+
     bool TraverseImplicitCastExpr(ImplicitCastExpr* expr)
     {
         if (ignoreLocation(expr))
diff --git a/dbaccess/source/ui/dlg/UserAdmin.cxx b/dbaccess/source/ui/dlg/UserAdmin.cxx
index b7733b79e94c..672830edd85b 100644
--- a/dbaccess/source/ui/dlg/UserAdmin.cxx
+++ b/dbaccess/source/ui/dlg/UserAdmin.cxx
@@ -61,7 +61,7 @@ class OPasswordDialog : public weld::GenericDialogController
     DECL_LINK(ModifiedHdl, weld::Entry&, void);
 
 public:
-    OPasswordDialog(weld::Window* pParent,const OUString& rUserName);
+    OPasswordDialog(weld::Window* pParent, std::u16string_view rUserName);
 
     OUString        GetOldPassword() const { return m_xEDOldPassword->get_text(); }
     OUString        GetNewPassword() const { return m_xEDPassword->get_text(); }
@@ -69,7 +69,7 @@ public:
 
 }
 
-OPasswordDialog::OPasswordDialog(weld::Window* _pParent,const OUString& rUserName)
+OPasswordDialog::OPasswordDialog(weld::Window* _pParent, std::u16string_view rUserName)
     : GenericDialogController(_pParent, "dbaccess/ui/password.ui", "PasswordDialog")
     , m_xUser(m_xBuilder->weld_frame("userframe"))
     , m_xEDOldPassword(m_xBuilder->weld_entry("oldpassword"))
diff --git a/include/svtools/querydelete.hxx b/include/svtools/querydelete.hxx
index b41d2461e189..2d8e2b915bb1 100644
--- a/include/svtools/querydelete.hxx
+++ b/include/svtools/querydelete.hxx
@@ -40,7 +40,7 @@ private:
     std::unique_ptr<weld::Button> m_xAllButton;
 
 public:
-    QueryDeleteDlg_Impl(weld::Widget* pParent, const OUString& rName);
+    QueryDeleteDlg_Impl(weld::Widget* pParent, std::u16string_view rName);
     virtual ~QueryDeleteDlg_Impl() override;
 
     void EnableAllButton() { m_xAllButton->set_sensitive(true); }
diff --git a/sc/source/ui/dbgui/sortdlg.cxx b/sc/source/ui/dbgui/sortdlg.cxx
index 0af20114ee10..4c5f5c18e00c 100644
--- a/sc/source/ui/dbgui/sortdlg.cxx
+++ b/sc/source/ui/dbgui/sortdlg.cxx
@@ -33,7 +33,7 @@ ScSortDlg::ScSortDlg(weld::Window* pParent, const SfxItemSet* pArgSet)
 }
 
 ScSortWarningDlg::ScSortWarningDlg(weld::Window* pParent,
-    const OUString& rExtendText, const OUString& rCurrentText)
+    std::u16string_view rExtendText, std::u16string_view rCurrentText)
     : GenericDialogController(pParent, "modules/scalc/ui/sortwarning.ui", "SortWarning")
     , m_xFtText(m_xBuilder->weld_label("sorttext"))
     , m_xBtnExtSort(m_xBuilder->weld_button("extend"))
diff --git a/sc/source/ui/inc/sortdlg.hxx b/sc/source/ui/inc/sortdlg.hxx
index c45143296347..a68e81e34241 100644
--- a/sc/source/ui/inc/sortdlg.hxx
+++ b/sc/source/ui/inc/sortdlg.hxx
@@ -41,7 +41,7 @@ private:
 class ScSortWarningDlg : public weld::GenericDialogController
 {
 public:
-    ScSortWarningDlg(weld::Window* pParent, const OUString& rExtendText,const OUString& rCurrentText);
+    ScSortWarningDlg(weld::Window* pParent, std::u16string_view rExtendText, std::u16string_view rCurrentText);
     virtual ~ScSortWarningDlg() override;
     DECL_LINK(BtnHdl, weld::Button&, void);
 private:
diff --git a/sfx2/inc/guisaveas.hxx b/sfx2/inc/guisaveas.hxx
index 9ccd33436f29..a62c5fc3822e 100644
--- a/sfx2/inc/guisaveas.hxx
+++ b/sfx2/inc/guisaveas.hxx
@@ -69,7 +69,7 @@ public:
 
     static bool WarnUnacceptableFormat(
                                     const css::uno::Reference< css::frame::XModel >& xModel,
-                                    const OUString& aOldUIName,
+                                    std::u16string_view aOldUIName,
                                     const OUString& aDefExtension,
                                     bool rDefaultIsAlien );
 
diff --git a/sfx2/source/dialog/alienwarn.cxx b/sfx2/source/dialog/alienwarn.cxx
index bce34556bcda..f15d152b29b5 100644
--- a/sfx2/source/dialog/alienwarn.cxx
+++ b/sfx2/source/dialog/alienwarn.cxx
@@ -21,7 +21,7 @@
 #include <unotools/saveopt.hxx>
 #include <alienwarn.hxx>
 
-SfxAlienWarningDialog::SfxAlienWarningDialog(weld::Window* pParent, const OUString& _rFormatName,
+SfxAlienWarningDialog::SfxAlienWarningDialog(weld::Window* pParent, std::u16string_view _rFormatName,
                                              const OUString& _rDefaultExtension, bool rDefaultIsAlien)
     : MessageDialogController(pParent, "sfx/ui/alienwarndialog.ui", "AlienWarnDialog", "ask")
     , m_xKeepCurrentBtn(m_xBuilder->weld_button("save"))
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 33e04bdd39d4..736b7d229d4b 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -1799,7 +1799,7 @@ void SfxStoringHelper::SetDocInfoState(
 
 // static
 bool SfxStoringHelper::WarnUnacceptableFormat( const uno::Reference< frame::XModel >& xModel,
-                                                    const OUString& aOldUIName,
+                                                    std::u16string_view aOldUIName,
                                                     const OUString& aDefExtension,
                                                     bool bDefIsAlien )
 {
diff --git a/sfx2/source/inc/alienwarn.hxx b/sfx2/source/inc/alienwarn.hxx
index eeda0fedfe1d..5cf662b09d0f 100644
--- a/sfx2/source/inc/alienwarn.hxx
+++ b/sfx2/source/inc/alienwarn.hxx
@@ -29,7 +29,7 @@ private:
     std::unique_ptr<weld::CheckButton> m_xWarningOnBox;
 
 public:
-    SfxAlienWarningDialog(weld::Window* pParent, const OUString& _rFormatName,
+    SfxAlienWarningDialog(weld::Window* pParent, std::u16string_view _rFormatName,
                           const OUString& _rDefaultExtension, bool rDefaultIsAlien);
     virtual ~SfxAlienWarningDialog() override;
 };
diff --git a/svl/unx/source/svdde/ddedummy.cxx b/svl/unx/source/svdde/ddedummy.cxx
index fa5aef5faaef..98942d410e05 100644
--- a/svl/unx/source/svdde/ddedummy.cxx
+++ b/svl/unx/source/svdde/ddedummy.cxx
@@ -33,7 +33,7 @@ DdeData::DdeData()
 {
 }
 
-DdeData::DdeData( const OUString& )
+DdeData::DdeData( SAL_UNUSED_PARAMETER const OUString& )
 {
 }
 
@@ -89,7 +89,7 @@ tools::Long DdeConnection::GetError() const
     return 0L;
 }
 
-DdeConnection::DdeConnection( const OUString&, const OUString& )
+DdeConnection::DdeConnection( SAL_UNUSED_PARAMETER const OUString&, SAL_UNUSED_PARAMETER const OUString& )
     : pService(nullptr)
     , pTopic(nullptr)
 {
@@ -109,7 +109,7 @@ OUString DdeConnection::GetTopicName() const
     return OUString();
 }
 
-DdeTransaction::DdeTransaction( DdeConnection& rConnection, const OUString&, tools::Long )
+DdeTransaction::DdeTransaction( DdeConnection& rConnection, SAL_UNUSED_PARAMETER const OUString&, tools::Long )
     : rDde(rConnection)
     , pName(nullptr)
     , nType(0)
@@ -151,7 +151,7 @@ DdePoke::DdePoke( DdeConnection& rConnection, const OUString& rString, const Dde
 }
 
 
-DdeTopic::DdeTopic( const OUString& )
+DdeTopic::DdeTopic( SAL_UNUSED_PARAMETER const OUString& )
     : pName(nullptr)
 {
 }
@@ -203,7 +203,7 @@ OUString DdeTopic::GetName() const
     return OUString();
 }
 
-DdeService::DdeService( const OUString& )
+DdeService::DdeService( SAL_UNUSED_PARAMETER const OUString& )
     : pSysTopic(nullptr)
     , pName(nullptr)
     , nStatus(0)
@@ -261,7 +261,7 @@ DdeServices& DdeService::GetServices()
   return theDdeServices::get();
 }
 
-DdeItem::DdeItem( const OUString& )
+DdeItem::DdeItem( SAL_UNUSED_PARAMETER const OUString& )
     : pName(nullptr)
     , pMyTopic(nullptr)
     , pImpData(nullptr)
diff --git a/svtools/source/contnr/querydelete.cxx b/svtools/source/contnr/querydelete.cxx
index 334d75eac300..9b97983f7d1d 100644
--- a/svtools/source/contnr/querydelete.cxx
+++ b/svtools/source/contnr/querydelete.cxx
@@ -21,7 +21,7 @@
 
 namespace svtools
 {
-QueryDeleteDlg_Impl::QueryDeleteDlg_Impl(weld::Widget* pParent, const OUString& rName)
+QueryDeleteDlg_Impl::QueryDeleteDlg_Impl(weld::Widget* pParent, std::u16string_view rName)
     : MessageDialogController(pParent, "svt/ui/querydeletedialog.ui", "QueryDeleteDialog")
     , m_xAllButton(m_xBuilder->weld_button("all"))
 {


More information about the Libreoffice-commits mailing list