summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-08-22 15:42:36 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2019-08-23 11:48:53 +0200
commit63dfd069b3a957361881c12ccba38c5a23b9a42f (patch)
treee7a9bd1027b19f44a7c58ea9c445ded435c838bc /sc
parent61ed17cafc90d9b4303b52260f729638eed107c7 (diff)
Mark move ctors/assignments noexcept
This should enable using move semantics where possible e.g. in standard containers. According to https://en.cppreference.com/w/cpp/language/move_constructor: To make strong exception guarantee possible, user-defined move constructors should not throw exceptions. For example, std::vector relies on std::move_if_noexcept to choose between move and copy when the elements need to be relocated. Change-Id: I6e1e1cdd5cd430b139ffa2fa7031fb0bb625decb Reviewed-on: https://gerrit.libreoffice.org/77957 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/attrib.hxx2
-rw-r--r--sc/inc/cellvalue.hxx6
-rw-r--r--sc/inc/formulalogger.hxx2
-rw-r--r--sc/inc/markarr.hxx4
-rw-r--r--sc/inc/mtvelements.hxx2
-rw-r--r--sc/inc/postit.hxx6
-rw-r--r--sc/inc/rangelst.hxx4
-rw-r--r--sc/source/core/data/attrib.cxx2
-rw-r--r--sc/source/core/data/cellvalue.cxx6
-rw-r--r--sc/source/core/data/markarr.cxx4
-rw-r--r--sc/source/core/data/mtvelements.cxx2
-rw-r--r--sc/source/core/data/postit.cxx8
-rw-r--r--sc/source/core/tool/formulalogger.cxx2
-rw-r--r--sc/source/core/tool/rangelst.cxx4
-rw-r--r--sc/source/core/tool/scmatrix.cxx16
15 files changed, 35 insertions, 35 deletions
diff --git a/sc/inc/attrib.hxx b/sc/inc/attrib.hxx
index a98578abcb23..67325fdb8d43 100644
--- a/sc/inc/attrib.hxx
+++ b/sc/inc/attrib.hxx
@@ -267,7 +267,7 @@ public:
explicit ScCondFormatItem();
explicit ScCondFormatItem(sal_uInt32 nIndex);
explicit ScCondFormatItem(const ScCondFormatIndexes& );
- explicit ScCondFormatItem(ScCondFormatIndexes&& );
+ explicit ScCondFormatItem(ScCondFormatIndexes&&) noexcept;
virtual ~ScCondFormatItem() override;
diff --git a/sc/inc/cellvalue.hxx b/sc/inc/cellvalue.hxx
index 281612d8874e..2331fd39a1d7 100644
--- a/sc/inc/cellvalue.hxx
+++ b/sc/inc/cellvalue.hxx
@@ -48,10 +48,10 @@ struct SC_DLLPUBLIC ScCellValue
ScCellValue( double fValue );
ScCellValue( const svl::SharedString& rString );
ScCellValue( const ScCellValue& r );
- ScCellValue( ScCellValue&& r );
+ ScCellValue(ScCellValue&& r) noexcept;
~ScCellValue();
- void clear();
+ void clear() noexcept;
void set( double fValue );
void set( const svl::SharedString& rStr );
@@ -89,7 +89,7 @@ struct SC_DLLPUBLIC ScCellValue
bool equalsWithoutFormat( const ScCellValue& r ) const;
ScCellValue& operator= ( const ScCellValue& r );
- ScCellValue& operator= ( ScCellValue&& r );
+ ScCellValue& operator=(ScCellValue&& r) noexcept;
ScCellValue& operator= ( const ScRefCellValue& r );
void swap( ScCellValue& r );
diff --git a/sc/inc/formulalogger.hxx b/sc/inc/formulalogger.hxx
index ef4d34f83d7e..04bba1388e23 100644
--- a/sc/inc/formulalogger.hxx
+++ b/sc/inc/formulalogger.hxx
@@ -78,7 +78,7 @@ public:
bool bOutputEnabled );
public:
- GroupScope( GroupScope&& r );
+ GroupScope(GroupScope&& r) noexcept;
~GroupScope();
/**
diff --git a/sc/inc/markarr.hxx b/sc/inc/markarr.hxx
index 588c26bcce49..edc1d7962d9a 100644
--- a/sc/inc/markarr.hxx
+++ b/sc/inc/markarr.hxx
@@ -49,7 +49,7 @@ friend class ScDocument; // for FillInfo
public:
ScMarkArray();
- ScMarkArray( ScMarkArray&& rArray );
+ ScMarkArray( ScMarkArray&& rArray ) noexcept;
ScMarkArray( const ScMarkArray& rArray );
~ScMarkArray();
void Reset( bool bMarked = false, SCSIZE nNeeded = 1 );
@@ -62,7 +62,7 @@ public:
bool HasMarks() const { return ( nCount > 1 || ( nCount == 1 && pData[0].bMarked ) ); }
ScMarkArray& operator=( ScMarkArray const & rSource );
- ScMarkArray& operator=( ScMarkArray&& rSource );
+ ScMarkArray& operator=(ScMarkArray&& rSource) noexcept;
bool operator==(ScMarkArray const & rOther ) const;
bool Search( SCROW nRow, SCSIZE& nIndex ) const;
diff --git a/sc/inc/mtvelements.hxx b/sc/inc/mtvelements.hxx
index 382fb4d2b688..0727bda0fa7f 100644
--- a/sc/inc/mtvelements.hxx
+++ b/sc/inc/mtvelements.hxx
@@ -163,7 +163,7 @@ class TableColumnBlockPositionSet
public:
TableColumnBlockPositionSet( ScDocument& rDoc, SCTAB nTab );
- TableColumnBlockPositionSet( TableColumnBlockPositionSet&& rOther );
+ TableColumnBlockPositionSet(TableColumnBlockPositionSet&& rOther) noexcept;
~TableColumnBlockPositionSet();
ColumnBlockPosition* getBlockPosition( SCCOL nCol );
diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx
index 11c5d9b5f84b..f3ba932f471c 100644
--- a/sc/inc/postit.hxx
+++ b/sc/inc/postit.hxx
@@ -45,11 +45,11 @@ public:
ScCaptionPtr();
explicit ScCaptionPtr( SdrCaptionObj* p );
ScCaptionPtr( const ScCaptionPtr& r );
- ScCaptionPtr( ScCaptionPtr&& r );
+ ScCaptionPtr(ScCaptionPtr&& r) noexcept;
~ScCaptionPtr();
ScCaptionPtr& operator=( const ScCaptionPtr& r );
- ScCaptionPtr& operator=( ScCaptionPtr&& r );
+ ScCaptionPtr& operator=(ScCaptionPtr&& r) noexcept;
explicit operator bool() const { return mpCaption != nullptr; }
const SdrCaptionObj* get() const { return mpCaption; }
SdrCaptionObj* get() { return mpCaption; }
@@ -131,7 +131,7 @@ private:
Used by move-ctor and move assignment operator.
*/
- void replaceInList( ScCaptionPtr* pNew );
+ void replaceInList(ScCaptionPtr* pNew) noexcept;
/** Dissolve list when the caption object is released or gone. */
void dissolve();
diff --git a/sc/inc/rangelst.hxx b/sc/inc/rangelst.hxx
index 079e1a646ab5..06e866ca769e 100644
--- a/sc/inc/rangelst.hxx
+++ b/sc/inc/rangelst.hxx
@@ -34,12 +34,12 @@ class SAL_WARN_UNUSED SC_DLLPUBLIC ScRangeList final : public SvRefBase
public:
ScRangeList();
ScRangeList( const ScRangeList& rList );
- ScRangeList( ScRangeList&& rList );
+ ScRangeList(ScRangeList&& rList) noexcept;
ScRangeList( const ScRange& rRange );
virtual ~ScRangeList() override;
ScRangeList& operator=(const ScRangeList& rList);
- ScRangeList& operator=(ScRangeList&& rList);
+ ScRangeList& operator=(ScRangeList&& rList) noexcept;
ScRefFlags Parse( const OUString&, const ScDocument*,
formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO,
diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx
index 1b523f918a41..f35d2c7219d7 100644
--- a/sc/source/core/data/attrib.cxx
+++ b/sc/source/core/data/attrib.cxx
@@ -677,7 +677,7 @@ ScCondFormatItem::ScCondFormatItem( const ScCondFormatIndexes& rIndex ):
{
}
-ScCondFormatItem::ScCondFormatItem( ScCondFormatIndexes&& aIndex ):
+ScCondFormatItem::ScCondFormatItem( ScCondFormatIndexes&& aIndex ) noexcept:
SfxPoolItem( ATTR_CONDITIONAL ),
maIndex( std::move(aIndex) )
{
diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx
index ef662c4818f7..a860b359ee1d 100644
--- a/sc/source/core/data/cellvalue.cxx
+++ b/sc/source/core/data/cellvalue.cxx
@@ -244,7 +244,7 @@ ScCellValue::ScCellValue( const ScCellValue& r ) : meType(r.meType), mfValue(r.m
}
}
-ScCellValue::ScCellValue(ScCellValue&& r)
+ScCellValue::ScCellValue(ScCellValue&& r) noexcept
: meType(r.meType)
, mfValue(r.mfValue)
{
@@ -270,7 +270,7 @@ ScCellValue::~ScCellValue()
clear();
}
-void ScCellValue::clear()
+void ScCellValue::clear() noexcept
{
switch (meType)
{
@@ -513,7 +513,7 @@ ScCellValue& ScCellValue::operator= ( const ScCellValue& r )
return *this;
}
-ScCellValue& ScCellValue::operator=(ScCellValue&& rCell)
+ScCellValue& ScCellValue::operator=(ScCellValue&& rCell) noexcept
{
clear();
diff --git a/sc/source/core/data/markarr.cxx b/sc/source/core/data/markarr.cxx
index eeeda2aeab8b..3db2c9544b2d 100644
--- a/sc/source/core/data/markarr.cxx
+++ b/sc/source/core/data/markarr.cxx
@@ -32,7 +32,7 @@ ScMarkArray::ScMarkArray() :
}
// Move constructor
-ScMarkArray::ScMarkArray( ScMarkArray&& rOther )
+ScMarkArray::ScMarkArray( ScMarkArray&& rOther ) noexcept
{
operator=(std::move(rOther));
}
@@ -338,7 +338,7 @@ ScMarkArray& ScMarkArray::operator=( const ScMarkArray& rOther )
return *this;
}
-ScMarkArray& ScMarkArray::operator=( ScMarkArray&& rOther )
+ScMarkArray& ScMarkArray::operator=(ScMarkArray&& rOther) noexcept
{
nCount = rOther.nCount;
nLimit = rOther.nLimit;
diff --git a/sc/source/core/data/mtvelements.cxx b/sc/source/core/data/mtvelements.cxx
index e15416fb7d99..21eef33cad45 100644
--- a/sc/source/core/data/mtvelements.cxx
+++ b/sc/source/core/data/mtvelements.cxx
@@ -120,7 +120,7 @@ TableColumnBlockPositionSet::TableColumnBlockPositionSet( ScDocument& rDoc, SCTA
}
}
-TableColumnBlockPositionSet::TableColumnBlockPositionSet( TableColumnBlockPositionSet&& rOther ) :
+TableColumnBlockPositionSet::TableColumnBlockPositionSet( TableColumnBlockPositionSet&& rOther ) noexcept :
mpImpl(std::move(rOther.mpImpl)) {}
TableColumnBlockPositionSet::~TableColumnBlockPositionSet() {}
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 5b92edc04e4b..990440b7dbfa 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -482,15 +482,15 @@ ScCaptionPtr::ScCaptionPtr( const ScCaptionPtr& r ) :
}
}
-ScCaptionPtr::ScCaptionPtr( ScCaptionPtr&& r ) :
- mpHead(r.mpHead), mpNext(r.mpNext), mpCaption(r.mpCaption), mbNotOwner(false)
+ScCaptionPtr::ScCaptionPtr(ScCaptionPtr&& r) noexcept
+ : mpHead(r.mpHead), mpNext(r.mpNext), mpCaption(r.mpCaption), mbNotOwner(false)
{
r.replaceInList( this );
r.mpCaption = nullptr;
r.mbNotOwner = false;
}
-ScCaptionPtr& ScCaptionPtr::operator=( ScCaptionPtr&& r )
+ScCaptionPtr& ScCaptionPtr::operator=(ScCaptionPtr&& r) noexcept
{
assert(this != &r);
@@ -560,7 +560,7 @@ void ScCaptionPtr::newHead()
mpHead = new Head(this);
}
-void ScCaptionPtr::replaceInList( ScCaptionPtr* pNew )
+void ScCaptionPtr::replaceInList(ScCaptionPtr* pNew) noexcept
{
if (!mpHead && !mpNext)
return;
diff --git a/sc/source/core/tool/formulalogger.cxx b/sc/source/core/tool/formulalogger.cxx
index d877c1e63c5f..06d42f48f407 100644
--- a/sc/source/core/tool/formulalogger.cxx
+++ b/sc/source/core/tool/formulalogger.cxx
@@ -126,7 +126,7 @@ FormulaLogger::GroupScope::GroupScope(
const ScFormulaCell& rCell, bool bOutputEnabled ) :
mpImpl(std::make_unique<Impl>(rLogger, rPrefix, rDoc, rCell, bOutputEnabled)) {}
-FormulaLogger::GroupScope::GroupScope( GroupScope&& r ) : mpImpl(std::move(r.mpImpl)) {}
+FormulaLogger::GroupScope::GroupScope(GroupScope&& r) noexcept : mpImpl(std::move(r.mpImpl)) {}
FormulaLogger::GroupScope::~GroupScope() {}
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index ce5e75bd403c..4e6891658082 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -983,7 +983,7 @@ ScRangeList::ScRangeList( const ScRangeList& rList ) :
{
}
-ScRangeList::ScRangeList( ScRangeList&& rList ) :
+ScRangeList::ScRangeList(ScRangeList&& rList) noexcept :
SvRefBase(),
maRanges(std::move(rList.maRanges)),
mnMaxRowUsed(rList.mnMaxRowUsed)
@@ -1004,7 +1004,7 @@ ScRangeList& ScRangeList::operator=(const ScRangeList& rList)
return *this;
}
-ScRangeList& ScRangeList::operator=(ScRangeList&& rList)
+ScRangeList& ScRangeList::operator=(ScRangeList&& rList) noexcept
{
maRanges = std::move(rList.maRanges);
mnMaxRowUsed = rList.mnMaxRowUsed;
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 2c03fe0a074e..3ced23b3cc50 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -1198,10 +1198,10 @@ public:
WalkElementBlocksMultipleValues( const WalkElementBlocksMultipleValues& ) = delete;
WalkElementBlocksMultipleValues& operator= ( const WalkElementBlocksMultipleValues& ) = delete;
- WalkElementBlocksMultipleValues( WalkElementBlocksMultipleValues&& r ) :
+ WalkElementBlocksMultipleValues(WalkElementBlocksMultipleValues&& r) noexcept :
mpOp(r.mpOp), maRes(std::move(r.maRes)), mbFirst(r.mbFirst) {}
- WalkElementBlocksMultipleValues& operator= ( WalkElementBlocksMultipleValues&& r )
+ WalkElementBlocksMultipleValues& operator=(WalkElementBlocksMultipleValues&& r) noexcept
{
mpOp = r.mpOp;
maRes = std::move(r.maRes);
@@ -1689,13 +1689,13 @@ public:
CompareMatrixFunc( const CompareMatrixFunc& ) = delete;
CompareMatrixFunc& operator= ( const CompareMatrixFunc& ) = delete;
- CompareMatrixFunc( CompareMatrixFunc&& r ) :
+ CompareMatrixFunc(CompareMatrixFunc&& r) noexcept :
mrComp(r.mrComp),
mnMatPos(r.mnMatPos),
mpOptions(r.mpOptions),
maResValues(std::move(r.maResValues)) {}
- CompareMatrixFunc& operator= ( CompareMatrixFunc&& r )
+ CompareMatrixFunc& operator=(CompareMatrixFunc&& r) noexcept
{
mrComp = r.mrComp;
mnMatPos = r.mnMatPos;
@@ -1815,13 +1815,13 @@ public:
CompareMatrixToNumericFunc( const CompareMatrixToNumericFunc& ) = delete;
CompareMatrixToNumericFunc& operator= ( const CompareMatrixToNumericFunc& ) = delete;
- CompareMatrixToNumericFunc( CompareMatrixToNumericFunc&& r ) :
+ CompareMatrixToNumericFunc(CompareMatrixToNumericFunc&& r) noexcept :
mrComp(r.mrComp),
mfRightValue(r.mfRightValue),
mpOptions(r.mpOptions),
maResValues(std::move(r.maResValues)) {}
- CompareMatrixToNumericFunc& operator= ( CompareMatrixToNumericFunc&& r )
+ CompareMatrixToNumericFunc& operator=(CompareMatrixToNumericFunc&& r) noexcept
{
mrComp = r.mrComp;
mfRightValue = r.mfRightValue;
@@ -1913,13 +1913,13 @@ public:
ToDoubleArray( const ToDoubleArray& ) = delete;
ToDoubleArray& operator= ( const ToDoubleArray& ) = delete;
- ToDoubleArray( ToDoubleArray&& r ) :
+ ToDoubleArray(ToDoubleArray&& r) noexcept :
mfNaN(r.mfNaN), mbEmptyAsZero(r.mbEmptyAsZero)
{
moveArray(r);
}
- ToDoubleArray& operator= ( ToDoubleArray&& r )
+ ToDoubleArray& operator=(ToDoubleArray&& r) noexcept
{
mfNaN = r.mfNaN;
mbEmptyAsZero = r.mbEmptyAsZero;