From 5f9da6e0ee9d5b15dbe6d9aee162cf849d7a0eb6 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 16 Jan 2024 11:02:46 +0200 Subject: [PATCH] improve loplugin:cow_wrapper some stuff was hiding inside templates Change-Id: I89fd1a926dd6bf96e35a74e5028165acae51c60c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162159 Tested-by: Jenkins Reviewed-by: Noel Grandin --- compilerplugins/clang/cow_wrapper.cxx | 2 ++ cppuhelper/inc/interfacecontainer4.hxx | 4 ++-- include/comphelper/interfacecontainer3.hxx | 4 ++-- include/comphelper/interfacecontainer4.hxx | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/compilerplugins/clang/cow_wrapper.cxx b/compilerplugins/clang/cow_wrapper.cxx index c98f70cbeb87..073a4fa9fb89 100644 --- a/compilerplugins/clang/cow_wrapper.cxx +++ b/compilerplugins/clang/cow_wrapper.cxx @@ -34,6 +34,8 @@ public: { } + bool shouldVisitTemplateInstantiations() const { return true; } + virtual bool preRun() override { return true; } virtual void run() override diff --git a/cppuhelper/inc/interfacecontainer4.hxx b/cppuhelper/inc/interfacecontainer4.hxx index 5111ae7e5170..bbc082cfd76e 100644 --- a/cppuhelper/inc/interfacecontainer4.hxx +++ b/cppuhelper/inc/interfacecontainer4.hxx @@ -358,7 +358,7 @@ OInterfaceContainerHelper4::addInterface(std::unique_lock (void)rGuard; assert(rListener.is()); maData->push_back(rListener); - return maData->size(); + return std::as_const(maData)->size(); } template @@ -382,7 +382,7 @@ sal_Int32 OInterfaceContainerHelper4::removeInterface( if (it != maData->end()) maData->erase(it); - return maData->size(); + return std::as_const(maData)->size(); } template diff --git a/include/comphelper/interfacecontainer3.hxx b/include/comphelper/interfacecontainer3.hxx index 5b11d7895924..be140d32289f 100644 --- a/include/comphelper/interfacecontainer3.hxx +++ b/include/comphelper/interfacecontainer3.hxx @@ -318,7 +318,7 @@ OInterfaceContainerHelper3::addInterface(const css::uno::Reference
  • push_back(rListener); - return maData->size(); + return std::as_const(maData)->size(); } template @@ -341,7 +341,7 @@ sal_Int32 OInterfaceContainerHelper3::removeInterface( if (it != maData->end()) maData->erase(it); - return maData->size(); + return std::as_const(maData)->size(); } template diff --git a/include/comphelper/interfacecontainer4.hxx b/include/comphelper/interfacecontainer4.hxx index 6a96d7242d43..e4a41e30675d 100644 --- a/include/comphelper/interfacecontainer4.hxx +++ b/include/comphelper/interfacecontainer4.hxx @@ -353,7 +353,7 @@ OInterfaceContainerHelper4::addInterface(std::unique_lock (void)rGuard; assert(rListener.is()); maData->push_back(rListener); - return maData->size(); + return std::as_const(maData)->size(); } template @@ -377,7 +377,7 @@ sal_Int32 OInterfaceContainerHelper4::removeInterface( if (it != maData->end()) maData->erase(it); - return maData->size(); + return std::as_const(maData)->size(); } template