loplugin:unusedmethods package
Change-Id: I19d6bbb9288d72b99d1023b4983b1c3fff7570e8 Reviewed-on: https://gerrit.libreoffice.org/16811 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
committed by
Noel Grandin
parent
3ddaeaab37
commit
e546ed01e6
@@ -142,19 +142,20 @@ bool UnusedMethods::VisitCallExpr(CallExpr* expr)
|
||||
if (ignoreLocation(expr)) {
|
||||
return true;
|
||||
}
|
||||
CXXMethodDecl* decl = dyn_cast_or_null<CXXMethodDecl>(
|
||||
expr->getDirectCallee());
|
||||
if (decl == nullptr) {
|
||||
return true;
|
||||
}
|
||||
logCallToRootMethods(decl);
|
||||
FunctionDecl* calleeFunctionDecl = expr->getDirectCallee();
|
||||
// if we see a call to a templated method, it effectively instantiates a new method,
|
||||
// so we need to examine it's interior to see if it in turn calls anything else
|
||||
if (decl->getTemplatedKind() != clang::FunctionDecl::TemplatedKind::TK_NonTemplate
|
||||
|| decl->isFunctionTemplateSpecialization())
|
||||
if (calleeFunctionDecl->getTemplatedKind() != clang::FunctionDecl::TemplatedKind::TK_NonTemplate
|
||||
|| calleeFunctionDecl->isFunctionTemplateSpecialization())
|
||||
{
|
||||
TraverseCXXMethodDecl(decl);
|
||||
TraverseFunctionDecl(calleeFunctionDecl);
|
||||
}
|
||||
|
||||
CXXMethodDecl* calleeMethodDecl = dyn_cast_or_null<CXXMethodDecl>(calleeFunctionDecl);
|
||||
if (calleeMethodDecl == nullptr) {
|
||||
return true;
|
||||
}
|
||||
logCallToRootMethods(calleeMethodDecl);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user