improve unnecessaryoverride plugin

to ignore ImplicitCastExpr when calling superclass method

Change-Id: I76a3068446acfee85aa1baeb216e57f63c7099c1
Reviewed-on: https://gerrit.libreoffice.org/27279
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
Noel Grandin
2016-07-18 09:03:51 +02:00
committed by Noel Grandin
parent a7b5be1181
commit 36313d93ac
24 changed files with 9 additions and 116 deletions

View File

@@ -66,6 +66,12 @@ bool UnnecessaryOverride::VisitCXXMethodDecl(const CXXMethodDecl* methodDecl)
// not sure what is happening here
if (aFileName == SRCDIR "/extensions/source/bibliography/datman.cxx")
return true;
// some very creative method hiding going on here
if (aFileName == SRCDIR "/svx/source/dialog/checklbx.cxx")
return true;
// entertaining template magic
if (aFileName == SRCDIR "/sc/source/ui/vba/vbaformatcondition.cxx")
return true;
const CXXMethodDecl* overriddenMethodDecl = *methodDecl->begin_overridden_methods();
@@ -133,7 +139,8 @@ bool UnnecessaryOverride::VisitCXXMethodDecl(const CXXMethodDecl* methodDecl)
if (!expr2)
return true;
for (unsigned i = 0; i<callExpr->getNumArgs(); ++i) {
const DeclRefExpr * declRefExpr = dyn_cast<DeclRefExpr>(callExpr->getArg(i));
// ignore ImplicitCastExpr
const DeclRefExpr * declRefExpr = dyn_cast<DeclRefExpr>(callExpr->getArg(i)->IgnoreImplicit());
if (!declRefExpr || declRefExpr->getDecl() != methodDecl->getParamDecl(i))
return true;
}