loplugin:unusedfields

make it a little smarter in dealing with fields that are smart pointers

Change-Id: I44072105170882dc29fb19558f1065cffc7e5f11
Reviewed-on: https://gerrit.libreoffice.org/37751
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2017-05-18 12:38:23 +02:00
parent 8a01fc2f50
commit fd00bd0f69
48 changed files with 881 additions and 175 deletions

View File

@@ -259,6 +259,11 @@ bool UnusedFields::VisitMemberExpr( const MemberExpr* memberExpr )
if (startswith(name, "read") || name.find(">>=") != std::string::npos)
// this is a write-only call
;
else if (name == "clear" || name == "dispose" || name == "clearAndDispose" || name == "swap")
// we're abusing the write-only analysis here to look for fields which don't have anything useful
// being done to them, so we're ignoreing things like std::vector::clear, vector::swap,
// and VclPtr::clearAndDispose
;
else
bPotentiallyReadFrom = true;
}