update unusedmethods plugin to ignore externC and copy constructors

Change-Id: Idf7a9403d313ba6a0e031c59601e20c880b6118b
This commit is contained in:
Noel Grandin
2016-05-18 16:37:36 +02:00
parent 48d0affa11
commit d59125638b

View File

@@ -212,7 +212,9 @@ void UnusedMethods::logCallToRootMethods(const FunctionDecl* functionDecl, std::
{
while (functionDecl->getTemplateInstantiationPattern())
functionDecl = functionDecl->getTemplateInstantiationPattern();
funcSet.insert(niceName(functionDecl));
if (functionDecl->getLocation().isValid() && !ignoreLocation( functionDecl )
&& !functionDecl->isExternC())
funcSet.insert(niceName(functionDecl));
}
}
@@ -348,8 +350,12 @@ bool UnusedMethods::VisitFunctionDecl( const FunctionDecl* functionDecl )
if (functionDecl->isDeleted() || functionDecl->isDefaulted()) {
return true;
}
if (isa<CXXConstructorDecl>(functionDecl) && dyn_cast<CXXConstructorDecl>(functionDecl)->isCopyConstructor()) {
return true;
}
if( functionDecl->getLocation().isValid() && !ignoreLocation( functionDecl ))
if( functionDecl->getLocation().isValid() && !ignoreLocation( functionDecl )
&& !functionDecl->isExternC())
{
MyFuncInfo funcInfo = niceName(functionDecl);
definitionSet.insert(funcInfo);