diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-03 09:08:52 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-03 10:38:42 +0100 |
commit | 1b666235f6b0b0f0b13f473bf3b639f4f5f0b12f (patch) | |
tree | 27d954769f796bc5fcac78c51447b9d2336f5a5e /compilerplugins/clang | |
parent | 15d9087ff1e495e234b2cf073329c3358abb4dc0 (diff) |
loplugin:singlevalfields improve copy constructor check
Change-Id: Id1e7fbecd9e9f816553d2e678c3f1b7890fc4db8
Reviewed-on: https://gerrit.libreoffice.org/47293
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang')
-rw-r--r-- | compilerplugins/clang/singlevalfields.cxx | 14 | ||||
-rw-r--r-- | compilerplugins/clang/singlevalfields.results | 25 |
2 files changed, 27 insertions, 12 deletions
diff --git a/compilerplugins/clang/singlevalfields.cxx b/compilerplugins/clang/singlevalfields.cxx index 61cfe044d1fd..83733b7a0041 100644 --- a/compilerplugins/clang/singlevalfields.cxx +++ b/compilerplugins/clang/singlevalfields.cxx @@ -142,7 +142,7 @@ bool SingleValFields::VisitCXXConstructorDecl( const CXXConstructorDecl* decl ) // doesn't count as a write to fields because it's self->self if (decl->isCopyOrMoveConstructor()) - return true; + return true; for(auto it = decl->init_begin(); it != decl->init_end(); ++it) { @@ -246,9 +246,15 @@ bool SingleValFields::VisitMemberExpr( const MemberExpr* memberExpr ) return true; const FunctionDecl* parentFunction = getParentFunctionDecl(memberExpr); - const CXXMethodDecl* methodDecl = dyn_cast_or_null<CXXMethodDecl>(parentFunction); - if (methodDecl && (methodDecl->isCopyAssignmentOperator() || methodDecl->isMoveAssignmentOperator())) - return true; + if (parentFunction) + { + auto methodDecl = dyn_cast<CXXMethodDecl>(parentFunction); + if (methodDecl && (methodDecl->isCopyAssignmentOperator() || methodDecl->isMoveAssignmentOperator())) + return true; + auto cxxConstructorDecl = dyn_cast<CXXConstructorDecl>(parentFunction); + if (cxxConstructorDecl && cxxConstructorDecl->isCopyOrMoveConstructor()) + return true; + } // walk up the tree until we find something interesting const Stmt* child = memberExpr; diff --git a/compilerplugins/clang/singlevalfields.results b/compilerplugins/clang/singlevalfields.results index 823de7ba50d7..d54fac80e7c9 100644 --- a/compilerplugins/clang/singlevalfields.results +++ b/compilerplugins/clang/singlevalfields.results @@ -25,6 +25,18 @@ include/svtools/svparser.hxx:74 include/svtools/svparser.hxx:75 SvParser::TokenStackType bTokenHasValue 0 +include/tools/multisel.hxx:41 + MultiSelection bInverseCur + 0 +include/unotools/textsearch.hxx:104 + utl::SearchParam m_bWordOnly + 0 +include/unotools/textsearch.hxx:105 + utl::SearchParam m_bSrchInSel + 0 +include/unotools/textsearch.hxx:110 + utl::SearchParam nTransliterationFlags + 0 include/vcl/filter/pdfdocument.hxx:173 vcl::filter::PDFNameElement m_nLength 0 @@ -67,9 +79,6 @@ sc/inc/compiler.hxx:108 sc/qa/unit/ucalc.hxx:41 Test::RangeNameDef mnIndex 1 -sc/source/ui/inc/undodat.hxx:447 - ScUndoDataForm nStartChangeAction - 0 sd/inc/sdpptwrp.hxx:42 SdPPTFilter pBas 0 @@ -109,6 +118,9 @@ sw/inc/pagepreviewlayout.hxx:49 sw/source/core/inc/frmtool.hxx:260 SwBorderAttrs m_bBorderDist 1 +sw/source/core/inc/swfont.hxx:170 + SwFont m_bURL + 0 sw/source/core/inc/UndoSort.hxx:38 SwSortUndoElement::(anonymous union)::(anonymous) nKenn 4294967295 @@ -133,9 +145,6 @@ sw/source/filter/ww8/ww8par.hxx:651 sw/source/filter/ww8/ww8par.hxx:660 WW8FormulaControl mhpsCheckBox 20 -sw/source/uibase/lingu/sdrhhcwrap.hxx:33 - SdrHHCWrapper pTextObj - 0 vcl/inc/salprn.hxx:41 SalPrinterQueueInfo mnStatus 0 @@ -169,10 +178,10 @@ vcl/source/filter/jpeg/transupp.h:131 vcl/source/font/font.cxx:539 (anonymous namespace)::WeightSearchEntry weight 5 -vcl/source/gdi/pdfwriter_impl.hxx:706 +vcl/source/gdi/pdfwriter_impl.hxx:705 vcl::PDFWriterImpl m_nInheritedPageWidth 595 -vcl/source/gdi/pdfwriter_impl.hxx:707 +vcl/source/gdi/pdfwriter_impl.hxx:706 vcl::PDFWriterImpl m_nInheritedPageHeight 842 writerfilter/source/dmapper/GraphicImport.cxx:223 |