loplugin:unusedfields in toolkit..xmloff
Change-Id: I4964ff97e0a1735dc08c6ad204cae0b08e9ffc2c Reviewed-on: https://gerrit.libreoffice.org/39406 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -21,6 +21,7 @@ struct Bar
|
||||
// expected-error@-3 {{read m_bar5 [loplugin:unusedfields]}}
|
||||
// expected-error@-4 {{read m_bar6 [loplugin:unusedfields]}}
|
||||
// expected-error@-5 {{read m_barfunctionpointer [loplugin:unusedfields]}}
|
||||
// expected-error@-6 {{read m_bar8 [loplugin:unusedfields]}}
|
||||
{
|
||||
int m_bar1;
|
||||
int m_bar2 = 1;
|
||||
@@ -31,6 +32,7 @@ struct Bar
|
||||
int m_bar5;
|
||||
std::vector<int> m_bar6;
|
||||
int m_bar7[5];
|
||||
int m_bar8;
|
||||
|
||||
// check that we see reads of fields like m_foo1 when referred to via constructor initializer
|
||||
Bar(Foo const & foo) : m_bar1(foo.m_foo1) {}
|
||||
@@ -61,7 +63,15 @@ struct Bar
|
||||
// check that we see reads of a field when used in ranged-for
|
||||
void bar6() { for (auto i : m_bar6) { (void)i; } }
|
||||
|
||||
// check that we see don't see reads of array fields
|
||||
void bar7() { m_bar7[3] = 1; }
|
||||
|
||||
// check that we see reads when a field is used in an array expression
|
||||
char bar8()
|
||||
{
|
||||
char tmp[5];
|
||||
return tmp[m_bar8];
|
||||
}
|
||||
};
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||
|
@@ -258,6 +258,11 @@ void UnusedFields::checkWriteOnly(const FieldDecl* fieldDecl, const Expr* member
|
||||
// walk up the tree until we find something interesting
|
||||
bool bPotentiallyReadFrom = false;
|
||||
bool bDump = false;
|
||||
auto walkupUp = [&]() {
|
||||
child = parent;
|
||||
auto parentsRange = compiler.getASTContext().getParents(*parent);
|
||||
parent = parentsRange.begin() == parentsRange.end() ? nullptr : parentsRange.begin()->get<Stmt>();
|
||||
};
|
||||
do
|
||||
{
|
||||
if (!parent)
|
||||
@@ -280,9 +285,7 @@ void UnusedFields::checkWriteOnly(const FieldDecl* fieldDecl, const Expr* member
|
||||
#endif
|
||||
|| isa<ExprWithCleanups>(parent))
|
||||
{
|
||||
child = parent;
|
||||
auto parentsRange = compiler.getASTContext().getParents(*parent);
|
||||
parent = parentsRange.begin() == parentsRange.end() ? nullptr : parentsRange.begin()->get<Stmt>();
|
||||
walkupUp();
|
||||
}
|
||||
else if (auto unaryOperator = dyn_cast<UnaryOperator>(parent))
|
||||
{
|
||||
@@ -300,9 +303,7 @@ void UnusedFields::checkWriteOnly(const FieldDecl* fieldDecl, const Expr* member
|
||||
bPotentiallyReadFrom = true;
|
||||
break;
|
||||
}
|
||||
child = parent;
|
||||
auto parentsRange = compiler.getASTContext().getParents(*parent);
|
||||
parent = parentsRange.begin() == parentsRange.end() ? nullptr : parentsRange.begin()->get<Stmt>();
|
||||
walkupUp();
|
||||
}
|
||||
else if (auto caseStmt = dyn_cast<CaseStmt>(parent))
|
||||
{
|
||||
@@ -319,6 +320,15 @@ void UnusedFields::checkWriteOnly(const FieldDecl* fieldDecl, const Expr* member
|
||||
bPotentiallyReadFrom = doStmt->getCond() == child;
|
||||
break;
|
||||
}
|
||||
else if (auto arraySubscriptExpr = dyn_cast<ArraySubscriptExpr>(parent))
|
||||
{
|
||||
if (arraySubscriptExpr->getIdx() == child)
|
||||
{
|
||||
bPotentiallyReadFrom = true;
|
||||
break;
|
||||
}
|
||||
walkupUp();
|
||||
}
|
||||
else if (auto callExpr = dyn_cast<CallExpr>(parent))
|
||||
{
|
||||
// check for calls to ReadXXX() type methods and the operator>>= methods on Any.
|
||||
@@ -378,7 +388,6 @@ void UnusedFields::checkWriteOnly(const FieldDecl* fieldDecl, const Expr* member
|
||||
|| isa<LabelStmt>(parent)
|
||||
|| isa<CXXForRangeStmt>(parent)
|
||||
|| isa<CXXTypeidExpr>(parent)
|
||||
|| isa<ArraySubscriptExpr>(parent)
|
||||
|| isa<DefaultStmt>(parent))
|
||||
{
|
||||
break;
|
||||
|
@@ -128,6 +128,9 @@ for d in definitionSet:
|
||||
# ignore reference fields, because writing to them actually writes to another field somewhere else
|
||||
if fieldType.endswith("&"):
|
||||
continue
|
||||
# ignore the import/export data model stuff
|
||||
if srcLoc.startswith("sc/source/filter/inc/") and "Model" in fieldType:
|
||||
continue
|
||||
|
||||
writeonlySet.add((clazz + " " + definitionToTypeMap[d], srcLoc))
|
||||
|
||||
|
@@ -16,26 +16,20 @@ chart2/source/view/inc/GL3DRenderer.hxx:66
|
||||
chart::opengl3D::LightSource pad3 float
|
||||
comphelper/source/container/enumerablemap.cxx:299
|
||||
comphelper::MapEnumeration m_xKeepMapAlive Reference<class com::sun::star::uno::XInterface>
|
||||
compilerplugins/clang/test/datamembershadow.cxx:17
|
||||
Bar x int
|
||||
compilerplugins/clang/test/datamembershadow.cxx:21
|
||||
Foo x int
|
||||
compilerplugins/clang/test/finalprotected.cxx:17
|
||||
S g1 int
|
||||
compilerplugins/clang/test/finalprotected.cxx:20
|
||||
S h1 int
|
||||
compilerplugins/clang/test/finalprotected.cxx:29
|
||||
S2 g1 int
|
||||
compilerplugins/clang/test/finalprotected.cxx:32
|
||||
S2 h1 int
|
||||
compilerplugins/clang/test/passstuffbyref.cxx:13
|
||||
S mv1 class rtl::OUString
|
||||
compilerplugins/clang/test/passstuffbyref.cxx:14
|
||||
S mv2 class rtl::OUString
|
||||
compilerplugins/clang/test/salbool.cxx:15
|
||||
S b sal_Bool
|
||||
compilerplugins/clang/test/unnecessaryoverride-dtor.hxx:42
|
||||
IncludedDerived3 m rtl::Reference<Incomplete>
|
||||
connectivity/source/drivers/evoab2/EApi.h:122
|
||||
(anonymous) address_format char *
|
||||
connectivity/source/drivers/evoab2/EApi.h:126
|
||||
(anonymous) ext char *
|
||||
connectivity/source/drivers/evoab2/NPreparedStatement.hxx:51
|
||||
connectivity::evoab::OEvoabPreparedStatement::Parameter aValue css::uno::Any
|
||||
connectivity/source/drivers/evoab2/NPreparedStatement.hxx:52
|
||||
connectivity::evoab::OEvoabPreparedStatement::Parameter nDataType sal_Int32
|
||||
connectivity/source/drivers/evoab2/NPreparedStatement.hxx:60
|
||||
connectivity::evoab::OEvoabPreparedStatement m_aParameters std::vector<Parameter>
|
||||
connectivity/source/drivers/evoab2/NResultSet.hxx:91
|
||||
connectivity::evoab::OEvoabResultSet m_aStatement css::uno::WeakReferenceHelper
|
||||
connectivity/source/drivers/evoab2/NTable.hxx:34
|
||||
connectivity::evoab::OEvoabTable m_xMetaData css::uno::Reference<css::sdbc::XDatabaseMetaData>
|
||||
connectivity/source/drivers/mork/MDatabaseMetaData.hxx:29
|
||||
connectivity::mork::ODatabaseMetaData m_pMetaDataHelper std::unique_ptr<MDatabaseMetaDataHelper>
|
||||
connectivity/source/inc/OTypeInfo.hxx:31
|
||||
@@ -88,7 +82,7 @@ filter/source/xsltdialog/xmlfiltersettingsdialog.hxx:71
|
||||
XMLFilterListBox m_aEnsureResMgr class EnsureResMgr
|
||||
filter/source/xsltdialog/xmlfiltersettingsdialog.hxx:130
|
||||
XMLFilterSettingsDialog maEnsureResMgr class EnsureResMgr
|
||||
framework/inc/dispatch/oxt_handler.hxx:95
|
||||
framework/inc/dispatch/oxt_handler.hxx:92
|
||||
framework::Oxt_Handler m_xSelfHold css::uno::Reference<css::uno::XInterface>
|
||||
include/comphelper/MasterPropertySet.hxx:38
|
||||
comphelper::SlaveData mxSlave css::uno::Reference<css::beans::XPropertySet>
|
||||
@@ -110,9 +104,7 @@ include/svtools/unoevent.hxx:159
|
||||
SvEventDescriptor xParentRef css::uno::Reference<css::uno::XInterface>
|
||||
include/vcl/uitest/uiobject.hxx:241
|
||||
TabPageUIObject mxTabPage VclPtr<class TabPage>
|
||||
include/vcl/vclptr.hxx:58
|
||||
vcl::detail::UpCast::S c char [2]
|
||||
include/xmloff/formlayerexport.hxx:174
|
||||
include/xmloff/formlayerexport.hxx:173
|
||||
xmloff::OOfficeFormsExport m_pImpl std::unique_ptr<OFormsRootExport>
|
||||
lotuswordpro/source/filter/clone.hxx:23
|
||||
detail::has_clone::(anonymous) a char [2]
|
||||
@@ -142,25 +134,29 @@ sc/qa/unit/ucalc_column.cxx:103
|
||||
aInputs aName const char *
|
||||
sc/source/filter/inc/sheetdatacontext.hxx:61
|
||||
oox::xls::SheetDataContext aReleaser class SolarMutexReleaser
|
||||
sc/source/ui/inc/dataprovider.hxx:46
|
||||
sc::ExternalDataMapper maDocument class ScDocument
|
||||
sc/source/ui/inc/docsh.hxx:438
|
||||
ScDocShellModificator mpProtector std::unique_ptr<ScRefreshTimerProtector>
|
||||
sc/source/ui/vba/vbafont.hxx:36
|
||||
ScVbaFont mPalette class ScVbaPalette
|
||||
sd/source/ui/remotecontrol/ZeroconfService.hxx:36
|
||||
sd::ZeroconfService port uint
|
||||
sd/source/ui/table/TableDesignPane.hxx:113
|
||||
sd::TableDesignPane aImpl class sd::TableDesignWidget
|
||||
sd/source/ui/view/DocumentRenderer.cxx:1335
|
||||
sd::DocumentRenderer::Implementation mxObjectShell SfxObjectShellRef
|
||||
sd/source/ui/view/viewshel.cxx:1236
|
||||
sd/source/ui/view/viewshel.cxx:1233
|
||||
sd::KeepSlideSorterInSyncWithPageChanges m_aDrawLock sd::slidesorter::view::class SlideSorterView::DrawLock
|
||||
sd/source/ui/view/viewshel.cxx:1237
|
||||
sd/source/ui/view/viewshel.cxx:1234
|
||||
sd::KeepSlideSorterInSyncWithPageChanges m_aModelLock sd::slidesorter::controller::class SlideSorterController::ModelChangeLock
|
||||
sd/source/ui/view/viewshel.cxx:1238
|
||||
sd/source/ui/view/viewshel.cxx:1235
|
||||
sd::KeepSlideSorterInSyncWithPageChanges m_aUpdateLock sd::slidesorter::controller::class PageSelector::UpdateLock
|
||||
sd/source/ui/view/viewshel.cxx:1239
|
||||
sd/source/ui/view/viewshel.cxx:1236
|
||||
sd::KeepSlideSorterInSyncWithPageChanges m_aContext sd::slidesorter::controller::class SelectionObserver::Context
|
||||
sd/source/ui/view/ViewShellBase.cxx:201
|
||||
sd/source/ui/view/ViewShellBase.cxx:195
|
||||
sd::ViewShellBase::Implementation mpPageCacheManager std::shared_ptr<slidesorter::cache::PageCacheManager>
|
||||
sfx2/source/doc/doctempl.cxx:119
|
||||
sfx2/source/doc/doctempl.cxx:118
|
||||
DocTempl::DocTempl_EntryData_Impl mxObjShell class SfxObjectShellLock
|
||||
starmath/inc/view.hxx:224
|
||||
SmViewShell maGraphicController class SmGraphicController
|
||||
@@ -180,7 +176,7 @@ sw/source/uibase/inc/uivwimp.hxx:95
|
||||
SwView_Impl xTmpSelDocSh class SfxObjectShellLock
|
||||
sw/source/uibase/inc/unodispatch.hxx:46
|
||||
SwXDispatchProviderInterceptor::DispatchMutexLock_Impl aGuard class SolarMutexGuard
|
||||
toolkit/source/awt/stylesettings.cxx:91
|
||||
toolkit/source/awt/stylesettings.cxx:90
|
||||
toolkit::StyleMethodGuard m_aGuard class SolarMutexGuard
|
||||
unoidl/source/unoidlprovider.cxx:672
|
||||
unoidl::detail::(anonymous namespace)::UnoidlCursor reference1_ rtl::Reference<UnoidlProvider>
|
||||
@@ -192,15 +188,15 @@ vcl/source/gdi/jobset.cxx:34
|
||||
ImplOldJobSetupData cDeviceName char [32]
|
||||
vcl/source/gdi/jobset.cxx:35
|
||||
ImplOldJobSetupData cPortName char [32]
|
||||
vcl/source/gdi/pdfwriter_impl.cxx:5448
|
||||
vcl/source/gdi/pdfwriter_impl.cxx:5432
|
||||
(anonymous namespace)::(anonymous) extnID SECItem
|
||||
vcl/source/gdi/pdfwriter_impl.cxx:5449
|
||||
vcl/source/gdi/pdfwriter_impl.cxx:5433
|
||||
(anonymous namespace)::(anonymous) critical SECItem
|
||||
vcl/source/gdi/pdfwriter_impl.cxx:5450
|
||||
vcl/source/gdi/pdfwriter_impl.cxx:5434
|
||||
(anonymous namespace)::(anonymous) extnValue SECItem
|
||||
vcl/source/gdi/pdfwriter_impl.cxx:5819
|
||||
vcl/source/gdi/pdfwriter_impl.cxx:5803
|
||||
(anonymous namespace)::(anonymous) statusString SECItem
|
||||
vcl/source/gdi/pdfwriter_impl.cxx:5820
|
||||
vcl/source/gdi/pdfwriter_impl.cxx:5804
|
||||
(anonymous namespace)::(anonymous) failInfo SECItem
|
||||
vcl/source/uitest/uno/uitest_uno.cxx:35
|
||||
UITestUnoObj mpUITest std::unique_ptr<UITest>
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user