loplugin:redundantpointerops check other pointer types
as well as unique_ptr Change-Id: I54842bca161ee460fb96c46ca31b6f9c0a7dbbdf Reviewed-on: https://gerrit.libreoffice.org/80455 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -123,13 +123,16 @@ bool RedundantPointerOps::VisitUnaryOperator(UnaryOperator const * unaryOperator
|
||||
if (auto cxxMemberCallExpr = dyn_cast<CXXMemberCallExpr>(subExpr))
|
||||
{
|
||||
auto methodDecl = cxxMemberCallExpr->getMethodDecl();
|
||||
if (methodDecl->getIdentifier() && methodDecl->getName() == "get"
|
||||
&& cxxMemberCallExpr->getRecordDecl()->getName() == "unique_ptr")
|
||||
report(
|
||||
DiagnosticsEngine::Warning, "'*' followed by '.get()', just use '*'",
|
||||
compat::getBeginLoc(unaryOperator))
|
||||
<< unaryOperator->getSourceRange();
|
||||
if (methodDecl->getIdentifier() && methodDecl->getName() == "get")
|
||||
{
|
||||
auto className = cxxMemberCallExpr->getRecordDecl()->getName();
|
||||
if (className == "unique_ptr" || className == "shared_ptr" || className == "Reference" || className == "SvRef")
|
||||
report(
|
||||
DiagnosticsEngine::Warning, "'*' followed by '.get()', just use '*'",
|
||||
compat::getBeginLoc(unaryOperator))
|
||||
<< unaryOperator->getSourceRange();
|
||||
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user