summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-06-29 08:15:20 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-29 09:35:30 +0200
commit497e40ad03c27837978551ba15491c3fb2a0bf53 (patch)
treebaa53156ae5234b65f645e11e590c64e569c6284
parentloplugin:oncevar various (diff)
downloadcore-497e40ad03c27837978551ba15491c3fb2a0bf53.tar.gz
core-497e40ad03c27837978551ba15491c3fb2a0bf53.zip
improve refcounting loplugin
to find ref-counted classes being managed via other smart pointer classes. Hopefully prevent needing fixes like 642ae256ea5b8083ba0b3c097ca8ea52304b9cdb "ChangedUIEventListener is refcounted, mustn't be helt by unique_ptr" Change-Id: I6b0c5f8f87ce3546a8a1104ce1000470c09459bd Reviewed-on: https://gerrit.libreoffice.org/39378 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--compilerplugins/clang/refcounting.cxx78
-rw-r--r--compilerplugins/clang/test/refcounting.cxx19
-rw-r--r--connectivity/source/commontools/TIndex.cxx4
-rw-r--r--connectivity/source/commontools/TKey.cxx2
-rw-r--r--connectivity/source/drivers/ado/AGroup.cxx2
-rw-r--r--connectivity/source/drivers/ado/AIndex.cxx2
-rw-r--r--connectivity/source/drivers/ado/AKey.cxx2
-rw-r--r--connectivity/source/drivers/ado/AUser.cxx2
-rw-r--r--connectivity/source/drivers/dbase/DIndex.cxx2
-rw-r--r--dbaccess/source/core/api/TableDeco.cxx2
-rw-r--r--dbaccess/source/core/inc/TableDeco.hxx2
-rw-r--r--i18npool/inc/defaultnumberingprovider.hxx5
-rw-r--r--i18npool/inc/indexentrysupplier_common.hxx3
-rw-r--r--i18npool/inc/indexentrysupplier_default.hxx2
-rw-r--r--i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx2
-rw-r--r--i18npool/source/indexentry/indexentrysupplier_common.cxx2
-rw-r--r--include/connectivity/sdbcx/VGroup.hxx2
-rw-r--r--include/connectivity/sdbcx/VIndex.hxx2
-rw-r--r--include/connectivity/sdbcx/VKey.hxx2
-rw-r--r--include/connectivity/sdbcx/VUser.hxx2
-rw-r--r--sc/source/filter/xml/XMLTrackedChangesContext.cxx6
-rw-r--r--solenv/CompilerTest_compilerplugins_clang.mk1
-rw-r--r--sw/source/uibase/inc/dbtree.hxx2
-rw-r--r--xmloff/source/draw/XMLNumberStyles.cxx12
24 files changed, 117 insertions, 43 deletions
diff --git a/compilerplugins/clang/refcounting.cxx b/compilerplugins/clang/refcounting.cxx
index e008a9e501dd..65520d589a8f 100644
--- a/compilerplugins/clang/refcounting.cxx
+++ b/compilerplugins/clang/refcounting.cxx
@@ -386,28 +386,67 @@ bool RefCounting::VisitFieldDecl(const FieldDecl * fieldDecl) {
return true;
}
- std::string aParentName = fieldDecl->getParent()->getQualifiedNameAsString();
+ // check for dodgy code managing ref-counted stuff with shared_ptr or unique_ptr or similar stuff
+ QualType firstTemplateParamType;
+ if (auto recordType = fieldDecl->getType()->getUnqualifiedDesugaredType()->getAs<RecordType>()) {
+ auto recordDeclName = recordType->getDecl()->getName();
+ if (recordDeclName.find("unique_ptr") != StringRef::npos
+ || recordDeclName.find("shared_ptr") != StringRef::npos
+ || recordDeclName.find("intrusive_ptr") != StringRef::npos) // boost
+ {
+ auto templateDecl = dyn_cast<ClassTemplateSpecializationDecl>(recordType->getDecl());
+ if (templateDecl && templateDecl->getTemplateArgs().size() > 0)
+ firstTemplateParamType = templateDecl->getTemplateArgs()[0].getAsType();
+ }
+ }
if (containsSvRefBaseSubclass(fieldDecl->getType().getTypePtr())) {
report(
DiagnosticsEngine::Warning,
- "SvRefBase subclass being directly heap managed, should be managed via tools::SvRef, "
- + fieldDecl->getType().getAsString()
- + ", parent is " + aParentName,
+ "SvRefBase subclass %0 being directly heap managed, should be managed via tools::SvRef, "
+ ", parent is %1",
fieldDecl->getLocation())
- << fieldDecl->getSourceRange();
+ << fieldDecl->getType()
+ << fieldDecl->getParent()
+ << fieldDecl->getSourceRange();
+ }
+
+ if (!firstTemplateParamType.isNull() && containsSvRefBaseSubclass(firstTemplateParamType.getTypePtr()))
+ {
+ report(
+ DiagnosticsEngine::Warning,
+ "SvRefBase subclass %0 being managed via smart pointer, should be managed via tools::SvRef, "
+ "parent is %1",
+ fieldDecl->getLocation())
+ << firstTemplateParamType
+ << fieldDecl->getParent()
+ << fieldDecl->getSourceRange();
}
if (containsSalhelperReferenceObjectSubclass(fieldDecl->getType().getTypePtr())) {
report(
DiagnosticsEngine::Warning,
- "salhelper::SimpleReferenceObject subclass being directly heap managed, should be managed via rtl::Reference, "
- + fieldDecl->getType().getAsString()
- + ", parent is " + aParentName,
+ "salhelper::SimpleReferenceObject subclass %0 being directly heap managed, should be managed via rtl::Reference, "
+ "parent is %1",
+ fieldDecl->getLocation())
+ << fieldDecl->getType()
+ << fieldDecl->getParent()
+ << fieldDecl->getSourceRange();
+ }
+
+ if (!firstTemplateParamType.isNull() && containsSalhelperReferenceObjectSubclass(firstTemplateParamType.getTypePtr()))
+ {
+ report(
+ DiagnosticsEngine::Warning,
+ "salhelper::SimpleReferenceObject subclass %0 being managed via smart pointer, should be managed via rtl::Reference, "
+ "parent is %1",
fieldDecl->getLocation())
- << fieldDecl->getSourceRange();
+ << firstTemplateParamType
+ << fieldDecl->getParent()
+ << fieldDecl->getSourceRange();
}
+ std::string aParentName = fieldDecl->getParent()->getQualifiedNameAsString();
if ( aParentName == "com::sun::star::uno::BaseReference"
|| aParentName == "cppu::detail::element_alias"
// this is playing some kind of game to avoid circular references
@@ -419,11 +458,24 @@ bool RefCounting::VisitFieldDecl(const FieldDecl * fieldDecl) {
if (containsXInterfaceSubclass(fieldDecl->getType())) {
report(
DiagnosticsEngine::Warning,
- "XInterface subclass being directly heap managed, should be managed via uno::Reference, "
- + fieldDecl->getType().getAsString()
- + ", parent is " + aParentName,
+ "XInterface subclass %0 being directly heap managed, should be managed via uno::Reference, "
+ "parent is %1",
+ fieldDecl->getLocation())
+ << fieldDecl->getType()
+ << fieldDecl->getParent()
+ << fieldDecl->getSourceRange();
+ }
+
+ if (!firstTemplateParamType.isNull() && containsXInterfaceSubclass(firstTemplateParamType))
+ {
+ report(
+ DiagnosticsEngine::Warning,
+ "XInterface subclass %0 being managed via smart pointer, should be managed via uno::Reference, "
+ "parent is %1",
fieldDecl->getLocation())
- << fieldDecl->getSourceRange();
+ << firstTemplateParamType
+ << fieldDecl->getParent()
+ << fieldDecl->getSourceRange();
}
checkUnoReference(fieldDecl->getType(), fieldDecl, aParentName, "field");
diff --git a/compilerplugins/clang/test/refcounting.cxx b/compilerplugins/clang/test/refcounting.cxx
new file mode 100644
index 000000000000..9ee403c55946
--- /dev/null
+++ b/compilerplugins/clang/test/refcounting.cxx
@@ -0,0 +1,19 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <memory>
+#include <com/sun/star/uno/XInterface.hpp>
+
+struct Foo
+{
+ std::unique_ptr<css::uno::XInterface> m_foo1; // expected-error {{XInterface subclass 'com::sun::star::uno::XInterface' being managed via smart pointer, should be managed via uno::Reference, parent is 'Foo' [loplugin:refcounting]}}
+ std::shared_ptr<css::uno::XInterface> m_foo2; // expected-error {{XInterface subclass 'com::sun::star::uno::XInterface' being managed via smart pointer, should be managed via uno::Reference, parent is 'Foo' [loplugin:refcounting]}}
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/connectivity/source/commontools/TIndex.cxx b/connectivity/source/commontools/TIndex.cxx
index 28c1827075eb..539687696c0a 100644
--- a/connectivity/source/commontools/TIndex.cxx
+++ b/connectivity/source/commontools/TIndex.cxx
@@ -37,7 +37,7 @@ OIndexHelper::OIndexHelper( OTableHelper* _pTable) : connectivity::sdbcx::OIndex
{
construct();
std::vector< OUString> aVector;
- m_pColumns.reset( new OIndexColumns(this,m_aMutex,aVector) );
+ m_pColumns = new OIndexColumns(this,m_aMutex,aVector);
}
OIndexHelper::OIndexHelper( OTableHelper* _pTable,
@@ -93,7 +93,7 @@ void OIndexHelper::refreshColumns()
if(m_pColumns)
m_pColumns->reFill(aVector);
else
- m_pColumns.reset( new OIndexColumns(this,m_aMutex,aVector) );
+ m_pColumns = new OIndexColumns(this,m_aMutex,aVector);
}
diff --git a/connectivity/source/commontools/TKey.cxx b/connectivity/source/commontools/TKey.cxx
index 89d5bf44b3f1..815e025602bb 100644
--- a/connectivity/source/commontools/TKey.cxx
+++ b/connectivity/source/commontools/TKey.cxx
@@ -100,7 +100,7 @@ void OTableKeyHelper::refreshColumns()
if ( m_pColumns )
m_pColumns->reFill(aVector);
else
- m_pColumns.reset( new OKeyColumnsHelper(this,m_aMutex,aVector) );
+ m_pColumns = new OKeyColumnsHelper(this,m_aMutex,aVector);
}
diff --git a/connectivity/source/drivers/ado/AGroup.cxx b/connectivity/source/drivers/ado/AGroup.cxx
index b9687d7823bc..274402b61744 100644
--- a/connectivity/source/drivers/ado/AGroup.cxx
+++ b/connectivity/source/drivers/ado/AGroup.cxx
@@ -79,7 +79,7 @@ void OAdoGroup::refreshUsers()
if(m_pUsers)
m_pUsers->reFill(aVector);
else
- m_pUsers.reset( new OUsers(m_pCatalog,m_aMutex,aVector,aUsers,isCaseSensitive()) );
+ m_pUsers = new OUsers(m_pCatalog,m_aMutex,aVector,aUsers,isCaseSensitive());
}
Sequence< sal_Int8 > OAdoGroup::getUnoTunnelImplementationId()
diff --git a/connectivity/source/drivers/ado/AIndex.cxx b/connectivity/source/drivers/ado/AIndex.cxx
index c4ad0bb22273..3f5cffc26487 100644
--- a/connectivity/source/drivers/ado/AIndex.cxx
+++ b/connectivity/source/drivers/ado/AIndex.cxx
@@ -68,7 +68,7 @@ void OAdoIndex::refreshColumns()
if ( m_pColumns )
m_pColumns->reFill(aVector);
else
- m_pColumns.reset( new OColumns(*this,m_aMutex,aVector,aColumns,isCaseSensitive(),m_pConnection) );
+ m_pColumns = new OColumns(*this,m_aMutex,aVector,aColumns,isCaseSensitive(),m_pConnection);
}
diff --git a/connectivity/source/drivers/ado/AKey.cxx b/connectivity/source/drivers/ado/AKey.cxx
index f8797f779a85..d5686893f184 100644
--- a/connectivity/source/drivers/ado/AKey.cxx
+++ b/connectivity/source/drivers/ado/AKey.cxx
@@ -64,7 +64,7 @@ void OAdoKey::refreshColumns()
if(m_pColumns)
m_pColumns->reFill(aVector);
else
- m_pColumns.reset( new OColumns(*this,m_aMutex,aVector,aColumns,isCaseSensitive(),m_pConnection) );
+ m_pColumns = new OColumns(*this,m_aMutex,aVector,aColumns,isCaseSensitive(),m_pConnection);
}
Sequence< sal_Int8 > OAdoKey::getUnoTunnelImplementationId()
diff --git a/connectivity/source/drivers/ado/AUser.cxx b/connectivity/source/drivers/ado/AUser.cxx
index 30e5d5164607..ded62ae2840c 100644
--- a/connectivity/source/drivers/ado/AUser.cxx
+++ b/connectivity/source/drivers/ado/AUser.cxx
@@ -63,7 +63,7 @@ void OAdoUser::refreshGroups()
if(m_pGroups)
m_pGroups->reFill(aVector);
else
- m_pGroups.reset( new OGroups(m_pCatalog,m_aMutex,aVector,aGroups,isCaseSensitive()) );
+ m_pGroups = new OGroups(m_pCatalog,m_aMutex,aVector,aGroups,isCaseSensitive());
}
Sequence< sal_Int8 > OAdoUser::getUnoTunnelImplementationId()
diff --git a/connectivity/source/drivers/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx
index 575b195ca834..2d147b08b181 100644
--- a/connectivity/source/drivers/dbase/DIndex.cxx
+++ b/connectivity/source/drivers/dbase/DIndex.cxx
@@ -103,7 +103,7 @@ void ODbaseIndex::refreshColumns()
if(m_pColumns)
m_pColumns->reFill(aVector);
else
- m_pColumns.reset( new ODbaseIndexColumns(this,m_aMutex,aVector) );
+ m_pColumns = new ODbaseIndexColumns(this,m_aMutex,aVector);
}
Sequence< sal_Int8 > ODbaseIndex::getUnoTunnelImplementationId()
diff --git a/dbaccess/source/core/api/TableDeco.cxx b/dbaccess/source/core/api/TableDeco.cxx
index fb747850163b..1bc5d1d3a7d1 100644
--- a/dbaccess/source/core/api/TableDeco.cxx
+++ b/dbaccess/source/core/api/TableDeco.cxx
@@ -566,7 +566,7 @@ void ODBTableDecorator::refreshColumns()
OContainerMediator* pMediator = new OContainerMediator( pCol, m_xColumnDefinitions );
m_xColumnMediator = pMediator;
pCol->setMediator( pMediator );
- m_pColumns.reset( pCol );
+ m_pColumns = pCol;
}
else
m_pColumns->reFill(aVector);
diff --git a/dbaccess/source/core/inc/TableDeco.hxx b/dbaccess/source/core/inc/TableDeco.hxx
index 79f28a014cfa..7958b7a23c07 100644
--- a/dbaccess/source/core/inc/TableDeco.hxx
+++ b/dbaccess/source/core/inc/TableDeco.hxx
@@ -74,7 +74,7 @@ namespace dbaccess
// <properties>
mutable sal_Int32 m_nPrivileges;
// </properties>
- std::unique_ptr<::connectivity::sdbcx::OCollection> m_pColumns;
+ rtl::Reference<::connectivity::sdbcx::OCollection> m_pColumns;
// IColumnFactory
virtual OColumn* createColumn(const OUString& _rName) const override;
diff --git a/i18npool/inc/defaultnumberingprovider.hxx b/i18npool/inc/defaultnumberingprovider.hxx
index 0fe3ae4b6a5e..d487ec1c4914 100644
--- a/i18npool/inc/defaultnumberingprovider.hxx
+++ b/i18npool/inc/defaultnumberingprovider.hxx
@@ -23,9 +23,10 @@
#include <com/sun/star/text/XNumberingFormatter.hpp>
#include <com/sun/star/text/XNumberingTypeInfo.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <cppuhelper/implbase.hxx>
#include <com/sun/star/i18n/XTransliteration.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <rtl/ref.hxx>
#include <transliterationImpl.hxx>
@@ -74,7 +75,7 @@ public:
private:
css::uno::Reference < css::uno::XComponentContext > m_xContext;
css::uno::Reference < css::container::XHierarchicalNameAccess > xHierarchicalNameAccess;
- std::unique_ptr<TransliterationImpl> translit;
+ rtl::Reference<TransliterationImpl> translit;
/// @throws css::uno::RuntimeException
OUString SAL_CALL makeNumberingIdentifier( sal_Int16 index );
/// @throws css::uno::RuntimeException
diff --git a/i18npool/inc/indexentrysupplier_common.hxx b/i18npool/inc/indexentrysupplier_common.hxx
index 74983cb3708d..bdd042fe779b 100644
--- a/i18npool/inc/indexentrysupplier_common.hxx
+++ b/i18npool/inc/indexentrysupplier_common.hxx
@@ -23,6 +23,7 @@
#include <com/sun/star/i18n/XExtendedIndexEntrySupplier.hpp>
#include <cppuhelper/implbase.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <rtl/ref.hxx>
#include <collatorImpl.hxx>
#include <memory>
@@ -80,7 +81,7 @@ public:
protected:
const sal_Char * implementationName;
bool usePhonetic;
- std::unique_ptr<CollatorImpl>
+ rtl::Reference<CollatorImpl>
collator;
css::lang::Locale aLocale;
OUString aAlgorithm;
diff --git a/i18npool/inc/indexentrysupplier_default.hxx b/i18npool/inc/indexentrysupplier_default.hxx
index e2a6be7fe7f7..0de94706ac2f 100644
--- a/i18npool/inc/indexentrysupplier_default.hxx
+++ b/i18npool/inc/indexentrysupplier_default.hxx
@@ -97,7 +97,7 @@ public:
sal_Int16 mkeys[MAX_KEYS];
sal_Int16 mkey_count;
OUString skipping_chars;
- std::unique_ptr<CollatorImpl> collator;
+ rtl::Reference<CollatorImpl> collator;
sal_Int16 compare(sal_Unicode c1, sal_Unicode c2);
};
diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
index cab75e6f32ac..42abd7bbbf48 100644
--- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
+++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
@@ -647,7 +647,7 @@ DefaultNumberingProvider::makeNumberingString( const Sequence<beans::PropertyVal
OUString transliteration;
getPropertyByName(aProperties, "Transliteration", true) >>= transliteration;
if ( !translit )
- translit.reset( new TransliterationImpl(m_xContext) );
+ translit = new TransliterationImpl(m_xContext);
translit->loadModuleByImplName(transliteration, aLocale);
result += translit->transliterateString2String(tmp, 0, tmp.getLength());
} catch (Exception& ) {
diff --git a/i18npool/source/indexentry/indexentrysupplier_common.cxx b/i18npool/source/indexentry/indexentrysupplier_common.cxx
index 77135523966a..ba7aa0fccfb4 100644
--- a/i18npool/source/indexentry/indexentrysupplier_common.cxx
+++ b/i18npool/source/indexentry/indexentrysupplier_common.cxx
@@ -30,7 +30,7 @@ namespace com { namespace sun { namespace star { namespace i18n {
IndexEntrySupplier_Common::IndexEntrySupplier_Common(const Reference < uno::XComponentContext >& rxContext)
{
implementationName = "com.sun.star.i18n.IndexEntrySupplier_Common";
- collator.reset( new CollatorImpl(rxContext) );
+ collator = new CollatorImpl(rxContext);
usePhonetic = false;
}
diff --git a/include/connectivity/sdbcx/VGroup.hxx b/include/connectivity/sdbcx/VGroup.hxx
index 312f074a841f..80aa1cb321e6 100644
--- a/include/connectivity/sdbcx/VGroup.hxx
+++ b/include/connectivity/sdbcx/VGroup.hxx
@@ -56,7 +56,7 @@ namespace connectivity
public ODescriptor
{
protected:
- std::unique_ptr<OUsers> m_pUsers;
+ rtl::Reference<OUsers> m_pUsers;
using OGroup_BASE::rBHelper;
diff --git a/include/connectivity/sdbcx/VIndex.hxx b/include/connectivity/sdbcx/VIndex.hxx
index 356dcf32b7a0..6cd36f02861f 100644
--- a/include/connectivity/sdbcx/VIndex.hxx
+++ b/include/connectivity/sdbcx/VIndex.hxx
@@ -57,7 +57,7 @@ namespace connectivity
bool m_IsPrimaryKeyIndex;
bool m_IsClustered;
- std::unique_ptr<OCollection> m_pColumns;
+ rtl::Reference<OCollection> m_pColumns;
using ODescriptor_BASE::rBHelper;
virtual void refreshColumns() override;
diff --git a/include/connectivity/sdbcx/VKey.hxx b/include/connectivity/sdbcx/VKey.hxx
index b3f72ecf961f..bafab2761015 100644
--- a/include/connectivity/sdbcx/VKey.hxx
+++ b/include/connectivity/sdbcx/VKey.hxx
@@ -69,7 +69,7 @@ namespace connectivity
{
protected:
std::shared_ptr<KeyProperties> m_aProps;
- std::unique_ptr<OCollection> m_pColumns;
+ rtl::Reference<OCollection> m_pColumns;
using ODescriptor_BASE::rBHelper;
// OPropertyArrayUsageHelper
diff --git a/include/connectivity/sdbcx/VUser.hxx b/include/connectivity/sdbcx/VUser.hxx
index 32981b952fc0..2727f167a029 100644
--- a/include/connectivity/sdbcx/VUser.hxx
+++ b/include/connectivity/sdbcx/VUser.hxx
@@ -53,7 +53,7 @@ namespace connectivity
public ODescriptor
{
protected:
- std::unique_ptr<OGroups> m_pGroups;
+ rtl::Reference<OGroups> m_pGroups;
using OUser_BASE::rBHelper;
diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
index 669944978636..e6b3427eb9a0 100644
--- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx
+++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
@@ -177,7 +177,7 @@ class ScXMLChangeTextPContext : public ScXMLImportContext
OUString sLName;
OUStringBuffer sText;
ScXMLChangeCellContext* pChangeCellContext;
- std::unique_ptr<SvXMLImportContext>
+ rtl::Reference<SvXMLImportContext>
pTextPContext;
sal_uInt16 nPrefix;
@@ -876,8 +876,8 @@ SvXMLImportContext *ScXMLChangeTextPContext::CreateChildContext( sal_uInt16 nTem
if (!pTextPContext)
{
bWasContext = false;
- pTextPContext.reset( GetScImport().GetTextImport()->CreateTextChildContext(
- GetScImport(), nPrefix, sLName, xAttrList) );
+ pTextPContext= GetScImport().GetTextImport()->CreateTextChildContext(
+ GetScImport(), nPrefix, sLName, xAttrList);
}
if (pTextPContext)
{
diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk
index 193d19271f3f..d4c532b6d3c4 100644
--- a/solenv/CompilerTest_compilerplugins_clang.mk
+++ b/solenv/CompilerTest_compilerplugins_clang.mk
@@ -23,6 +23,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \
compilerplugins/clang/test/redundantcast \
compilerplugins/clang/test/redundantcopy \
compilerplugins/clang/test/redundantinline \
+ compilerplugins/clang/test/refcounting \
compilerplugins/clang/test/salbool \
compilerplugins/clang/test/salunicodeliteral \
compilerplugins/clang/test/stringconstant \
diff --git a/sw/source/uibase/inc/dbtree.hxx b/sw/source/uibase/inc/dbtree.hxx
index 1d55c686e3e2..93bb98efbfb6 100644
--- a/sw/source/uibase/inc/dbtree.hxx
+++ b/sw/source/uibase/inc/dbtree.hxx
@@ -34,7 +34,7 @@ class SW_DLLPUBLIC SwDBTreeList : public SvTreeListBox
bool bInitialized;
bool bShowColumns;
- std::unique_ptr<SwDBTreeList_Impl> pImpl;
+ rtl::Reference<SwDBTreeList_Impl> pImpl;
DECL_DLLPRIVATE_LINK( DBCompare, const SvSortData&, sal_Int32 );
diff --git a/xmloff/source/draw/XMLNumberStyles.cxx b/xmloff/source/draw/XMLNumberStyles.cxx
index 8ca660499cc6..6c5506609b61 100644
--- a/xmloff/source/draw/XMLNumberStyles.cxx
+++ b/xmloff/source/draw/XMLNumberStyles.cxx
@@ -484,7 +484,7 @@ private:
bool mbTextual;
bool mbDecimal02;
OUString maText;
- std::shared_ptr< SvXMLImportContext > mpSlaveContext;
+ rtl::Reference< SvXMLImportContext > mxSlaveContext;
public:
@@ -511,7 +511,7 @@ SdXMLNumberFormatMemberImportContext::SdXMLNumberFormatMemberImportContext( SvXM
: SvXMLImportContext(rImport, nPrfx, rLocalName),
mpParent( pParent ),
maNumberStyle( rLocalName ),
- mpSlaveContext( pSlaveContext )
+ mxSlaveContext( pSlaveContext )
{
mbLong = false;
mbTextual = false;
@@ -548,17 +548,17 @@ SvXMLImportContext *SdXMLNumberFormatMemberImportContext::CreateChildContext( sa
const OUString& rLocalName,
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList )
{
- return mpSlaveContext->CreateChildContext( nPrefix, rLocalName, xAttrList );
+ return mxSlaveContext->CreateChildContext( nPrefix, rLocalName, xAttrList );
}
void SdXMLNumberFormatMemberImportContext::StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList )
{
- mpSlaveContext->StartElement( xAttrList );
+ mxSlaveContext->StartElement( xAttrList );
}
void SdXMLNumberFormatMemberImportContext::EndElement()
{
- mpSlaveContext->EndElement();
+ mxSlaveContext->EndElement();
if( mpParent )
mpParent->add( maNumberStyle, mbLong, mbTextual, mbDecimal02, maText );
@@ -566,7 +566,7 @@ void SdXMLNumberFormatMemberImportContext::EndElement()
void SdXMLNumberFormatMemberImportContext::Characters( const OUString& rChars )
{
- mpSlaveContext->Characters( rChars );
+ mxSlaveContext->Characters( rChars );
maText += rChars;
}