Kaydet (Commit) e9586cf0 authored tarafından Noel Grandin's avatar Noel Grandin

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/52664Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 77e2d29b
......@@ -31,8 +31,7 @@ struct Bar
// expected-error@-11 {{write m_bar3b [loplugin:unusedfields]}}
// expected-error@-12 {{write m_bar4 [loplugin:unusedfields]}}
// expected-error@-13 {{write m_bar7 [loplugin:unusedfields]}}
// expected-error@-14 {{write m_barfunctionpointer [loplugin:unusedfields]}}
// expected-error@-15 {{write m_bar9 [loplugin:unusedfields]}}
// expected-error@-14 {{write m_bar9 [loplugin:unusedfields]}}
{
int m_bar1;
int m_bar2 = 1;
......@@ -161,4 +160,16 @@ struct ReadOnlyAnalysis2
ReadOnlyAnalysis2 global { 1 };
struct ReadOnlyAnalysis3
// expected-error@-1 {{read m_f1 [loplugin:unusedfields]}}
{
int m_f1;
void func1()
{
if (m_f1)
m_f1 = 1;
}
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
......@@ -13,7 +13,8 @@
#include <string>
#include <iostream>
#include <fstream>
#include <set>
#include <unordered_set>
#include <vector>
#include <algorithm>
#include <sys/file.h>
#include <unistd.h>
......@@ -152,6 +153,7 @@ public:
bool TraverseCXXConstructorDecl( CXXConstructorDecl* );
bool TraverseCXXMethodDecl( CXXMethodDecl* );
bool TraverseFunctionDecl( FunctionDecl* );
bool TraverseIfStmt( IfStmt* );
private:
MyFieldInfo niceName(const FieldDecl*);
......@@ -168,6 +170,7 @@ private:
// For reasons I do not understand, parentFunctionDecl() is not reliable, so
// we store the parent function on the way down the AST.
FunctionDecl * insideFunctionDecl = nullptr;
std::vector<FieldDecl const *> insideConditionalCheckOfMemberSet;
};
void UnusedFields::run()
......@@ -414,6 +417,21 @@ bool UnusedFields::TraverseFunctionDecl(FunctionDecl* functionDecl)
return ret;
}
bool UnusedFields::TraverseIfStmt(IfStmt* ifStmt)
{
FieldDecl const * memberFieldDecl = nullptr;
Expr const * cond = ifStmt->getCond()->IgnoreParenImpCasts();
if (auto memberExpr = dyn_cast<MemberExpr>(cond))
{
if ((memberFieldDecl = dyn_cast<FieldDecl>(memberExpr->getMemberDecl())))
insideConditionalCheckOfMemberSet.push_back(memberFieldDecl);
}
bool ret = RecursiveASTVisitor::TraverseIfStmt(ifStmt);
if (memberFieldDecl)
insideConditionalCheckOfMemberSet.pop_back();
return ret;
}
bool UnusedFields::VisitMemberExpr( const MemberExpr* memberExpr )
{
const ValueDecl* decl = memberExpr->getMemberDecl();
......@@ -643,6 +661,13 @@ void UnusedFields::checkReadOnly(const FieldDecl* fieldDecl, const Expr* memberE
return;
}
// if we're inside a block that looks like
// if (fieldDecl)
// ....
// then writes to this field don't matter, because unless we find another write to this field, this field is dead
if (std::find(insideConditionalCheckOfMemberSet.begin(), insideConditionalCheckOfMemberSet.end(), fieldDecl) != insideConditionalCheckOfMemberSet.end())
return;
auto parentsRange = compiler.getASTContext().getParents(*memberExpr);
const Stmt* child = memberExpr;
const Stmt* parent = parentsRange.begin() == parentsRange.end() ? nullptr : parentsRange.begin()->get<Stmt>();
......@@ -987,7 +1012,7 @@ llvm::Optional<CalleeWrapper> UnusedFields::getCallee(CallExpr const * callExpr)
return llvm::Optional<CalleeWrapper>();
}
loplugin::Plugin::Registration< UnusedFields > X("unusedfields", false);
loplugin::Plugin::Registration< UnusedFields > X("unusedfields", true);
}
......
......@@ -5,9 +5,9 @@ avmedia/source/vlc/wrapper/Types.hxx:44
avmedia/source/vlc/wrapper/Types.hxx:45
libvlc_event_t::(anonymous union)::(anonymous) dummy2 const char *
avmedia/source/vlc/wrapper/Types.hxx:46
libvlc_event_t::(anonymous) padding struct (anonymous struct at /media/noel/disk2/libo4/avmedia/source/vlc/wrapper/Types.hxx:43:7)
libvlc_event_t::(anonymous) padding struct (anonymous struct at /home/noel/libo3/avmedia/source/vlc/wrapper/Types.hxx:43:7)
avmedia/source/vlc/wrapper/Types.hxx:47
libvlc_event_t u union (anonymous union at /media/noel/disk2/libo4/avmedia/source/vlc/wrapper/Types.hxx:41:5)
libvlc_event_t u union (anonymous union at /home/noel/libo3/avmedia/source/vlc/wrapper/Types.hxx:41:5)
avmedia/source/vlc/wrapper/Types.hxx:53
libvlc_track_description_t psz_name char *
basctl/source/inc/dlged.hxx:122
......@@ -76,12 +76,6 @@ include/svtools/unoevent.hxx:162
SvEventDescriptor xParentRef css::uno::Reference<css::uno::XInterface>
include/svx/ClassificationDialog.hxx:63
svx::ClassificationDialog m_nInsertMarkings sal_Int16
include/svx/xmlgrhlp.hxx:60
SvXMLGraphicHelper maGrfURLs SvXMLGraphicHelper::URLPairVector
include/svx/xmlgrhlp.hxx:61
SvXMLGraphicHelper maGrfObjs SvXMLGraphicHelper::GraphicObjectVector
include/svx/xmlgrhlp.hxx:63
SvXMLGraphicHelper maURLSet ::std::set<OUString>
include/vcl/pdfwriter.hxx:548
vcl::PDFWriter::PDFSignContext m_pDerEncoded sal_Int8 *
include/vcl/pdfwriter.hxx:550
......@@ -180,15 +174,15 @@ sd/source/ui/table/TableDesignPane.hxx:113
sd::TableDesignPane aImpl class sd::TableDesignWidget
sd/source/ui/view/DocumentRenderer.cxx:1319
sd::DocumentRenderer::Implementation mxObjectShell SfxObjectShellRef
sd/source/ui/view/viewshel.cxx:1217
sd/source/ui/view/viewshel.cxx:1215
sd::KeepSlideSorterInSyncWithPageChanges m_aDrawLock sd::slidesorter::view::class SlideSorterView::DrawLock
sd/source/ui/view/viewshel.cxx:1218
sd/source/ui/view/viewshel.cxx:1216
sd::KeepSlideSorterInSyncWithPageChanges m_aModelLock sd::slidesorter::controller::class SlideSorterController::ModelChangeLock
sd/source/ui/view/viewshel.cxx:1219
sd/source/ui/view/viewshel.cxx:1217
sd::KeepSlideSorterInSyncWithPageChanges m_aUpdateLock sd::slidesorter::controller::class PageSelector::UpdateLock
sd/source/ui/view/viewshel.cxx:1220
sd/source/ui/view/viewshel.cxx:1218
sd::KeepSlideSorterInSyncWithPageChanges m_aContext sd::slidesorter::controller::class SelectionObserver::Context
sd/source/ui/view/ViewShellBase.cxx:193
sd/source/ui/view/ViewShellBase.cxx:191
sd::ViewShellBase::Implementation mpPageCacheManager std::shared_ptr<slidesorter::cache::PageCacheManager>
sfx2/source/doc/doctempl.cxx:115
DocTempl::DocTempl_EntryData_Impl mxObjShell class SfxObjectShellLock
......@@ -202,24 +196,22 @@ starmath/inc/view.hxx:218
SmViewShell maGraphicController class SmGraphicController
starmath/source/accessibility.hxx:273
SmEditSource rEditAcc class SmEditAccessible &
svl/source/crypto/cryptosign.cxx:121
svl/source/crypto/cryptosign.cxx:120
(anonymous namespace)::(anonymous) extnID SECItem
svl/source/crypto/cryptosign.cxx:122
svl/source/crypto/cryptosign.cxx:121
(anonymous namespace)::(anonymous) critical SECItem
svl/source/crypto/cryptosign.cxx:123
svl/source/crypto/cryptosign.cxx:122
(anonymous namespace)::(anonymous) extnValue SECItem
svl/source/crypto/cryptosign.cxx:281
svl/source/crypto/cryptosign.cxx:280
(anonymous namespace)::(anonymous) statusString SECItem
svl/source/crypto/cryptosign.cxx:282
svl/source/crypto/cryptosign.cxx:281
(anonymous namespace)::(anonymous) failInfo SECItem
svtools/source/svhtml/htmlkywd.cxx:558
HTML_OptionEntry union HTML_OptionEntry::(anonymous at /media/noel/disk2/libo4/svtools/source/svhtml/htmlkywd.cxx:558:5)
HTML_OptionEntry union HTML_OptionEntry::(anonymous at /home/noel/libo3/svtools/source/svhtml/htmlkywd.cxx:558:5)
svtools/source/svhtml/htmlkywd.cxx:560
HTML_OptionEntry::(anonymous) sToken const sal_Char *
svtools/source/svhtml/htmlkywd.cxx:561
HTML_OptionEntry::(anonymous) pUToken const class rtl::OUString *
sw/inc/ddefld.hxx:42
sw::InRangeSearchHint m_rNodes class SwNodes &
sw/source/core/crsr/crbm.cxx:64
(anonymous namespace)::CursorStateHelper m_aSaveState class SwCursorSaveState
sw/source/core/frmedt/fetab.cxx:77
......@@ -230,10 +222,6 @@ sw/source/uibase/inc/splittbl.hxx:30
SwSplitTableDlg m_xHorzBox std::unique_ptr<weld::RadioButton>
sw/source/uibase/inc/splittbl.hxx:31
SwSplitTableDlg m_xContentCopyRB std::unique_ptr<weld::RadioButton>
sw/source/uibase/inc/srtdlg.hxx:32
SwSortDlg m_xTypLbl std::unique_ptr<weld::Label>
sw/source/uibase/inc/tautofmt.hxx:41
SwAutoFormatDlg m_xFormatting std::unique_ptr<weld::Container>
sw/source/uibase/inc/uivwimp.hxx:95
SwView_Impl xTmpSelDocSh class SfxObjectShellLock
sw/source/uibase/inc/unodispatch.hxx:46
......@@ -262,5 +250,7 @@ vcl/source/gdi/jobset.cxx:35
ImplOldJobSetupData cPortName char [32]
vcl/source/uitest/uno/uitest_uno.cxx:35
UITestUnoObj mpUITest std::unique_ptr<UITest>
vcl/unx/gtk3/gtk3gtkinst.cxx:1937
CrippledViewport viewport GtkViewport
vcl/unx/gtk/a11y/atkhypertext.cxx:29
(anonymous) atk_hyper_link AtkHyperlink
......@@ -216,7 +216,7 @@ framework/inc/services/layoutmanager.hxx:258
framework::LayoutManager m_bGlobalSettings _Bool
framework/source/layoutmanager/toolbarlayoutmanager.hxx:285
framework::ToolbarLayoutManager m_bGlobalSettings _Bool
framework/source/services/frame.cxx:422
framework/source/services/frame.cxx:421
(anonymous namespace)::Frame m_pWindowCommandDispatch class framework::WindowCommandDispatch *
include/basic/basmgr.hxx:52
BasicError nReason enum BasicErrorReason
......@@ -236,6 +236,8 @@ include/editeng/adjustitem.hxx:39
SvxAdjustItem bLeft _Bool
include/LibreOfficeKit/LibreOfficeKit.h:108
_LibreOfficeKitDocumentClass nSize size_t
include/LibreOfficeKit/LibreOfficeKit.h:310
_LibreOfficeKitDocumentClass getPartInfo char *(*)(LibreOfficeKitDocument *, int)
include/opencl/openclwrapper.hxx:36
openclwrapper::KernelEnv mpkProgram cl_program
include/opencl/openclwrapper.hxx:52
......@@ -252,14 +254,10 @@ include/svx/float3d.hxx:177
Svx3DWin pControllerItem class Svx3DCtrlItem *
include/svx/imapdlg.hxx:118
SvxIMapDlg aIMapItem class SvxIMapDlgItem
include/svx/langbox.hxx:158
LanguageBox m_bWithCheckmark _Bool
include/svx/srchdlg.hxx:232
include/svx/srchdlg.hxx:234
SvxSearchDialog pSearchController class SvxSearchController *
include/svx/srchdlg.hxx:233
include/svx/srchdlg.hxx:235
SvxSearchDialog pOptionsController class SvxSearchController *
include/svx/xmlgrhlp.hxx:70
SvXMLGraphicHelper mbDirect _Bool
include/vcl/opengl/OpenGLContext.hxx:41
GLWindow bMultiSampleSupported _Bool
include/vcl/salnativewidgets.hxx:415
......@@ -388,7 +386,7 @@ sc/source/filter/xml/xmldrani.hxx:75
ScXMLDatabaseRangeContext bIsSelection _Bool
sc/source/filter/xml/xmlexternaltabi.hxx:113
ScXMLExternalRefCellContext mnCellType sal_Int16
sc/source/ui/inc/AccessibleText.hxx:195
sc/source/ui/inc/AccessibleText.hxx:194
ScAccessiblePreviewHeaderCellTextData mbRowHeader _Bool
sc/source/ui/inc/datastream.hxx:108
sc::DataStream mnSettings sal_uInt32
......@@ -408,7 +406,7 @@ sd/source/filter/ppt/ppt97animations.hxx:51
Ppt97AnimationInfoAtom nUnknown1 sal_uInt8
sd/source/filter/ppt/ppt97animations.hxx:52
Ppt97AnimationInfoAtom nUnknown2 sal_uInt8
sd/source/ui/inc/animobjs.hxx:129
sd/source/ui/inc/animobjs.hxx:128
sd::AnimationWindow pControllerItem class sd::AnimationControllerItem *
sd/source/ui/inc/navigatr.hxx:123
SdNavigatorWin mpNavigatorCtrlItem class SdNavigatorControllerItem *
......@@ -440,17 +438,17 @@ starmath/inc/view.hxx:158
SmCmdBoxWindow aController class SmEditController
store/source/storbase.hxx:248
store::PageData m_aMarked store::PageData::L
svl/source/crypto/cryptosign.cxx:145
svl/source/crypto/cryptosign.cxx:144
(anonymous namespace)::(anonymous) version SECItem
svl/source/crypto/cryptosign.cxx:147
svl/source/crypto/cryptosign.cxx:146
(anonymous namespace)::(anonymous) reqPolicy SECItem
svl/source/crypto/cryptosign.cxx:148
svl/source/crypto/cryptosign.cxx:147
(anonymous namespace)::(anonymous) nonce SECItem
svl/source/crypto/cryptosign.cxx:149
svl/source/crypto/cryptosign.cxx:148
(anonymous namespace)::(anonymous) certReq SECItem
svl/source/crypto/cryptosign.cxx:150
svl/source/crypto/cryptosign.cxx:149
(anonymous namespace)::(anonymous) extensions (anonymous namespace)::Extension *
svl/source/crypto/cryptosign.cxx:194
svl/source/crypto/cryptosign.cxx:193
(anonymous namespace)::SigningCertificateV2 certs struct (anonymous namespace)::ESSCertIDv2 **
svl/source/misc/inethist.cxx:48
INetURLHistory_Impl::head_entry m_nMagic sal_uInt32
......@@ -499,7 +497,7 @@ sw/source/filter/inc/rtf.hxx:29
sw/source/filter/inc/rtf.hxx:30
RTFSurround::(anonymous union)::(anonymous) nJunk sal_uInt8
sw/source/filter/inc/rtf.hxx:31
RTFSurround::(anonymous) Flags struct (anonymous struct at /media/noel/disk2/libo4/sw/source/filter/inc/rtf.hxx:27:9)
RTFSurround::(anonymous) Flags struct (anonymous struct at /home/noel/libo3/sw/source/filter/inc/rtf.hxx:27:9)
ucb/source/ucp/gio/gio_mount.hxx:46
OOoMountOperationClass parent_class GMountOperationClass
ucb/source/ucp/gio/gio_mount.hxx:49
......@@ -576,5 +574,5 @@ vcl/unx/gtk/hudawareness.cxx:20
(anonymous) connection GDBusConnection *
vcl/unx/gtk/hudawareness.cxx:23
(anonymous) notify GDestroyNotify
writerfilter/source/dmapper/PropertyMap.hxx:199
writerfilter/source/dmapper/PropertyMap.hxx:198
writerfilter::dmapper::SectionPropertyMap m_nDebugSectionNumber sal_Int32
......@@ -536,10 +536,6 @@ private:
Size rBitmapSize;
Size rFilledSize;
Size rZoomedSize;
sal_Int64 nFilledWidthPercent;
sal_Int64 nFilledHeightPercent;
sal_Int64 nZoomedWidthPercent;
sal_Int64 nZoomedHeightPercent;
DECL_LINK( ModifyBitmapHdl, ValueSet*, void );
DECL_LINK( ClickScaleHdl, Button*, void );
DECL_LINK( ModifyBitmapStyleHdl, ListBox&, void );
......
......@@ -83,11 +83,7 @@ SvxBitmapTabPage::SvxBitmapTabPage( vcl::Window* pParent, const SfxItemSet& rInA
m_bLogicalSize(false),
m_aXFillAttr ( rInAttrs.GetPool() ),
m_rXFSet ( m_aXFillAttr.GetItemSet() ),
mpView(nullptr),
nFilledWidthPercent(0),
nFilledHeightPercent(0),
nZoomedWidthPercent(0),
nZoomedHeightPercent(0)
mpView(nullptr)
{
get(m_pBitmapLB,"BITMAP");
get(m_pBitmapStyleLB, "bitmapstyle");
......@@ -479,11 +475,6 @@ void SvxBitmapTabPage::CalculateBitmapPresetSize()
rZoomedSize.setWidth( nObjectWidth );
rZoomedSize.setHeight( rBitmapSize.Height()*nObjectWidth/rBitmapSize.Width() );
}
nFilledWidthPercent = static_cast<sal_Int64>(rFilledSize.Width()*100/rBitmapSize.Width());
nFilledHeightPercent = static_cast<sal_Int64>(rFilledSize.Width()*100/rBitmapSize.Height());
nZoomedWidthPercent = static_cast<sal_Int64>(rZoomedSize.Width()*100/rBitmapSize.Width());
nZoomedHeightPercent = static_cast<sal_Int64>(rZoomedSize.Height()*100/rBitmapSize.Height());
}
}
......
......@@ -91,8 +91,6 @@ public:
void setMouseClickHdl(const Link<SvxCharViewControl*,void> &rLink);
DECL_LINK(ContextMenuSelectHdl, Menu*, bool);
protected:
virtual void Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle&) override;
......@@ -107,7 +105,6 @@ private:
bool maHasInsert;
Link<SvxCharViewControl*, void> maMouseClickHdl;
Link<SvxCharViewControl*, void> maClearClickHdl;
};
#endif
......
......@@ -97,14 +97,8 @@ class SVT_DLLPUBLIC URLBox
friend class SvtURLBox_Impl;
Idle aChangedIdle;
OUString aBaseURL;
OUString aPlaceHolder;
rtl::Reference< MatchContext_Impl > pCtx;
std::unique_ptr<SvtURLBox_Impl> pImpl;
INetProtocol eSmartProtocol;
bool bAutoCompleteMode : 1;
bool bOnlyDirectories : 1;
bool bHistoryDisabled : 1;
std::unique_ptr<weld::ComboBoxText> m_xWidget;
......@@ -125,13 +119,9 @@ public:
void append_text(const OUString& rStr) { m_xWidget->append_text(rStr); }
void EnableAutocomplete() { m_xWidget->set_entry_completion(true); }
INetProtocol GetSmartProtocol() const { return eSmartProtocol; }
OUString GetURL();
static OUString ParseSmart( const OUString& aText, const OUString& aBaseURL );
bool MatchesPlaceHolder( const OUString& sToMatch ) const
{ return ( !aPlaceHolder.isEmpty() ) && ( aPlaceHolder == sToMatch ); }
};
#endif
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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())
{
......
......@@ -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
......
......@@ -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 );
......
......@@ -330,26 +330,10 @@ void SvxCharViewControl::createContextMenu()
ScopedVclPtrInstance<PopupMenu> pItemMenu;
pItemMenu->InsertItem(0,SfxResId(STR_CLEAR_CHAR));
pItemMenu->InsertItem(1,SfxResId(STR_CLEAR_ALL_CHAR));
pItemMenu->SetSelectHdl(LINK(this, SvxCharViewControl, ContextMenuSelectHdl));
pItemMenu->Execute(this, tools::Rectangle(maPosition,Size(1,1)), PopupMenuFlags::ExecuteDown);
Invalidate();
}
IMPL_LINK(SvxCharViewControl, ContextMenuSelectHdl, Menu*, pMenu, bool)
{
sal_uInt16 nMenuId = pMenu->GetCurItemId();
switch(nMenuId)
{
case 0:
maClearClickHdl.Call(this);
break;
default:
break;
}
return false;
}
void SvxCharViewControl::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle&)
{
rRenderContext.SetFont(maFont);
......
......@@ -492,10 +492,9 @@ void SvtMatchContext_Impl::ReadFolder( const OUString& rURL,
MatchContext_Impl::MatchContext_Impl(URLBox* pBoxP, const OUString& rText)
: Thread( "MatchContext_Impl" )
, aLink( LINK( this, MatchContext_Impl, Select_Impl ) )
, aBaseURL( pBoxP->aBaseURL )
, aText( rText )
, pBox( pBoxP )
, bOnlyDirectories( pBoxP->bOnlyDirectories )
, bOnlyDirectories( false )
, stopped_(false)
, commandId_(0)
{
......@@ -579,8 +578,6 @@ IMPL_LINK_NOARG( MatchContext_Impl, Select_Impl, void*, void )
}
}
pBox->bAutoCompleteMode = true;
// insert all completed strings into the listbox
pBox->Clear();
......@@ -1155,7 +1152,7 @@ void MatchContext_Impl::doExecute()
INetProtocol eBaseProt = INetURLObject::CompareProtocolScheme( aBaseURL );
if ( aBaseURL.isEmpty() )
eBaseProt = INetURLObject::CompareProtocolScheme( SvtPathOptions().GetWorkPath() );
INetProtocol eSmartProt = pBox->GetSmartProtocol();
INetProtocol eSmartProt = INetProtocol::NotValid;
// if the user input is a valid URL, go on with it
// otherwise it could be parsed smart with a predefined smart protocol
......@@ -2022,11 +2019,7 @@ IMPL_LINK_NOARG(URLBox, TryAutoComplete, Timer *, void)
}
URLBox::URLBox(weld::ComboBoxText* pWidget)
: eSmartProtocol(INetProtocol::NotValid)
, bAutoCompleteMode(false)
, bOnlyDirectories(false)
, bHistoryDisabled(false)
, m_xWidget(pWidget)
: m_xWidget(pWidget)
{
Init();
......@@ -2059,8 +2052,6 @@ URLBox::~URLBox()
void URLBox::UpdatePicklistForSmartProtocol_Impl()
{
m_xWidget->clear();
if ( bHistoryDisabled )
return;
// read history pick list
Sequence< Sequence< PropertyValue > > seqPicklist = SvtHistoryOptions().GetList( ePICKLIST );
......@@ -2082,12 +2073,6 @@ void URLBox::UpdatePicklistForSmartProtocol_Impl()
seqPropertySet[nProperty].Value >>= sURL;
aCurObj.SetURL( sURL );
if ( !sURL.isEmpty() && ( eSmartProtocol != INetProtocol::NotValid ) )
{
if( aCurObj.GetProtocol() != eSmartProtocol )
break;
}
OUString aURL( aCurObj.GetMainURL( INetURLObject::DecodeMechanism::WithCharset ) );
if ( !aURL.isEmpty() )
......@@ -2146,8 +2131,6 @@ OUString URLBox::GetURL()
::osl::MutexGuard aGuard( theSvtMatchContextMutex::get() );
OUString aText(m_xWidget->get_active_text());
if ( MatchesPlaceHolder( aText ) )
return aPlaceHolder;
// try to get the right case preserving URL from the list of URLs
for(std::vector<OUString>::iterator i = pImpl->aCompletions.begin(), j = pImpl->aURLs.begin(); i != pImpl->aCompletions.end() && j != pImpl->aURLs.end(); ++i, ++j)
......@@ -2170,8 +2153,6 @@ OUString URLBox::GetURL()
{
// no autocompletion for wildcards
INetURLObject aTempObj;
if ( eSmartProtocol != INetProtocol::NotValid )
aTempObj.SetSmartProtocol( eSmartProtocol );
if ( aTempObj.SetSmartURL( aText ) )
return aTempObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
else
......@@ -2180,7 +2161,7 @@ OUString URLBox::GetURL()
if ( aObj.GetProtocol() == INetProtocol::NotValid )
{
OUString aName = ParseSmart( aText, aBaseURL );
OUString aName = ParseSmart( aText, OUString() );
aObj.SetURL(aName);
OUString aURL( aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
if ( aURL.isEmpty() )
......
......@@ -174,8 +174,6 @@ class SwHTMLTableLayout
std::vector<std::unique_ptr<SwHTMLTableLayoutCell>> m_aCells;
const SwTable *m_pSwTable; ///< SwTable (Top-Table only).
SwTableBox *m_pLeftFillerBox; ///< Left filler-box (table in table only).
SwTableBox *m_pRightFillerBox; ///< Right filler-box (table in Table only).
sal_uLong m_nMin; ///< Minimal width of table (Twips).
sal_uLong m_nMax; ///< Maximal width of table (Twips).
......
......@@ -159,8 +159,6 @@ SwHTMLTableLayout::SwHTMLTableLayout( const SwTable * pTable,
: m_aColumns( nCls )
, m_aCells( static_cast<size_t>(nRws)*nCls )
, m_pSwTable( pTable )
, m_pLeftFillerBox( nullptr )
, m_pRightFillerBox( nullptr )
, m_nMin( 0 )
, m_nMax( 0 )
, m_nRows( nRws )
......@@ -1109,15 +1107,6 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv
}
}
// Filler cells
if( !IsTopTable() )
{
if( m_pLeftFillerBox && nAbsLeftFill<MINLAY+m_nInhLeftBorderWidth )
nAbsLeftFill = MINLAY+m_nInhLeftBorderWidth;
if( m_pRightFillerBox && nAbsRightFill<MINLAY+m_nInhRightBorderWidth )
nAbsRightFill = MINLAY+m_nInhRightBorderWidth;
}
// Read just the available space
m_nRelLeftFill = 0;
m_nRelRightFill = 0;
......@@ -1507,17 +1496,12 @@ void SwHTMLTableLayout::AutoLayoutPass2( sal_uInt16 nAbsAvail, sal_uInt16 nRelAv
break;
}
OSL_ENSURE( !m_pLeftFillerBox || m_nRelLeftFill>0,
"We don't have a width for the left filler box!" );
OSL_ENSURE( !m_pRightFillerBox || m_nRelRightFill>0,
"We don't have a width for the right filler box!" );
// Filler widths are added to the outer columns, if there are no boxes
// for them after the first pass (nWidth>0) or their width would become
// too small or if there are COL tags and the filler width corresponds
// to the border width.
// In the last case we probably exported the table ourselves.
if( m_nRelLeftFill && !m_pLeftFillerBox &&
if( m_nRelLeftFill &&