summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-04-10 09:40:19 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-10 10:38:23 +0200
commite9586cf0b5fda0092fdca3ab4db470e8fd765adf (patch)
treee0340048f9eff52dd72ded1de84324fd6ae211b2 /sc
parent77e2d29bce92639498324814be56656f85a0f0fd (diff)
loplugin:unusedfield improvements
improve the read-only check to ignore reads from fields that are guarded by a boolean check, something like: if (field) field.foo(); this produces some false positives at the moment because I'm not correctly handling the else block, but also some useful new dead code. Change-Id: Id21fa1a56c171d09d979769b978b6eef14e8b695 Reviewed-on: https://gerrit.libreoffice.org/52664 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/chartlis.hxx4
-rw-r--r--sc/source/core/data/documen2.cxx8
-rw-r--r--sc/source/core/data/document.cxx14
-rw-r--r--sc/source/core/opencl/formulagroupcl.cxx15
-rw-r--r--sc/source/core/tool/chartlis.cxx27
5 files changed, 5 insertions, 63 deletions
diff --git a/sc/inc/chartlis.hxx b/sc/inc/chartlis.hxx
index 2537e15613d2..38642699f3dd 100644
--- a/sc/inc/chartlis.hxx
+++ b/sc/inc/chartlis.hxx
@@ -69,7 +69,6 @@ private:
ScDocument* mpDoc;
bool bUsed:1; // for ScChartListenerCollection::FreeUnused
bool bDirty:1;
- bool bSeriesRangesScheduled:1;
ScChartListener& operator=( const ScChartListener& ) = delete;
@@ -105,8 +104,6 @@ public:
void UpdateChartIntersecting( const ScRange& rRange );
- // if chart series ranges are to be updated later on (e.g. DeleteTab, InsertTab)
- void UpdateScheduledSeriesRanges();
void UpdateSeriesRanges();
ExternalRefListener* GetExtRefListener();
@@ -190,7 +187,6 @@ public:
void SetRangeDirty( const ScRange& rRange ); // for example rows/columns
- void UpdateScheduledSeriesRanges();
void UpdateChartsContainingTab( SCTAB nTab );
bool operator==( const ScChartListenerCollection& r ) const;
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index ac245b3516e0..f213947c3e46 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -803,9 +803,6 @@ bool ScDocument::MoveTab( SCTAB nOldPos, SCTAB nNewPos, ScProgress* pProgress )
SetNoListening( false );
StartAllListeners();
- // sheet names of references may not be valid until sheet is moved
- pChartListenerCollection->UpdateScheduledSeriesRanges();
-
sc::SetFormulaDirtyContext aFormulaDirtyCxt;
SetAllFormulasDirty(aFormulaDirtyCxt);
@@ -893,10 +890,7 @@ bool ScDocument::CopyTab( SCTAB nOldPos, SCTAB nNewPos, const ScMarkData* pOnlyM
if (pValidationList)
pValidationList->UpdateInsertTab(aCxt);
-
- // sheet names of references may not be valid until sheet is copied
- pChartListenerCollection->UpdateScheduledSeriesRanges();
- }
+ }
else
bValid = false;
}
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 878887211ccb..9bf363cec196 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -567,10 +567,6 @@ bool ScDocument::InsertTab(
pValidationList->UpdateInsertTab(aCxt);
}
- // sheet names of references are not valid until sheet is inserted
- if ( pChartListenerCollection )
- pChartListenerCollection->UpdateScheduledSeriesRanges();
-
bValid = true;
}
else
@@ -667,10 +663,6 @@ bool ScDocument::InsertTabs( SCTAB nPos, const std::vector<OUString>& rNames,
pValidationList->UpdateInsertTab(aCxt);
}
- // sheet names of references are not valid until sheet is inserted
- if ( pChartListenerCollection )
- pChartListenerCollection->UpdateScheduledSeriesRanges();
-
bValid = true;
}
else
@@ -762,9 +754,6 @@ bool ScDocument::DeleteTab( SCTAB nTab )
sc::SetFormulaDirtyContext aFormulaDirtyCxt;
SetAllFormulasDirty(aFormulaDirtyCxt);
}
- // sheet names of references are not valid until sheet is deleted
- if (pChartListenerCollection)
- pChartListenerCollection->UpdateScheduledSeriesRanges();
if (comphelper::LibreOfficeKit::isActive())
{
@@ -863,9 +852,6 @@ bool ScDocument::DeleteTabs( SCTAB nTab, SCTAB nSheets )
sc::SetFormulaDirtyContext aFormulaDirtyCxt;
SetAllFormulasDirty(aFormulaDirtyCxt);
}
- // sheet names of references are not valid until sheet is deleted
- if (pChartListenerCollection)
- pChartListenerCollection->UpdateScheduledSeriesRanges();
if (comphelper::LibreOfficeKit::isActive())
{
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index fc0a30ef523d..84ee1cc30798 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -1177,7 +1177,7 @@ public:
ParallelReductionVectorRef( const ScCalcConfig& config, const std::string& s,
FormulaTreeNodeRef ft, std::shared_ptr<SlidingFunctionBase>& CodeGen,
int index ) :
- Base(config, s, ft, index), mpCodeGen(CodeGen), mpClmem2(nullptr)
+ Base(config, s, ft, index), mpCodeGen(CodeGen)
{
FormulaToken* t = ft->GetFormulaToken();
if (t->GetType() != formula::svDoubleVectorRef)
@@ -1211,17 +1211,6 @@ public:
return nCurWindowSize;
}
- ~ParallelReductionVectorRef()
- {
- if (mpClmem2)
- {
- cl_int err;
- err = clReleaseMemObject(mpClmem2);
- SAL_WARN_IF(err != CL_SUCCESS, "sc.opencl", "clReleaseMemObject failed: " << openclwrapper::errorString(err));
- mpClmem2 = nullptr;
- }
- }
-
size_t GetArrayLength() const { return mpDVR->GetArrayLength(); }
size_t GetWindowSize() const { return mpDVR->GetRefRowSize(); }
@@ -1235,8 +1224,6 @@ protected:
const formula::DoubleVectorRefToken* mpDVR;
// from parent nodes
std::shared_ptr<SlidingFunctionBase> mpCodeGen;
- // controls whether to invoke the reduction kernel during marshaling or not
- cl_mem mpClmem2;
};
class Reduction : public SlidingFunctionBase
diff --git a/sc/source/core/tool/chartlis.cxx b/sc/source/core/tool/chartlis.cxx
index 81b3c79dd9ed..8ed6bfcabed7 100644
--- a/sc/source/core/tool/chartlis.cxx
+++ b/sc/source/core/tool/chartlis.cxx
@@ -98,8 +98,7 @@ ScChartListener::ScChartListener( const OUString& rName, ScDocument* pDocP,
maName(rName),
mpDoc( pDocP ),
bUsed( false ),
- bDirty( false ),
- bSeriesRangesScheduled( false )
+ bDirty( false )
{
ScRefTokenHelper::getTokensFromRangeList(*mpTokens, *rRangeList);
}
@@ -111,8 +110,7 @@ ScChartListener::ScChartListener( const OUString& rName, ScDocument* pDocP, vect
maName(rName),
mpDoc( pDocP ),
bUsed( false ),
- bDirty( false ),
- bSeriesRangesScheduled( false )
+ bDirty( false )
{
}
@@ -123,8 +121,7 @@ ScChartListener::ScChartListener( const ScChartListener& r ) :
maName(r.maName),
mpDoc( r.mpDoc ),
bUsed( false ),
- bDirty( r.bDirty ),
- bSeriesRangesScheduled( r.bSeriesRangesScheduled )
+ bDirty( r.bDirty )
{
if ( r.pUnoData )
pUnoData.reset( new ScChartUnoData( *r.pUnoData ) );
@@ -322,15 +319,6 @@ void ScChartListener::ChangeListening( const ScRangeListRef& rRangeListRef,
SetDirty( true );
}
-void ScChartListener::UpdateScheduledSeriesRanges()
-{
- if ( bSeriesRangesScheduled )
- {
- bSeriesRangesScheduled = false;
- UpdateSeriesRanges();
- }
-}
-
void ScChartListener::UpdateChartIntersecting( const ScRange& rRange )
{
ScTokenRef pToken;
@@ -370,7 +358,6 @@ bool ScChartListener::operator==( const ScChartListener& r ) const
bool b2 = (r.mpTokens.get() && !r.mpTokens->empty());
if (mpDoc != r.mpDoc || bUsed != r.bUsed || bDirty != r.bDirty ||
- bSeriesRangesScheduled != r.bSeriesRangesScheduled ||
GetName() != r.GetName() || b1 != b2)
return false;
@@ -693,14 +680,6 @@ void ScChartListenerCollection::SetRangeDirty( const ScRange& rRange )
}
}
-void ScChartListenerCollection::UpdateScheduledSeriesRanges()
-{
- for (auto const& it : m_Listeners)
- {
- it.second->UpdateScheduledSeriesRanges();
- }
-}
-
void ScChartListenerCollection::UpdateChartsContainingTab( SCTAB nTab )
{
ScRange aRange( 0, 0, nTab, MAXCOL, MAXROW, nTab );