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 --- editeng/source/editeng/eertfpar.cxx | 16 ++++++++-------- editeng/source/items/frmitems.cxx | 22 +++++++++++----------- editeng/source/uno/unotext.cxx | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) (limited to 'editeng') 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 ); } } -- cgit