From fcc31cd0e0a6544a13dac0fdc66005d77f6f5cf9 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 7 Sep 2018 18:41:58 +0200 Subject: Revert "clang-tidy performance-move-const-arg" This reverts commit 3d604d1cd6cc70ef96782ef769f0479b509987a8. comments from sberg: I assume dropping the std::move from aCurSel(std::move(aSel)) is caused by performance-move-const-arg's warning "if std::move() is called with an argument of a trivially-copyable type" (). For my taste, that approach is too tightly tied to a class's current implementation details, something that may change over time. Imagine a trivially copyable class C with a raw pointer member (where the lifecycle of the pointed-to object is tracked by some higher-level, likely broken protocol). Now, that protocol is fixed and the raw pointer member is replaced with a std::shared_ptr. C is no longer trivially copyable, and the dropped std::move would turn out to be beneficial again. (Also, if Clang and clang-tidy did implement the fixed rules for trivially copyable classes from CWG1734/C++17, where a subset of a trivially copyable class's copy/move members may be deleted, the above rule to warn "if std::move() is called with an argument of a trivially-copyable type" would no longer make sense as written; consider a trivially copyable class whose copy ctor has been deleted.) Change-Id: Icb91610e50ed98b8f55fe6323bdfa48c8cb9b4b9 Reviewed-on: https://gerrit.libreoffice.org/60166 Tested-by: Jenkins Reviewed-by: Noel Grandin --- chart2/source/view/charttypes/VSeriesPlotter.cxx | 10 +++++----- editeng/source/editeng/eertfpar.cxx | 16 ++++++++-------- editeng/source/items/frmitems.cxx | 22 +++++++++++----------- editeng/source/uno/unotext.cxx | 2 +- l10ntools/source/po.cxx | 2 +- oox/source/ppt/layoutfragmenthandler.cxx | 2 +- sw/source/uibase/wrtsh/select.cxx | 2 +- unotools/source/config/confignode.cxx | 4 ++-- vcl/source/bitmap/bitmap.cxx | 2 +- vcl/source/gdi/impgraph.cxx | 12 ++++++------ 10 files changed, 37 insertions(+), 37 deletions(-) diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index d9d4977d384a..4b4602af7589 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -116,11 +116,11 @@ VDataSeriesGroup::VDataSeriesGroup( std::unique_ptr pSeries ) m_aSeriesVector[0] = std::move(pSeries); } -VDataSeriesGroup::VDataSeriesGroup(VDataSeriesGroup&& other) - : m_aSeriesVector(std::move(other.m_aSeriesVector)) - , m_bMaxPointCountDirty(other.m_bMaxPointCountDirty) - , m_nMaxPointCount(other.m_nMaxPointCount) - , m_aListOfCachedYValues(std::move(other.m_aListOfCachedYValues)) +VDataSeriesGroup::VDataSeriesGroup( VDataSeriesGroup&& other ) + : m_aSeriesVector( std::move(other.m_aSeriesVector) ) + , m_bMaxPointCountDirty( other.m_bMaxPointCountDirty ) + , m_nMaxPointCount( std::move(other.m_nMaxPointCount) ) + , m_aListOfCachedYValues( std::move(other.m_aListOfCachedYValues) ) { } diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx index 16f202d24a28..ccecfa5723de 100644 --- a/editeng/source/editeng/eertfpar.cxx +++ b/editeng/source/editeng/eertfpar.cxx @@ -62,14 +62,14 @@ RtfImportInfo::~RtfImportInfo() { } -EditRTFParser::EditRTFParser(SvStream& rIn, EditSelection aSel, SfxItemPool& rAttrPool, - EditEngine* pEditEngine) - : SvxRTFParser(rAttrPool, rIn) - , aCurSel(aSel) - , mpEditEngine(pEditEngine) - , aRTFMapMode(MapUnit::MapTwip) - , nDefFont(0) - , bLastActionInsertParaBreak(false) +EditRTFParser::EditRTFParser( + SvStream& rIn, EditSelection aSel, SfxItemPool& rAttrPool, EditEngine* pEditEngine) : + SvxRTFParser(rAttrPool, rIn), + aCurSel(std::move(aSel)), + mpEditEngine(pEditEngine), + aRTFMapMode(MapUnit::MapTwip), + nDefFont(0), + bLastActionInsertParaBreak(false) { SetInsPos(EditPosition(mpEditEngine, &aCurSel)); diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 1904c0d1a7a1..b92feac5ea55 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -3236,15 +3236,15 @@ SvxBrushItem::SvxBrushItem(const SvxBrushItem& rItem) } SvxBrushItem::SvxBrushItem(SvxBrushItem&& rItem) - : SfxPoolItem(rItem) - , aColor(rItem.aColor) - , nShadingValue(rItem.nShadingValue) + : SfxPoolItem(std::move(rItem)) + , aColor(std::move(rItem.aColor)) + , nShadingValue(std::move(rItem.nShadingValue)) , xGraphicObject(std::move(rItem.xGraphicObject)) - , nGraphicTransparency(rItem.nGraphicTransparency) + , nGraphicTransparency(std::move(rItem.nGraphicTransparency)) , maStrLink(std::move(rItem.maStrLink)) , maStrFilter(std::move(rItem.maStrFilter)) - , eGraphicPos(rItem.eGraphicPos) - , bLoadAgain(rItem.bLoadAgain) + , eGraphicPos(std::move(rItem.eGraphicPos)) + , bLoadAgain(std::move(rItem.bLoadAgain)) { } @@ -3514,14 +3514,14 @@ SvxBrushItem& SvxBrushItem::operator=(const SvxBrushItem& rItem) SvxBrushItem& SvxBrushItem::operator=(SvxBrushItem&& rItem) { - aColor = rItem.aColor; - nShadingValue = rItem.nShadingValue; + aColor = std::move(rItem.aColor); + nShadingValue = std::move(rItem.nShadingValue); xGraphicObject = std::move(rItem.xGraphicObject); - nGraphicTransparency = rItem.nGraphicTransparency; + nGraphicTransparency = std::move(rItem.nGraphicTransparency); maStrLink = std::move(rItem.maStrLink); maStrFilter = std::move(rItem.maStrFilter); - eGraphicPos = rItem.eGraphicPos; - bLoadAgain = rItem.bLoadAgain; + eGraphicPos = std::move(rItem.eGraphicPos); + bLoadAgain = std::move(rItem.bLoadAgain); return *this; } diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index 38ba0c76d703..5d105afbdf71 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -287,7 +287,7 @@ void SvxUnoTextRangeBase::attachField( std::unique_ptr pData ) thr if( pForwarder ) { SvxFieldItem aField( std::move(pData), EE_FEATURE_FIELD ); - pForwarder->QuickInsertField(aField, maSelection); + pForwarder->QuickInsertField( std::move(aField), maSelection ); } } diff --git a/l10ntools/source/po.cxx b/l10ntools/source/po.cxx index 48ec1a68ecf0..72644095c8f8 100644 --- a/l10ntools/source/po.cxx +++ b/l10ntools/source/po.cxx @@ -287,7 +287,7 @@ PoEntry& PoEntry::operator=(const PoEntry& rPo) PoEntry& PoEntry::operator=(PoEntry&& rPo) { m_pGenPo = std::move(rPo.m_pGenPo); - m_bIsInitialized = rPo.m_bIsInitialized; + m_bIsInitialized = std::move(rPo.m_bIsInitialized); return *this; } diff --git a/oox/source/ppt/layoutfragmenthandler.cxx b/oox/source/ppt/layoutfragmenthandler.cxx index 2f5f237dae90..8faa5108037f 100644 --- a/oox/source/ppt/layoutfragmenthandler.cxx +++ b/oox/source/ppt/layoutfragmenthandler.cxx @@ -43,7 +43,7 @@ namespace oox { namespace ppt { LayoutFragmentHandler::LayoutFragmentHandler(XmlFilterBase& rFilter, const OUString& rFragmentPath, const SlidePersistPtr& pMasterPersistPtr) - : SlideFragmentHandler(rFilter, rFragmentPath, pMasterPersistPtr, Layout) + : SlideFragmentHandler(rFilter, rFragmentPath, std::move(pMasterPersistPtr), Layout) { } diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx index 70433e8de070..3f4c2540f006 100644 --- a/sw/source/uibase/wrtsh/select.cxx +++ b/sw/source/uibase/wrtsh/select.cxx @@ -296,7 +296,7 @@ void SwWrtShell::PopMode() LeaveBlockMode(); m_bIns = m_pModeStack->bIns; - m_pModeStack = m_pModeStack->pNext; + m_pModeStack = std::move(m_pModeStack->pNext); } // Two methods for setting cursors: the first maps at the diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx index fa94fc51a508..66d44cdc8301 100644 --- a/unotools/source/config/confignode.cxx +++ b/unotools/source/config/confignode.cxx @@ -97,7 +97,7 @@ namespace utl , m_xDirectAccess(std::move(_rSource.m_xDirectAccess)) , m_xReplaceAccess(std::move(_rSource.m_xReplaceAccess)) , m_xContainerAccess(std::move(_rSource.m_xContainerAccess)) - , m_bEscapeNames(_rSource.m_bEscapeNames) + , m_bEscapeNames(std::move(_rSource.m_bEscapeNames)) { Reference< XComponent > xConfigNodeComp(m_xDirectAccess, UNO_QUERY); if (xConfigNodeComp.is()) @@ -129,7 +129,7 @@ namespace utl m_xDirectAccess = std::move(_rSource.m_xDirectAccess); m_xContainerAccess = std::move(_rSource.m_xContainerAccess); m_xReplaceAccess = std::move(_rSource.m_xReplaceAccess); - m_bEscapeNames = _rSource.m_bEscapeNames; + m_bEscapeNames = std::move(_rSource.m_bEscapeNames); Reference< XComponent > xConfigNodeComp(m_xDirectAccess, UNO_QUERY); if (xConfigNodeComp.is()) diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx index b0b59906f0da..2de0da7b1a72 100644 --- a/vcl/source/bitmap/bitmap.cxx +++ b/vcl/source/bitmap/bitmap.cxx @@ -221,7 +221,7 @@ Bitmap& Bitmap::operator=( const Bitmap& rBitmap ) Bitmap& Bitmap::operator=( Bitmap&& rBitmap ) { - maPrefSize = rBitmap.maPrefSize; + maPrefSize = std::move(rBitmap.maPrefSize); maPrefMapMode = std::move(rBitmap.maPrefMapMode); mxSalBmp = std::move(rBitmap.mxSalBmp); diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 49af5af45bf2..005427b66dce 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -212,8 +212,8 @@ ImpGraphic::ImpGraphic(const ImpGraphic& rImpGraphic) } ImpGraphic::ImpGraphic(ImpGraphic&& rImpGraphic) - : maMetaFile(rImpGraphic.maMetaFile) - , maEx(rImpGraphic.maEx) + : maMetaFile(std::move(rImpGraphic.maMetaFile)) + , maEx(std::move(rImpGraphic.maEx)) , maSwapInfo(std::move(rImpGraphic.maSwapInfo)) , mpAnimation(std::move(rImpGraphic.mpAnimation)) , mpContext(std::move(rImpGraphic.mpContext)) @@ -226,8 +226,8 @@ ImpGraphic::ImpGraphic(ImpGraphic&& rImpGraphic) , maVectorGraphicData(std::move(rImpGraphic.maVectorGraphicData)) , mpPdfData(std::move(rImpGraphic.mpPdfData)) , maGraphicExternalLink(rImpGraphic.maGraphicExternalLink) - , maLastUsed(std::chrono::high_resolution_clock::now()) - , mbPrepared(rImpGraphic.mbPrepared) + , maLastUsed (std::chrono::high_resolution_clock::now()) + , mbPrepared (rImpGraphic.mbPrepared) , mnPageNumber(rImpGraphic.mnPageNumber) { rImpGraphic.ImplClear(); @@ -360,7 +360,7 @@ ImpGraphic& ImpGraphic::operator=(ImpGraphic&& rImpGraphic) { sal_Int64 aOldSizeBytes = mnSizeBytes; - maMetaFile = rImpGraphic.maMetaFile; + maMetaFile = std::move(rImpGraphic.maMetaFile); meType = rImpGraphic.meType; mnSizeBytes = rImpGraphic.mnSizeBytes; maSwapInfo = std::move(rImpGraphic.maSwapInfo); @@ -368,7 +368,7 @@ ImpGraphic& ImpGraphic::operator=(ImpGraphic&& rImpGraphic) mbDummyContext = rImpGraphic.mbDummyContext; mnPageNumber = rImpGraphic.mnPageNumber; mpAnimation = std::move(rImpGraphic.mpAnimation); - maEx = rImpGraphic.maEx; + maEx = std::move(rImpGraphic.maEx); mbSwapOut = rImpGraphic.mbSwapOut; mpSwapFile = std::move(rImpGraphic.mpSwapFile); mpGfxLink = std::move(rImpGraphic.mpGfxLink); -- cgit