From f71606c920a3f78294da745cd9ef1eacde010224 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 9 Jun 2022 08:36:33 +0200 Subject: new loplugin:moveit look for local variables that can be std::move'd to parameters off by default, since it doesn't do proper data flow analysis Change-Id: I3403a0fcffd165bdea6a772528bc53995c5fdb40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135527 Tested-by: Jenkins Reviewed-by: Noel Grandin --- basic/source/classes/sbunoobj.cxx | 6 +- .../MovingAverageRegressionCurveCalculator.cxx | 6 +- compilerplugins/clang/moveit.cxx | 250 +++++++++++++++++++++ compilerplugins/clang/test/moveit.cxx | 60 +++++ cui/source/dialogs/SpellDialog.cxx | 2 +- cui/source/options/optasian.cxx | 2 +- cui/source/options/optgdlg.cxx | 3 +- cui/source/tabpages/autocdlg.cxx | 4 +- desktop/source/app/officeipcthread.cxx | 4 +- .../source/primitive2d/svggradientprimitive2d.cxx | 2 +- editeng/source/editeng/editdoc.cxx | 2 +- editeng/source/editeng/impedit5.cxx | 2 +- editeng/source/items/svxfont.cxx | 6 +- editeng/source/misc/svxacorr.cxx | 2 +- emfio/source/reader/emfreader.cxx | 14 +- emfio/source/reader/mtftools.cxx | 2 +- emfio/source/reader/wmfreader.cxx | 4 +- filter/source/msfilter/svdfppt.cxx | 2 +- filter/source/pdf/pdfexport.cxx | 2 +- forms/source/runtime/formoperations.cxx | 4 +- .../source/hyphenator/hyphen/hyphenimp.cxx | 2 +- .../source/thesaurus/libnth/nthesimp.cxx | 2 +- reportdesign/source/ui/misc/UITools.cxx | 3 +- sc/source/ui/docshell/externalrefmgr.cxx | 2 +- sc/source/ui/view/viewfun2.cxx | 4 +- scripting/source/stringresource/stringresource.cxx | 4 +- sd/source/core/drawdoc.cxx | 3 +- sd/source/ui/animations/CustomAnimationList.cxx | 2 +- sdext/source/pdfimport/wrapper/wrapper.cxx | 2 +- sfx2/source/control/dispatch.cxx | 2 +- solenv/CompilerTest_compilerplugins_clang.mk | 1 + sot/source/sdstor/stgdir.cxx | 6 +- .../sdr/contact/viewobjectcontactofe3dscene.cxx | 2 +- sw/source/core/SwNumberTree/SwNumberTree.cxx | 2 +- sw/source/core/bastyp/calc.cxx | 2 +- sw/source/core/edit/edlingu.cxx | 4 +- sw/source/core/fields/expfld.cxx | 3 +- sw/source/core/fields/reffld.cxx | 6 +- sw/source/core/text/guess.cxx | 2 +- sw/source/core/txtnode/thints.cxx | 2 +- sw/source/filter/ww8/ww8scan.cxx | 2 +- toolkit/source/controls/unocontrolmodel.cxx | 3 +- ucb/source/ucp/cmis/cmis_content.cxx | 2 +- unoidl/source/sourceprovider-parser.y | 2 +- unoxml/source/rdf/librdf_repository.cxx | 2 +- vcl/jsdialog/jsdialogbuilder.cxx | 3 +- vcl/qt5/QtBitmap.cxx | 4 +- vcl/source/control/fmtfield.cxx | 3 +- vcl/source/uitest/uno/uiobject_uno.cxx | 2 +- vcl/unx/generic/printer/cpdmgr.cxx | 2 +- .../source/rtftok/rtfdispatchdestination.cxx | 2 +- writerfilter/source/rtftok/rtfdispatchsymbol.cxx | 2 +- writerfilter/source/rtftok/rtfdispatchvalue.cxx | 2 +- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 54 ++--- writerfilter/source/rtftok/rtfsdrimport.cxx | 2 +- xmloff/source/style/xmlnumfe.cxx | 4 +- 56 files changed, 413 insertions(+), 113 deletions(-) create mode 100644 compilerplugins/clang/moveit.cxx create mode 100644 compilerplugins/clang/test/moveit.cxx diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 06b67ba8bd86..51b1b956b170 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -2053,7 +2053,7 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { if ( pProp->isUnoStruct() ) { - SbUnoStructRefObject* pSbUnoObject = new SbUnoStructRefObject( pProp->GetName(), aMember ); + SbUnoStructRefObject* pSbUnoObject = new SbUnoStructRefObject( pProp->GetName(), std::move(aMember) ); SbxObjectRef xWrapper = static_cast(pSbUnoObject); pVar->PutObject( xWrapper.get() ); } @@ -4679,7 +4679,7 @@ SbxVariable* SbUnoStructRefObject::Find( const OUString& rName, SbxClassType t ) Property aProp; aProp.Name = rName; aProp.Type = css::uno::Type( it->second->getTypeClass(), it->second->getTypeName() ); - SbUnoProperty* pProp = new SbUnoProperty( rName, eSbxType, eRealSbxType, aProp, 0, false, ( aProp.Type.getTypeClass() == css::uno::TypeClass_STRUCT) ); + SbUnoProperty* pProp = new SbUnoProperty( rName, eSbxType, eRealSbxType, std::move(aProp), 0, false, ( aProp.Type.getTypeClass() == css::uno::TypeClass_STRUCT) ); SbxVariableRef xVarRef = pProp; QuickInsert( xVarRef.get() ); pRes = xVarRef.get(); @@ -4739,7 +4739,7 @@ void SbUnoStructRefObject::implCreateAll() Property aProp; aProp.Name = rName; aProp.Type = css::uno::Type( field.second->getTypeClass(), field.second->getTypeName() ); - SbUnoProperty* pProp = new SbUnoProperty( rName, eSbxType, eRealSbxType, aProp, 0, false, ( aProp.Type.getTypeClass() == css::uno::TypeClass_STRUCT) ); + SbUnoProperty* pProp = new SbUnoProperty( rName, eSbxType, eRealSbxType, std::move(aProp), 0, false, ( aProp.Type.getTypeClass() == css::uno::TypeClass_STRUCT) ); SbxVariableRef xVarRef = pProp; QuickInsert( xVarRef.get() ); } diff --git a/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx b/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx index 227a509ad3f0..6236f73b398d 100644 --- a/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx +++ b/chart2/source/tools/MovingAverageRegressionCurveCalculator.cxx @@ -62,19 +62,19 @@ void SAL_CALL MovingAverageRegressionCurveCalculator::recalculateRegression( case MovingAverageType::Central: { - calculateValuesCentral(aValues); + calculateValuesCentral(std::move(aValues)); break; } case MovingAverageType::AveragedAbscissa: { - calculateValues(aValues, true); + calculateValues(std::move(aValues), true); break; } case MovingAverageType::Prior: default: { - calculateValues(aValues, false); + calculateValues(std::move(aValues), false); break; } } diff --git a/compilerplugins/clang/moveit.cxx b/compilerplugins/clang/moveit.cxx new file mode 100644 index 000000000000..353359e28405 --- /dev/null +++ b/compilerplugins/clang/moveit.cxx @@ -0,0 +1,250 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * Based on LLVM/Clang. + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + */ + +#include +#include +#include +#include +#include "config_clang.h" +#include "plugin.hxx" +#include "check.hxx" + +/* +Look for local variables that can be std::move'd into parameters. + +TODO +(*) Ideally we would use a proper data-flow analysis, to detect that the var is dead after this point, + like the one in clang at include/clang/Analysis/CFG.h +(*) we could expand the set of approved/interesting types +*/ + +namespace +{ +class MoveIt : public loplugin::FilteringPlugin +{ +public: + explicit MoveIt(loplugin::InstantiationData const& data) + : FilteringPlugin(data) + { + } + + virtual bool preRun() override + { + std::string fn(handler.getMainFileName()); + loplugin::normalizeDotDotInFilePath(fn); + // false + + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/basic/source/classes/sbunoobj.cxx")) + return false; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/svx/source/svdraw/textchainflow.cxx")) + return false; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/svx/source/unodraw/unoshtxt.cxx")) + return false; + if (loplugin::hasPathnamePrefix(fn, + SRCDIR "/connectivity/source/drivers/dbase/dindexnode.cxx")) + return false; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/basctl/source/basicide/moduldlg.cxx")) + return false; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/core/SwNumberTree/SwNumberTree.cxx")) + return false; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sc/source/core/tool/scmatrix.cxx")) + return false; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/core/bastyp/calc.cxx")) + return false; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/core/edit/edattr.cxx")) + return false; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/core/fields/expfld.cxx")) + return false; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/uibase/docvw/edtwin.cxx")) + return false; + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sw/source/uibase/uiview/viewling.cxx")) + return false; + if (loplugin::hasPathnamePrefix( + fn, SRCDIR "/writerfilter/source/dmapper/DomainMapperTableHandler.cxx")) + return false; + return true; + } + + virtual void run() override + { + if (preRun()) + TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); + } + + bool VisitCXXMemberCallExpr(const CXXMemberCallExpr*); + bool VisitCXXConstructExpr(const CXXConstructExpr*); + +private: + bool isInterestingType(QualType); +}; + +bool MoveIt::VisitCXXMemberCallExpr(const CXXMemberCallExpr* topExpr) +{ + if (ignoreLocation(topExpr)) + return true; + const CXXMethodDecl* methodDecl = topExpr->getMethodDecl(); + if (!methodDecl) + return true; + + unsigned len = std::min(topExpr->getNumArgs(), methodDecl->getNumParams()); + for (unsigned i = 0; i < len; ++i) + { + // check if the parameter is a moveable type + const ParmVarDecl* parmVarDecl = methodDecl->getParamDecl(i); + if (!parmVarDecl->getType()->isRecordType()) + continue; + const CXXRecordDecl* recordDecl + = dyn_cast(parmVarDecl->getType()->getAsRecordDecl()); + if (!recordDecl || !recordDecl->hasMoveConstructor() || recordDecl->isTriviallyCopyable()) + continue; + if (!isInterestingType(parmVarDecl->getType())) + continue; + + // check if (a) we're making a copy to pass to the param and (b) we're making a copy of a local var + const Expr* argExpr = topExpr->getArg(i); + if (!argExpr) + continue; + const CXXConstructExpr* argSubExpr = dyn_cast(argExpr->IgnoreImplicit()); + if (!argSubExpr || argSubExpr->getNumArgs() == 0) + continue; + const DeclRefExpr* dre = dyn_cast(argSubExpr->getArg(0)->IgnoreImplicit()); + if (!dre) + continue; + const VarDecl* localVarDecl = dyn_cast(dre->getDecl()); + if (!localVarDecl || localVarDecl->getType()->isReferenceType() + || localVarDecl->getType()->isPointerType() || !localVarDecl->hasLocalStorage()) + continue; + // because sometimes the parameter type is some obscured STL thing + if (!isInterestingType(localVarDecl->getType())) + continue; + + report(DiagnosticsEngine::Warning, "can std::move this var into this param", + argExpr->getBeginLoc()); + report(DiagnosticsEngine::Note, "passing to this param", parmVarDecl->getBeginLoc()); + report(DiagnosticsEngine::Note, "local var declared here", localVarDecl->getBeginLoc()); + report(DiagnosticsEngine::Note, "type declared here", recordDecl->getBeginLoc()); + // parmVarDecl->getType()->dump(); + } + + // StringRef aFileName = getFilenameOfLocation( + // compiler.getSourceManager().getSpellingLoc(parmVarDecl->getBeginLoc())); + // if (loplugin::hasPathnamePrefix(aFileName, + // SRCDIR "/svx/source/sidebar/line/LineWidthValueSet.cxx")) + // return true; + + return true; +} + +bool MoveIt::VisitCXXConstructExpr(const CXXConstructExpr* topExpr) +{ + if (ignoreLocation(topExpr)) + return true; + if (isa(topExpr)) + return true; + const CXXConstructorDecl* methodDecl = topExpr->getConstructor(); + if (!methodDecl) + return true; + + unsigned len = std::min(topExpr->getNumArgs(), methodDecl->getNumParams()); + for (unsigned i = 0; i < len; ++i) + { + // check if the parameter is a moveable type + const ParmVarDecl* parmVarDecl = methodDecl->getParamDecl(i); + if (!parmVarDecl->getType()->isRecordType()) + continue; + const CXXRecordDecl* recordDecl + = dyn_cast(parmVarDecl->getType()->getAsRecordDecl()); + if (!recordDecl || !recordDecl->hasMoveConstructor() || recordDecl->isTriviallyCopyable()) + continue; + if (!isInterestingType(parmVarDecl->getType())) + continue; + + // check if (a) we're making a copy to pass to the param and (b) we're making a copy of a local var + const Expr* argExpr = topExpr->getArg(i); + if (!argExpr) + continue; + const CXXConstructExpr* argSubExpr = dyn_cast(argExpr->IgnoreImplicit()); + if (!argSubExpr || argSubExpr->getNumArgs() == 0) + continue; + const DeclRefExpr* dre = dyn_cast(argSubExpr->getArg(0)->IgnoreImplicit()); + if (!dre) + continue; + const VarDecl* localVarDecl = dyn_cast(dre->getDecl()); + if (!localVarDecl || localVarDecl->getType()->isReferenceType() + || localVarDecl->getType()->isPointerType() || !localVarDecl->hasLocalStorage()) + continue; + // because sometimes the parameter type is some obscured STL thing + if (!isInterestingType(localVarDecl->getType())) + continue; + + report(DiagnosticsEngine::Warning, "can std::move this var into this param", + argExpr->getBeginLoc()); + report(DiagnosticsEngine::Note, "passing to this param", parmVarDecl->getBeginLoc()); + report(DiagnosticsEngine::Note, "local var declared here", localVarDecl->getBeginLoc()); + report(DiagnosticsEngine::Note, "type declared here", recordDecl->getBeginLoc()); + // parmVarDecl->getType()->dump(); + } + + // StringRef aFileName = getFilenameOfLocation( + // compiler.getSourceManager().getSpellingLoc(parmVarDecl->getBeginLoc())); + // if (loplugin::hasPathnamePrefix(aFileName, + // SRCDIR "/svx/source/sidebar/line/LineWidthValueSet.cxx")) + // return true; + + return true; +} + +/// Exclude boring types, so that we don't generate too many low-value conversions. +/// e.g. for now I ignore ref-counted types like Sequence and OUString and css::uno::Reference, +/// because that generates too many changes +bool MoveIt::isInterestingType(QualType qt) +{ + if (qt->isEnumeralType()) + return false; + if (!qt->isRecordType()) + return false; + + auto tc = loplugin::TypeCheck(qt); + + // clang-format off + return !tc.ClassOrStruct("iterator") + && !tc.ClassOrStruct("const_iterator") + && !tc.Typedef("iterator") + && !tc.Typedef("const_iterator") + && !tc.Class("_Safe_iterator") + && !tc.Typedef("string") + && !tc.ClassOrStruct("shared_ptr").StdNamespace() + && !tc.ClassOrStruct("shared_ptr").Namespace("boost") + && !tc.Class("B2DHomMatrix").Namespace("basegfx").GlobalNamespace() + && !tc.Class("Pipe").Namespace("osl") + && !tc.Class("Any").Namespace("uno") + && !tc.Class("TypeDescription").Namespace("uno") + && !tc.Class("UnoInterfaceReference").Namespace("uno") + && !tc.Class("ByteSequence").Namespace("rtl").GlobalNamespace() + && !tc.Class("OUString").Namespace("rtl").GlobalNamespace() + && !tc.Class("OString").Namespace("rtl").GlobalNamespace() + && !tc.Class("BinaryAny") + && !tc.Class("Reference") + && !tc.Class("SvRef").Namespace("tools").GlobalNamespace() + && !tc.ClassOrStruct("sk_sp") // skia shared pointer + && !tc.ClassOrStruct("VclPtr") + && !tc.Typedef("IterString") // SalInstanceTreeView::IterString + && !tc.Typedef("svtree_render_args") + && !tc.Typedef("render_args") // weld::ComboBox::render_args + ; + // clang-format on +} + +/// off by default because each warning needs to be hand checked to ensure it is not a false+ +loplugin::Plugin::Registration moveit("moveit", false); + +} // namespace + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/compilerplugins/clang/test/moveit.cxx b/compilerplugins/clang/test/moveit.cxx new file mode 100644 index 000000000000..06424a6d9cb4 --- /dev/null +++ b/compilerplugins/clang/test/moveit.cxx @@ -0,0 +1,60 @@ +/* -*- 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 "config_clang.h" +#include + +// expected-note@+3 {{type declared here [loplugin:moveit]}} +// expected-note@+2 {{type declared here [loplugin:moveit]}} +// expected-note@+1 {{type declared here [loplugin:moveit]}} +struct Movable +{ + std::shared_ptr x; +}; + +namespace test1 +{ +struct F +{ + // expected-note@+1 {{passing to this param [loplugin:moveit]}} + void call_by_value(Movable); + // expected-note@+1 {{passing to this param [loplugin:moveit]}} + F(Movable); + void foo() + { + // expected-note@+2 {{local var declared here [loplugin:moveit]}} + // expected-note@+1 {{local var declared here [loplugin:moveit]}} + Movable m; + // expected-error@+1 {{can std::move this var into this param [loplugin:moveit]}} + call_by_value(m); + // expected-error@+1 {{can std::move this var into this param [loplugin:moveit]}} + F a(m); + (void)a; + } +}; +} + +namespace test2 +{ +struct F +{ + // expected-note@+1 {{passing to this param [loplugin:moveit]}} + F(Movable); + void foo() + { + // expected-note@+1 {{local var declared here [loplugin:moveit]}} + Movable m; + // expected-error@+1 {{can std::move this var into this param [loplugin:moveit]}} + F a(m); + (void)a; + } +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 69cd05462fdf..a537e4060c99 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -1808,7 +1808,7 @@ void SentenceEditWindow_Impl::SetAlternatives( const Reference< XSpellAlternativ aLocale = xAlt->getLocale(); aAlts = xAlt->getAlternatives(); } - SpellErrorDescription aDesc( false, aWord, aLocale, aAlts, nullptr); + SpellErrorDescription aDesc( false, aWord, std::move(aLocale), aAlts, nullptr); SfxGrabBagItem aSpellErrorDescription(EE_CHAR_GRABBAG); aSpellErrorDescription.GetGrabBag()["SpellErrorDescription"] <<= aDesc.toSequence(); SetAttrib(aSpellErrorDescription, m_nErrorStart, m_nErrorEnd); diff --git a/cui/source/options/optasian.cxx b/cui/source/options/optasian.cxx index 50dce2c1cb8e..84d23b42e906 100644 --- a/cui/source/options/optasian.cxx +++ b/cui/source/options/optasian.cxx @@ -320,7 +320,7 @@ IMPL_LINK_NOARG(SvxAsianLayoutPage, LanguageHdl, weld::ComboBox&, void) } if(!bAvail) { - LocaleDataWrapper aWrap( aLanguageTag ); + LocaleDataWrapper aWrap( std::move(aLanguageTag) ); ForbiddenCharacters aForbidden = aWrap.getForbiddenCharacters(); sStart = aForbidden.beginLine; sEnd = aForbidden.endLine; diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 4a7778973471..f1e3fcf4bf45 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -1680,8 +1680,7 @@ IMPL_LINK_NOARG(OfaLanguagesTabPage, LocaleSettingHdl, weld::ComboBox&, void) m_xCurrencyLB->set_active_text(aDefaultCurr); // obtain corresponding locale data - LanguageTag aLanguageTag( eLang); - LocaleDataWrapper aLocaleWrapper( aLanguageTag ); + LocaleDataWrapper aLocaleWrapper(( LanguageTag(eLang) )); // update the decimal separator key of the related CheckBox OUString sTempLabel(m_sDecimalSeparatorLabel); diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index 3892fba34e2f..2947c16e3730 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -699,7 +699,7 @@ OfaAutocorrReplacePage::OfaAutocorrReplacePage(weld::Container* pPage, weld::Dia LanguageTag aLanguageTag( eLastDialogLanguage ); pCompareClass.reset( new CollatorWrapper( comphelper::getProcessComponentContext() ) ); pCompareClass->loadDefaultCollator( aLanguageTag.getLocale(), 0 ); - pCharClass.reset( new CharClass( aLanguageTag ) ); + pCharClass.reset( new CharClass( std::move(aLanguageTag) ) ); auto nColWidth = m_xReplaceTLB->get_approximate_digit_width() * 32; m_aReplaceFixedWidths.push_back(nColWidth); @@ -904,7 +904,7 @@ void OfaAutocorrReplacePage::SetLanguage(LanguageType eSet) LanguageTag aLanguageTag( eLastDialogLanguage ); pCompareClass.reset( new CollatorWrapper( comphelper::getProcessComponentContext() ) ); pCompareClass->loadDefaultCollator( aLanguageTag.getLocale(), 0 ); - pCharClass.reset( new CharClass( aLanguageTag ) ); + pCharClass.reset( new CharClass( std::move(aLanguageTag) ) ); ModifyHdl(*m_xShortED); } } diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index a29944013711..e559f7253e53 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -663,9 +663,7 @@ void RequestHandler::EnableRequests() if (pGlobal->mState != State::Downing) { pGlobal->mState = State::RequestsEnabled; } - // hit the compiler over the head - this avoids GCC -Werror=maybe-uninitialized - std::optional tmp; - ProcessDocumentsRequest aEmptyReq(tmp); + ProcessDocumentsRequest aEmptyReq(std::nullopt); // trigger already queued requests RequestHandler::ExecuteCmdLineRequests(aEmptyReq, true); } diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx index 263ee8f4d387..6b49c4b49d7e 100644 --- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx @@ -555,7 +555,7 @@ namespace drawinglayer::primitive2d aUnitRange.getMaxX()); } - createResult(rContainer, aTargetColor, aTargetOpacity, aUnitGradientToObject); + createResult(rContainer, std::move(aTargetColor), std::move(aTargetOpacity), aUnitGradientToObject); } } diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 2793aaee0868..7621f7c0cd3f 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -2284,7 +2284,7 @@ EditPaM EditDoc::InsertParaBreak( EditPaM aPaM, bool bKeepEndingAttribs ) aContentAttribs.GetItems().Put( SfxBoolItem( EE_PARA_BULLETSTATE, true) ); // ContentNode constructor copies also the paragraph attributes - ContentNode* pNode = new ContentNode( aStr, aContentAttribs ); + ContentNode* pNode = new ContentNode( aStr, std::move(aContentAttribs) ); // Copy the Default Font pNode->GetCharAttribs().GetDefFont() = aPaM.GetNode()->GetCharAttribs().GetDefFont(); diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index 6b20acfd0f87..79825dc4d752 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -192,7 +192,7 @@ std::unique_ptr ImpEditEngine::CreateAttribUndo( EditSelecti { SfxItemSet aTmpSet( GetEmptyItemSet() ); aTmpSet.Put( rSet ); - pUndo.reset( new EditUndoSetAttribs(pEditEngine, aESel, aTmpSet) ); + pUndo.reset( new EditUndoSetAttribs(pEditEngine, aESel, std::move(aTmpSet)) ); } else { diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx index 839240f828df..ca8c5f3fddc6 100644 --- a/editeng/source/items/svxfont.cxx +++ b/editeng/source/items/svxfont.cxx @@ -173,8 +173,7 @@ OUString SvxFont::CalcCaseMap(const OUString &rTxt) const const LanguageType eLang = LANGUAGE_DONTKNOW == GetLanguage() ? LANGUAGE_SYSTEM : GetLanguage(); - LanguageTag aLanguageTag(eLang); - CharClass aCharClass( aLanguageTag ); + CharClass aCharClass(( LanguageTag(eLang) )); switch( eCaseMap ) { @@ -283,8 +282,7 @@ void SvxFont::DoOnCapitals(SvxDoCapitals &rDo) const const LanguageType eLang = LANGUAGE_DONTKNOW == GetLanguage() ? LANGUAGE_SYSTEM : GetLanguage(); - LanguageTag aLanguageTag(eLang); - CharClass aCharClass( aLanguageTag ); + CharClass aCharClass(( LanguageTag(eLang) )); OUString aCharString; while( nPos < nTxtLen ) diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index c014656b09cf..ff93ecee8c91 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -225,7 +225,7 @@ static LocaleDataWrapper& GetLocaleDataWrapper( LanguageType nLang ) static std::unique_ptr xLclDtWrp; LanguageTag aLcl( nLang ); if (!xLclDtWrp || xLclDtWrp->getLoadedLanguageTag() != aLcl) - xLclDtWrp.reset(new LocaleDataWrapper(aLcl)); + xLclDtWrp.reset(new LocaleDataWrapper(std::move(aLcl))); return *xLclDtWrp; } static TransliterationWrapper& GetIgnoreTranslWrapper() diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx index 389414c79b9f..1613fd859674 100644 --- a/emfio/source/reader/emfreader.cxx +++ b/emfio/source/reader/emfreader.cxx @@ -730,7 +730,7 @@ namespace emfio for ( sal_uInt32 i = 0; ( i < nNumberOfPolylines ) && mpInputStream->good(); i++ ) { tools::Polygon aPolygon = ReadPolygon(0, pnPolylinePointCount[i], nNextPos); - DrawPolyLine(aPolygon, false, mbRecordPath); + DrawPolyLine(std::move(aPolygon), false, mbRecordPath); } } @@ -1218,7 +1218,7 @@ namespace emfio tools::Long dh = h / 2; Point aCenter( nX32 + dw, nY32 + dh ); tools::Polygon aPoly( aCenter, dw, dh ); - DrawPolygon( aPoly, mbRecordPath ); + DrawPolygon( std::move(aPoly), mbRecordPath ); } } break; @@ -1233,7 +1233,7 @@ namespace emfio Point(nX32, ny32) }; tools::Polygon aPoly(4, aPoints); aPoly.Optimize( PolyOptimizeFlags::CLOSE ); - DrawPolygon( aPoly, mbRecordPath ); + DrawPolygon( std::move(aPoly), mbRecordPath ); } break; @@ -1241,7 +1241,7 @@ namespace emfio { mpInputStream->ReadInt32( nX32 ).ReadInt32( nY32 ).ReadInt32( nx32 ).ReadInt32( ny32 ).ReadUInt32( nW ).ReadUInt32( nH ); tools::Polygon aRoundRectPoly( ReadRectangle( nX32, nY32, nx32, ny32 ), nW, nH ); - DrawPolygon( aRoundRectPoly, mbRecordPath ); + DrawPolygon( std::move(aRoundRectPoly), mbRecordPath ); } break; @@ -1259,9 +1259,9 @@ namespace emfio tools::Polygon aPoly(ReadRectangle(nX32, nY32, nx32, ny32), Point(nStartX, nStartY), Point(nEndX, nEndY), PolyStyle::Arc, IsArcDirectionClockWise()); if ( nRecType == EMR_CHORD ) - DrawPolygon( aPoly, mbRecordPath ); + DrawPolygon( std::move(aPoly), mbRecordPath ); else - DrawPolyLine( aPoly, nRecType == EMR_ARCTO, mbRecordPath ); + DrawPolyLine( std::move(aPoly), nRecType == EMR_ARCTO, mbRecordPath ); } } break; @@ -1275,7 +1275,7 @@ namespace emfio else { tools::Polygon aPoly(ReadRectangle(nX32, nY32, nx32, ny32), Point(nStartX, nStartY), Point(nEndX, nEndY), PolyStyle::Pie, IsArcDirectionClockWise()); - DrawPolygon( aPoly, mbRecordPath ); + DrawPolygon( std::move(aPoly), mbRecordPath ); } } break; diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx index 5cb43ec68510..85429a50152e 100644 --- a/emfio/source/reader/mtftools.cxx +++ b/emfio/source/reader/mtftools.cxx @@ -1330,7 +1330,7 @@ namespace emfio maFillStyle = maBkColor; mnBkMode = BackgroundMode::OPAQUE; ImplSetNonPersistentLineColorTransparenz(); - DrawPolygon(aPoly, false); + DrawPolygon(std::move(aPoly), false); mnBkMode = mnBkModeBackup; // The rectangle needs to be always drawned even if mode is transparent maFillStyle = aFillStyleBackup; maLineStyle.bTransparent = aTransparentBackup; diff --git a/emfio/source/reader/wmfreader.cxx b/emfio/source/reader/wmfreader.cxx index 5f6eeed66757..32b31e015cbc 100644 --- a/emfio/source/reader/wmfreader.cxx +++ b/emfio/source/reader/wmfreader.cxx @@ -474,7 +474,7 @@ namespace emfio tools::Polygon aPoly(nPoints); for (sal_uInt16 i(0); i < nPoints && mpInputStream->good(); ++i) aPoly[ i ] = ReadPoint(); - DrawPolygon(aPoly, false/*bRecordPath*/); + DrawPolygon(std::move(aPoly), false/*bRecordPath*/); } SAL_WARN_IF(!bRecordOk, "emfio", "polygon record has more points than we can handle"); @@ -581,7 +581,7 @@ namespace emfio tools::Polygon aPoly(nPoints); for (sal_uInt16 i(0); i < nPoints && mpInputStream->good(); ++i) aPoly[ i ] = ReadPoint(); - DrawPolyLine( aPoly ); + DrawPolyLine( std::move(aPoly) ); } SAL_WARN_IF(!bRecordOk, "emfio", "polyline record has more points than we can handle"); diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index 7c9f10d451ea..74f8da16fac6 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -3284,7 +3284,7 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const if ( SvxMSDffManager::GetBLIPDirect( rSt, aGraphic ) ) { sal_uInt32 nInstance = aBuGraAtomHd.nRecInstance; - PPTBuGraEntry* pBuGra = new PPTBuGraEntry( aGraphic, nInstance ); + PPTBuGraEntry* pBuGra = new PPTBuGraEntry( std::move(aGraphic), nInstance ); size_t n = 0; size_t nBuGraCount = aBuGraList.size(); if ( nBuGraCount ) diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 80aca22bc13a..54a3f11f60ba 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -1093,7 +1093,7 @@ void PDFExport::showErrors( const std::set< vcl::PDFWriter::ErrorCode >& rErrors { task::PDFExportException aExc; aExc.ErrorCodes = comphelper::containerToSequence( rErrors ); - Reference< task::XInteractionRequest > xReq( new PDFErrorRequest( aExc ) ); + Reference< task::XInteractionRequest > xReq( new PDFErrorRequest( std::move(aExc) ) ); mxIH->handle( xReq ); } } diff --git a/forms/source/runtime/formoperations.cxx b/forms/source/runtime/formoperations.cxx index 390319dad9df..11207991dace 100644 --- a/forms/source/runtime/formoperations.cxx +++ b/forms/source/runtime/formoperations.cxx @@ -1545,7 +1545,7 @@ namespace frm m_xParser->setOrder( OUString() ); impl_appendOrderByColumn_throw aAction(this, xBoundField, _bUp); - impl_doActionInSQLContext_throw(aAction, RID_STR_COULD_NOT_SET_ORDER ); + impl_doActionInSQLContext_throw(std::move(aAction), RID_STR_COULD_NOT_SET_ORDER ); weld::WaitObject aWO(Application::GetFrameWeld(GetDialogParent())); try @@ -1616,7 +1616,7 @@ namespace frm } impl_appendFilterByColumn_throw aAction(this, m_xParser, xBoundField); - impl_doActionInSQLContext_throw( aAction, RID_STR_COULD_NOT_SET_FILTER ); + impl_doActionInSQLContext_throw( std::move(aAction), RID_STR_COULD_NOT_SET_FILTER ); weld::WaitObject aWO(Application::GetFrameWeld(GetDialogParent())); try diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx index 9ccc1210956a..8ac156ef8cb3 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx @@ -177,7 +177,7 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales() mvDicts[k].aPtr = nullptr; mvDicts[k].eEnc = RTL_TEXTENCODING_DONTKNOW; mvDicts[k].aLoc = aLanguageTag.getLocale(); - mvDicts[k].apCC.reset( new CharClass( aLanguageTag ) ); + mvDicts[k].apCC.reset( new CharClass( std::move(aLanguageTag) ) ); // also both files have to be in the same directory and the // file names must only differ in the extension (.aff/.dic). // Thus we use the first location only and strip the extension part. diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx index ca29cca2ac52..ea3e3af8ddc1 100644 --- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx +++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx @@ -175,7 +175,7 @@ Sequence< Locale > SAL_CALL Thesaurus::getLocales() LanguageTag aLanguageTag(rLocaleName); mvThesInfo[k].aEncoding = RTL_TEXTENCODING_DONTKNOW; mvThesInfo[k].aLocale = aLanguageTag.getLocale(); - mvThesInfo[k].aCharSetInfo.reset( new CharClass( aLanguageTag ) ); + mvThesInfo[k].aCharSetInfo.reset( new CharClass( std::move(aLanguageTag) ) ); // also both files have to be in the same directory and the // file names must only differ in the extension (.aff/.dic). // Thus we use the first location only and strip the extension part. diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index e0560bc1163d..5593f44ef9f9 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -1020,8 +1020,7 @@ bool openDialogFormula_nothrow( OUString& _in_out_rFormula auto pFormulaManager = std::make_shared(xMgr); ReportFormula aFormula( _in_out_rFormula ); - LanguageTag aLangTag(LANGUAGE_SYSTEM); - CharClass aCC(_xContext, aLangTag); + CharClass aCC(_xContext, LanguageTag(LANGUAGE_SYSTEM)); svl::SharedStringPool aStringPool(aCC); FormulaDialog aDlg( diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index b3933bfbf817..a0f93781b0f5 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -872,7 +872,7 @@ void ScExternalRefCache::setCellRangeData(sal_uInt16 nFileId, const ScRange& rRa }; pMat->ExecuteOperation(std::pair(0, 0), std::pair(nRow2-nRow1, nCol2-nCol1), - aDoubleFunc, aBoolFunc, aStringFunc, aEmptyFunc); + std::move(aDoubleFunc), std::move(aBoolFunc), std::move(aStringFunc), std::move(aEmptyFunc)); // Mark the whole range 'cached'. pTabData->setCachedCellRange(nCol1, nRow1, nCol2, nRow2); } diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 0327a94ca249..7fe941e33dd6 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -1112,7 +1112,7 @@ void ScViewFunc::SetPrintRanges( bool bEntireSheet, const OUString* pPrint, rDoc.SetRepeatColRange( nTab, std::nullopt ); else if ( aRange.ParseAny( *pRepCol, rDoc, aDetails ) & ScRefFlags::VALID ) - rDoc.SetRepeatColRange( nTab, aRange ); + rDoc.SetRepeatColRange( nTab, std::move(aRange) ); } // repeat rows @@ -1123,7 +1123,7 @@ void ScViewFunc::SetPrintRanges( bool bEntireSheet, const OUString* pPrint, rDoc.SetRepeatRowRange( nTab, std::nullopt ); else if ( aRange.ParseAny( *pRepRow, rDoc, aDetails ) & ScRefFlags::VALID ) - rDoc.SetRepeatRowRange( nTab, aRange ); + rDoc.SetRepeatRowRange( nTab, std::move(aRange) ); } } diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx index e3208321d987..d9a2e377e5ec 100644 --- a/scripting/source/stringresource/stringresource.cxx +++ b/scripting/source/stringresource/stringresource.cxx @@ -1421,7 +1421,7 @@ void StringResourcePersistenceImpl::importBinary( const Sequence< ::sal_Int8 >& Reference< io::XInputStream > xInput = aIn.getInputStreamForSection( nSize ); if( xInput.is() ) { - LocaleItem* pLocaleItem = new LocaleItem( aLocale ); + LocaleItem* pLocaleItem = new LocaleItem( std::move(aLocale) ); if( iDefault == i ) pUseAsDefaultItem = pLocaleItem; m_aLocaleItemVector.emplace_back( pLocaleItem ); @@ -1510,7 +1510,7 @@ void StringResourcePersistenceImpl::implScanLocaleNames( const Sequence< OUStrin if( checkNamingSceme( aPureName, m_aNameBase, aLocale ) ) { - LocaleItem* pLocaleItem = new LocaleItem( aLocale, false ); + LocaleItem* pLocaleItem = new LocaleItem( std::move(aLocale), false ); m_aLocaleItemVector.emplace_back( pLocaleItem ); if( m_pCurrentLocaleItem == nullptr ) diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index 796bbe1a477b..182ffe7f2c30 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -198,8 +198,7 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh) } LanguageType eRealLanguage = MsLangId::getRealLanguage( meLanguage ); - LanguageTag aLanguageTag( eRealLanguage); - mpCharClass.reset(new CharClass( aLanguageTag )); + mpCharClass.reset(new CharClass( LanguageTag( eRealLanguage) )); // If the current application language is a language that uses right-to-left text... LanguageType eRealCTLLanguage = Application::GetSettings().GetLanguageTag().getLanguageType(); diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx index db8bcf126405..cc85ed74f615 100644 --- a/sd/source/ui/animations/CustomAnimationList.cxx +++ b/sd/source/ui/animations/CustomAnimationList.cxx @@ -538,7 +538,7 @@ sal_Int8 CustomAnimationList::ExecuteDrop(const ExecuteDropEvent& rEvt) // Callback to observer to have it update the model. // If pTarget is null, pass nullptr to indicate end of list. mpController->onDragNDropComplete( - aEffects, + std::move(aEffects), pTarget ? pTarget->getEffect() : nullptr ); // Reset selection diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index 62eeea5c5376..1e096ccbc11d 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -362,7 +362,7 @@ uno::Reference LineParser::readPath() } return static_cast( - new basegfx::unotools::UnoPolyPolygon(aResult)); + new basegfx::unotools::UnoPolyPolygon(std::move(aResult))); } void LineParser::readChar() diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 17edf97cc16d..f6082ad8f9a4 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1850,7 +1850,7 @@ void SfxDispatcher::ExecutePopup( const OUString& rResName, vcl::Window* pWin, c else { OUString aMenuURL = "private:resource/popupmenu/" + rResName; - if (GetFrame()->GetViewShell()->TryContextMenuInterception(xPopupMenu, aMenuURL, aEvent)) + if (GetFrame()->GetViewShell()->TryContextMenuInterception(xPopupMenu, aMenuURL, std::move(aEvent))) { css::uno::Reference xParent(aEvent.SourceWindow, css::uno::UNO_QUERY); xPopupMenu->execute(xParent, css::awt::Rectangle(aPos.X(), aPos.Y(), 1, 1), css::awt::PopupMenuDirection::EXECUTE_DOWN); diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk index 5115e03587ab..1af3b951a664 100644 --- a/solenv/CompilerTest_compilerplugins_clang.mk +++ b/solenv/CompilerTest_compilerplugins_clang.mk @@ -48,6 +48,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \ compilerplugins/clang/test/loopvartoosmall \ compilerplugins/clang/test/mapindex \ compilerplugins/clang/test/makeshared \ + compilerplugins/clang/test/moveit \ compilerplugins/clang/test/moveparam \ compilerplugins/clang/test/namespaceindentation \ compilerplugins/clang/test/noexcept \ diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx index d4d629aedd11..ee70d390542e 100644 --- a/sot/source/sdstor/stgdir.cxx +++ b/sot/source/sdstor/stgdir.cxx @@ -709,7 +709,7 @@ StgDirStrm::StgDirStrm( StgIo& r ) static constexpr OUStringLiteral sRootEntry = u"Root Entry"; aRoot.SetName( sRootEntry ); aRoot.SetType( STG_ROOT ); - m_pRoot = new StgDirEntry( aRoot ); + m_pRoot = new StgDirEntry( std::move(aRoot) ); m_pRoot->SetDirty(); } else @@ -890,7 +890,7 @@ StgDirEntry* StgDirStrm::Find( StgDirEntry& rStg, const OUString& rName ) aEntry.Init(); aEntry.SetName( rName ); // Look in the directory attached to the entry - StgDirEntry aTest( aEntry ); + StgDirEntry aTest( std::move(aEntry) ); return static_cast( rStg.m_pDown->Find( &aTest ) ); } else @@ -921,7 +921,7 @@ StgDirEntry* StgDirStrm::Create( StgDirEntry& rStg, const OUString& rName, StgEn } else { - std::unique_ptr pNewRes(new StgDirEntry( aEntry )); + std::unique_ptr pNewRes(new StgDirEntry( std::move(aEntry) )); if( StgAvlNode::Insert( reinterpret_cast(&rStg.m_pDown), pNewRes.get() ) ) { pNewRes->m_pUp = &rStg; diff --git a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx index 86fc1cab13f2..ac7ad90f13bf 100644 --- a/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofe3dscene.cxx @@ -82,7 +82,7 @@ namespace sdr::contact if(!xRetval.empty()) { // allow evtl. embedding in object-specific infos, e.g. Name, Title, Description - xRetval = rViewContact.embedToObjectSpecificInformation(xRetval); + xRetval = rViewContact.embedToObjectSpecificInformation(std::move(xRetval)); // handle GluePoint if(!GetObjectContact().isOutputToPrinter() && GetObjectContact().AreGluePointsVisible()) diff --git a/sw/source/core/SwNumberTree/SwNumberTree.cxx b/sw/source/core/SwNumberTree/SwNumberTree.cxx index 2bf20bfc703b..30cdff34b7bc 100644 --- a/sw/source/core/SwNumberTree/SwNumberTree.cxx +++ b/sw/source/core/SwNumberTree/SwNumberTree.cxx @@ -836,7 +836,7 @@ void SwNumberTreeNode::IsSane(bool bRecursive) const { vector aParents; - return IsSane(bRecursive, aParents); + return IsSane(bRecursive, std::move(aParents)); } void SwNumberTreeNode::IsSane(bool bRecursive, diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index 4c6f2258dc57..685e7adac17a 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -235,7 +235,7 @@ SwCalc::SwCalc( SwDoc& rD ) { m_pCharClass = new CharClass( ::comphelper::getProcessComponentContext(), aLanguageTag ); } - m_xLocaleDataWrapper.reset(new LocaleDataWrapper( aLanguageTag )); + m_xLocaleDataWrapper.reset(new LocaleDataWrapper( std::move(aLanguageTag) )); m_sCurrSym = comphelper::string::strip(m_xLocaleDataWrapper->getCurrSymbol(), ' '); m_sCurrSym = m_pCharClass->lowercase( m_sCurrSym ); diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index 060a742814f8..14e3655e847a 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -964,7 +964,7 @@ uno::Reference< XSpellAlternatives > if ( xSpellAlt.is() ) // error found? { - HandleCorrectionError( aText, aPos, nBegin, nLen, pPt, rSelectRect ); + HandleCorrectionError( aText, std::move(aPos), nBegin, nLen, pPt, rSelectRect ); } } } @@ -1041,7 +1041,7 @@ bool SwEditShell::GetGrammarCorrection( if (rResult.aErrors.hasElements()) // error found? { - HandleCorrectionError( aText, aPos, nBegin, nLen, pPt, rSelectRect ); + HandleCorrectionError( aText, std::move(aPos), nBegin, nLen, pPt, rSelectRect ); } } } diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index a780ef245a02..e6d810506e17 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -1002,8 +1002,7 @@ sal_Int32 SwGetExpField::GetReferenceTextPos( const SwFormatField& rFormat, SwDo { TypedWhichId nLangWhich = GetWhichOfScript( RES_CHRATR_LANGUAGE, nSrcpt ) ; LanguageType eLang = aSet.Get(nLangWhich).GetLanguage(); - LanguageTag aLanguageTag( eLang); - CharClass aCC( aLanguageTag); + CharClass aCC(( LanguageTag(eLang) )); sal_Unicode c0 = sNodeText[0]; bool bIsAlphaNum = aCC.isAlphaNumeric( sNodeText, 0 ); if( !bIsAlphaNum || diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 9d25550fab38..a79c314a326d 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -236,8 +236,7 @@ static void lcl_formatReferenceLanguage( OUString& rRefText, // (http://publications.europa.eu/code/hu/hu-120700.htm, // http://publications.europa.eu/code/hu/hu-4100600.htm) - LanguageTag aLanguageTag(eLang); - CharClass aCharClass( aLanguageTag ); + CharClass aCharClass(( LanguageTag(eLang) )); sal_Int32 nLen = rRefText.getLength(); sal_Int32 i; // substring of rRefText starting with letter or number @@ -727,8 +726,7 @@ void SwGetRefField::UpdateField( const SwTextField* pFieldTextAttr ) if( !pFieldTextAttr || !pFieldTextAttr->GetpTextNode() ) break; - LanguageTag aLanguageTag( GetLanguage()); - LocaleDataWrapper aLocaleData( aLanguageTag ); + LocaleDataWrapper aLocaleData(( LanguageTag( GetLanguage() ) )); // first a "short" test - in case both are in the same node if( pFieldTextAttr->GetpTextNode() == pTextNd ) diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx index 3055c69957cc..d469083f7eb1 100644 --- a/sw/source/core/text/guess.cxx +++ b/sw/source/core/text/guess.cxx @@ -560,7 +560,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf, SwPosSize aTmpSize = rInf.GetTextSize( &rSI, m_nCutPos, nHangingLen ); aTmpSize.Width(aTmpSize.Width() + nLeftRightBorderSpace); OSL_ENSURE( !m_pHanging, "A hanging portion is hanging around" ); - m_pHanging.reset( new SwHangingPortion( aTmpSize ) ); + m_pHanging.reset( new SwHangingPortion( std::move(aTmpSize) ) ); m_pHanging->SetLen( nHangingLen ); nPorLen = m_nCutPos - rInf.GetIdx(); } diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index b5e0cbeaa565..939f483a8662 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -3320,7 +3320,7 @@ bool SwpHints::TryInsertHint( // ... and notify listeners if ( rNode.HasWriterListeners() ) { - const SwUpdateAttr aHint(nHtStart, nHintEnd, nWhich, aWhichSublist); + const SwUpdateAttr aHint(nHtStart, nHintEnd, nWhich, std::move(aWhichSublist)); rNode.TriggerNodeUpdate(sw::LegacyModifyHint(&aHint, &aHint)); } diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 79ad6b110530..d6e3a81b4bf1 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -6340,7 +6340,7 @@ WW8Fib::WW8Fib(sal_uInt8 nVer, bool bDot): m_lidFE = m_lid; LanguageTag aLanguageTag( m_lid ); - LocaleDataWrapper aLocaleWrapper( aLanguageTag ); + LocaleDataWrapper aLocaleWrapper( std::move(aLanguageTag) ); m_nNumDecimalSep = aLocaleWrapper.getNumDecimalSep()[0]; } diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index 0bb8ca566368..f28a0c0b43f6 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -330,8 +330,7 @@ css::uno::Any UnoControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const } // the remaining is the locale - LanguageTag aLanguageTag( sDefaultCurrency); - LocaleDataWrapper aLocaleInfo( m_xContext, aLanguageTag ); + LocaleDataWrapper aLocaleInfo( m_xContext, LanguageTag(sDefaultCurrency) ); if ( sBankSymbol.isEmpty() ) sBankSymbol = aLocaleInfo.getCurrBankSymbol(); diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx index 59ad8df05118..64a4605adf02 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -230,7 +230,7 @@ namespace propertyType->setOpenChoice( bOpenChoice ); propertyType->setType( type ); - libcmis::PropertyPtr property( new libcmis::Property( propertyType, values ) ); + libcmis::PropertyPtr property( new libcmis::Property( propertyType, std::move(values) ) ); return property; } diff --git a/unoidl/source/sourceprovider-parser.y b/unoidl/source/sourceprovider-parser.y index a6f9722c9d9e..abe17e3558d8 100644 --- a/unoidl/source/sourceprovider-parser.y +++ b/unoidl/source/sourceprovider-parser.y @@ -2531,7 +2531,7 @@ ctorParam: } pad->constructors.back().parameters.push_back( unoidl::detail::SourceProviderSingleInterfaceBasedServiceEntityPad::Constructor::Parameter( - id, t, $5)); + id, std::move(t), $5)); } ; diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx index 169f9550f0ea..51c8317f369f 100644 --- a/unoxml/source/rdf/librdf_repository.cxx +++ b/unoxml/source/rdf/librdf_repository.cxx @@ -864,7 +864,7 @@ librdf_NamedGraph::getStatements( std::unique_lock g(m_CacheMutex); m_aStatementsCache.emplace(cacheKey, vStatements); } - return new librdf_GraphResult2(vStatements); + return new librdf_GraphResult2(std::move(vStatements)); } diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index c4e3d23660c6..25885ce11aee 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -1459,7 +1459,8 @@ JSDrawingArea::JSDrawingArea(JSDialogSender* pSender, VclDrawingArea* pDrawingAr SalInstanceBuilder* pBuilder, const a11yref& rAlly, FactoryFunction pUITestFactoryFunction, void* pUserData) : JSWidget(pSender, pDrawingArea, pBuilder, rAlly, - pUITestFactoryFunction, pUserData, false) + std::move(pUITestFactoryFunction), pUserData, + false) { } diff --git a/vcl/qt5/QtBitmap.cxx b/vcl/qt5/QtBitmap.cxx index 0a9fb2b7812f..666cb673db65 100644 --- a/vcl/qt5/QtBitmap.cxx +++ b/vcl/qt5/QtBitmap.cxx @@ -53,7 +53,7 @@ bool QtBitmap::Create(const Size& rSize, vcl::PixelFormat ePixelFormat, const Bi QVector aColorTable(count); for (unsigned i = 0; i < count; ++i) aColorTable[i] = qRgb(rPal[i].GetRed(), rPal[i].GetGreen(), rPal[i].GetBlue()); - m_pImage->setColorTable(aColorTable); + m_pImage->setColorTable(std::move(aColorTable)); } return true; } @@ -162,7 +162,7 @@ void QtBitmap::ReleaseBuffer(BitmapBuffer* pBuffer, BitmapAccessMode nMode) for (unsigned i = 0; i < count; ++i) aColorTable[i] = qRgb(m_aPalette[i].GetRed(), m_aPalette[i].GetGreen(), m_aPalette[i].GetBlue()); - m_pImage->setColorTable(aColorTable); + m_pImage->setColorTable(std::move(aColorTable)); } delete pBuffer; if (nMode == BitmapAccessMode::Write) diff --git a/vcl/source/control/fmtfield.cxx b/vcl/source/control/fmtfield.cxx index 359856c64486..a88b6a9bbf00 100644 --- a/vcl/source/control/fmtfield.cxx +++ b/vcl/source/control/fmtfield.cxx @@ -1091,8 +1091,7 @@ void DoubleCurrencyField::UpdateCurrencyFormat() * there's * error: request for member 'getNumThousandSep' in 'aLocaleInfo', which is * of non-class type 'LocaleDataWrapper(LanguageTag)' */ - LanguageTag aLanguageTag( eLanguage); - LocaleDataWrapper aLocaleInfo( aLanguageTag ); + LocaleDataWrapper aLocaleInfo(( LanguageTag(eLanguage) )); OUStringBuffer sNewFormat; if (bThSep) diff --git a/vcl/source/uitest/uno/uiobject_uno.cxx b/vcl/source/uitest/uno/uiobject_uno.cxx index d64a595442a4..042b2fcf5cbb 100644 --- a/vcl/source/uitest/uno/uiobject_uno.cxx +++ b/vcl/source/uitest/uno/uiobject_uno.cxx @@ -138,7 +138,7 @@ void SAL_CALL UIObjectUnoObj::executeAction(const OUString& rAction, const css:: }; Notifier notifier; - ExecuteWrapper* pWrapper = new ExecuteWrapper(func, LINK(¬ifier, Notifier, NotifyHdl)); + ExecuteWrapper* pWrapper = new ExecuteWrapper(std::move(func), LINK(¬ifier, Notifier, NotifyHdl)); aIdle->SetInvokeHandler(LINK(pWrapper, ExecuteWrapper, ExecuteActionHdl)); { SolarMutexGuard aGuard; diff --git a/vcl/unx/generic/printer/cpdmgr.cxx b/vcl/unx/generic/printer/cpdmgr.cxx index fdee9d5b70d6..e8b22111d584 100644 --- a/vcl/unx/generic/printer/cpdmgr.cxx +++ b/vcl/unx/generic/printer/cpdmgr.cxx @@ -125,7 +125,7 @@ void CPDManager::printerAdded (GDBusConnection *connection, g_free(contents); g_dbus_node_info_unref(introspection_data); std::pair new_backend (sender_name, proxy); - current->addBackend(new_backend); + current->addBackend(std::move(new_backend)); } } CPDPrinter *pDest = static_cast(malloc(sizeof(CPDPrinter))); diff --git a/writerfilter/source/rtftok/rtfdispatchdestination.cxx b/writerfilter/source/rtftok/rtfdispatchdestination.cxx index 8a2218da557e..3e71cfcc91ca 100644 --- a/writerfilter/source/rtftok/rtfdispatchdestination.cxx +++ b/writerfilter/source/rtftok/rtfdispatchdestination.cxx @@ -367,7 +367,7 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) aAttributes.set(NS_ooxml::LN_CT_Comment_initials, pValue); } writerfilter::Reference::Pointer_t pProperties - = new RTFReferenceProperties(aAttributes); + = new RTFReferenceProperties(std::move(aAttributes)); Mapper().props(pProperties); } } diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx index 9167c5479317..3220332d0b6b 100644 --- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx +++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx @@ -114,7 +114,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) RTFSprms aSprms; aSprms.set(NS_ooxml::LN_tblEnd, new RTFValue(1)); writerfilter::Reference::Pointer_t pProperties - = new RTFReferenceProperties(aAttributes, aSprms); + = new RTFReferenceProperties(std::move(aAttributes), std::move(aSprms)); Mapper().props(pProperties); } m_nCellxMax = 0; diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx index a77e22a09ea5..2bea9dc9ec8f 100644 --- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx +++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx @@ -439,7 +439,7 @@ bool RTFDocumentImpl::dispatchTableValue(RTFKeyword nKeyword, int nParam) RTFSprms aSprms; aSprms.set(NS_ooxml::LN_tblStart, new RTFValue(1)); writerfilter::Reference::Pointer_t pProperties - = new RTFReferenceProperties(aAttributes, aSprms); + = new RTFReferenceProperties(std::move(aAttributes), std::move(aSprms)); Mapper().props(pProperties); } m_nCellxMax = std::max(m_nCellxMax, nParam); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 28fe9403955b..e8db8d68f12e 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -383,7 +383,8 @@ void RTFDocumentImpl::outputSettingsTable() = new RTFReferenceProperties(m_aSettingsTableAttributes, m_aSettingsTableSprms); RTFReferenceTable::Entries_t aSettingsTableEntries; aSettingsTableEntries.insert(std::make_pair(0, pProp)); - writerfilter::Reference::Pointer_t pTable = new RTFReferenceTable(aSettingsTableEntries); + writerfilter::Reference
::Pointer_t pTable + = new RTFReferenceTable(std::move(aSettingsTableEntries)); Mapper().table(NS_ooxml::LN_settings_settings, pTable); } @@ -539,16 +540,15 @@ RTFDocumentImpl::getProperties(const RTFSprms& rAttributes, RTFSprms const& rSpr } // Get rid of direct formatting what is already in the style. - RTFSprms const sprms(aSprms.cloneAndDeduplicate(aStyleSprms, nStyleType, true, &aSprms)); - RTFSprms const attributes( - rAttributes.cloneAndDeduplicate(aStyleAttributes, nStyleType, true)); - return new RTFReferenceProperties(attributes, sprms); + RTFSprms sprms(aSprms.cloneAndDeduplicate(aStyleSprms, nStyleType, true, &aSprms)); + RTFSprms attributes(rAttributes.cloneAndDeduplicate(aStyleAttributes, nStyleType, true)); + return new RTFReferenceProperties(std::move(attributes), std::move(sprms)); } if (pAbstractList) aSprms.duplicateList(pAbstractList); writerfilter::Reference::Pointer_t pRet - = new RTFReferenceProperties(rAttributes, aSprms); + = new RTFReferenceProperties(rAttributes, std::move(aSprms)); return pRet; } @@ -695,7 +695,7 @@ void RTFDocumentImpl::sectBreak(bool bFinal) RTFSprms aSprms; aSprms.set(NS_ooxml::LN_CT_PPr_sectPr, pValue); writerfilter::Reference::Pointer_t pProperties - = new RTFReferenceProperties(aAttributes, aSprms); + = new RTFReferenceProperties(std::move(aAttributes), std::move(aSprms)); if (bFinal && !m_pSuperstream) // This is the end of the document, not just the end of e.g. a header. @@ -1160,12 +1160,12 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference::Pointer_t pProperties - = new RTFReferenceProperties(aAttributes, aSprms); checkFirstRun(); if (!m_aStates.top().getCurrentBuffer()) { + writerfilter::Reference::Pointer_t pProperties + = new RTFReferenceProperties(std::move(aAttributes), std::move(aSprms)); Mapper().props(pProperties); // Make sure we don't lose these properties with a too early reset. m_bHadPicture = true; @@ -2177,18 +2177,18 @@ RTFReferenceTable::Entries_t RTFDocumentImpl::deduplicateStyleTable() NS_ooxml::LN_CT_Style_type)); assert(pStyleType); int const nStyleType(pStyleType->getInt()); - RTFSprms const sprms( + RTFSprms sprms( static_cast(*pStyle).getSprms().cloneAndDeduplicate( static_cast(*itParent->second).getSprms(), nStyleType)); - RTFSprms const attributes( + RTFSprms attributes( static_cast(*pStyle) .getAttributes() .cloneAndDeduplicate( static_cast(*itParent->second).getAttributes(), nStyleType)); - ret[it.first] = new RTFReferenceProperties(attributes, sprms); + ret[it.first] = new RTFReferenceProperties(std::move(attributes), std::move(sprms)); } else { @@ -2250,9 +2250,9 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState) break; case Destination::STYLESHEET: { - RTFReferenceTable::Entries_t const pStyleTableDeduplicated(deduplicateStyleTable()); + RTFReferenceTable::Entries_t pStyleTableDeduplicated(deduplicateStyleTable()); writerfilter::Reference
::Pointer_t const pTable( - new RTFReferenceTable(pStyleTableDeduplicated)); + new RTFReferenceTable(std::move(pStyleTableDeduplicated))); Mapper().table(NS_ooxml::LN_STYLESHEET, pTable); } break; @@ -2260,11 +2260,11 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState) { RTFSprms aListTableAttributes; writerfilter::Reference::Pointer_t pProp - = new RTFReferenceProperties(aListTableAttributes, m_aListTableSprms); + = new RTFReferenceProperties(std::move(aListTableAttributes), m_aListTableSprms); RTFReferenceTable::Entries_t aListTableEntries; aListTableEntries.insert(std::make_pair(0, pProp)); writerfilter::Reference
::Pointer_t const pTable( - new RTFReferenceTable(aListTableEntries)); + new RTFReferenceTable(std::move(aListTableEntries))); Mapper().table(NS_ooxml::LN_NUMBERING, pTable); } break; @@ -2282,7 +2282,7 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState) if (!m_aStates.top().getCurrentBuffer()) { writerfilter::Reference::Pointer_t pProperties - = new RTFReferenceProperties(aFFAttributes, aFFSprms); + = new RTFReferenceProperties(std::move(aFFAttributes), std::move(aFFSprms)); Mapper().props(pProperties); } else @@ -2738,7 +2738,7 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState) auto pValue = new RTFValue(m_aObjectAttributes, aObjectSprms); aObjSprms.set(NS_ooxml::LN_object, pValue); writerfilter::Reference::Pointer_t pProperties - = new RTFReferenceProperties(aObjAttributes, aObjSprms); + = new RTFReferenceProperties(std::move(aObjAttributes), std::move(aObjSprms)); uno::Reference xShape; RTFValue::Pointer_t pShape = m_aObjectAttributes.find(NS_ooxml::LN_shape); OSL_ASSERT(pShape); @@ -2768,7 +2768,7 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState) RTFSprms aAnnAttributes; aAnnAttributes.set(NS_ooxml::LN_CT_TrackChange_date, pValue); writerfilter::Reference::Pointer_t pProperties - = new RTFReferenceProperties(aAnnAttributes); + = new RTFReferenceProperties(std::move(aAnnAttributes)); Mapper().props(pProperties); } break; @@ -2797,10 +2797,10 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState) aAttributes.set(NS_ooxml::LN_EG_RangeMarkupElements_commentRangeStart, pValue); else aAttributes.set(NS_ooxml::LN_EG_RangeMarkupElements_commentRangeEnd, pValue); - writerfilter::Reference::Pointer_t pProperties - = new RTFReferenceProperties(aAttributes); if (!m_aStates.top().getCurrentBuffer()) { + writerfilter::Reference::Pointer_t pProperties + = new RTFReferenceProperties(std::move(aAttributes)); Mapper().props(pProperties); } else @@ -2818,7 +2818,7 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState) OUString aStr = m_aStates.top().getCurrentDestinationText()->makeStringAndClear(); RTFSprms aAnnAttributes; aAnnAttributes.set(NS_ooxml::LN_CT_Markup_id, new RTFValue(aStr.toInt32())); - Mapper().props(new RTFReferenceProperties(aAnnAttributes)); + Mapper().props(new RTFReferenceProperties(std::move(aAnnAttributes))); } break; case Destination::FALT: @@ -2930,7 +2930,7 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState) RTFSprms aMathAttributes; aMathAttributes.set(NS_ooxml::LN_starmath, pValue); writerfilter::Reference::Pointer_t pProperties - = new RTFReferenceProperties(aMathAttributes); + = new RTFReferenceProperties(std::move(aMathAttributes)); Mapper().props(pProperties); } @@ -3324,13 +3324,13 @@ void RTFDocumentImpl::afterPopState(RTFParserState& rState) // Table RTFSprms aListTableAttributes; - writerfilter::Reference::Pointer_t pProp - = new RTFReferenceProperties(aListTableAttributes, aListTableSprms); + writerfilter::Reference::Pointer_t pProp = new RTFReferenceProperties( + std::move(aListTableAttributes), std::move(aListTableSprms)); RTFReferenceTable::Entries_t aListTableEntries; aListTableEntries.insert(std::make_pair(0, pProp)); writerfilter::Reference
::Pointer_t const pTable( - new RTFReferenceTable(aListTableEntries)); + new RTFReferenceTable(std::move(aListTableEntries))); Mapper().table(NS_ooxml::LN_NUMBERING, pTable); // Use it @@ -3567,7 +3567,7 @@ RTFError RTFDocumentImpl::popState() auto pValue = new RTFValue(0); aTCSprms.set(NS_ooxml::LN_endtrackchange, pValue); if (!m_aStates.top().getCurrentBuffer()) - Mapper().props(new RTFReferenceProperties(RTFSprms(), aTCSprms)); + Mapper().props(new RTFReferenceProperties(RTFSprms(), std::move(aTCSprms))); else bufferProperties(*m_aStates.top().getCurrentBuffer(), new RTFValue(RTFSprms(), aTCSprms), nullptr); diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index c26cfd12f2b8..feb56a68a0b3 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -1137,7 +1137,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap RTFSprms aAttributes; aAttributes.set(NS_ooxml::LN_CT_Background_color, new RTFValue(xPropertySet->getPropertyValue("FillColor").get())); - m_rImport.Mapper().props(new RTFReferenceProperties(aAttributes)); + m_rImport.Mapper().props(new RTFReferenceProperties(std::move(aAttributes))); uno::Reference xComponent(xShape, uno::UNO_QUERY); xComponent->dispose(); diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index 82ed552dcbca..d928f8be2a79 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -229,7 +229,7 @@ SvXMLNumFmtExport::SvXMLNumFmtExport( { LanguageTag aLanguageTag( MsLangId::getConfiguredSystemLanguage() ); - pLocaleData.reset( new LocaleDataWrapper( rExport.getComponentContext(), aLanguageTag ) ); + pLocaleData.reset( new LocaleDataWrapper( rExport.getComponentContext(), std::move(aLanguageTag) ) ); } pUsedList.reset(new SvXMLNumUsedList_Impl); @@ -259,7 +259,7 @@ SvXMLNumFmtExport::SvXMLNumFmtExport( { LanguageTag aLanguageTag( MsLangId::getConfiguredSystemLanguage() ); - pLocaleData.reset( new LocaleDataWrapper( rExport.getComponentContext(), aLanguageTag ) ); + pLocaleData.reset( new LocaleDataWrapper( rExport.getComponentContext(), std::move(aLanguageTag) ) ); } pUsedList.reset(new SvXMLNumUsedList_Impl); -- cgit