summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-05-18 16:37:36 +0200
committerNoel Grandin <noel@peralex.com>2016-05-18 16:38:23 +0200
commitd59125638bf4c58507d4311f614abc429c7b3b8d (patch)
tree35ccad8450b99d8752783280d546edaaaf058414 /compilerplugins
parent48d0affa114d6838c0e99f3f3588dd611a4a2b72 (diff)
update unusedmethods plugin to ignore externC and copy constructors
Change-Id: Idf7a9403d313ba6a0e031c59601e20c880b6118b
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/unusedmethods.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/compilerplugins/clang/unusedmethods.cxx b/compilerplugins/clang/unusedmethods.cxx
index fe5825fbfd4f..aa645fb7cc4a 100644
--- a/compilerplugins/clang/unusedmethods.cxx
+++ b/compilerplugins/clang/unusedmethods.cxx
@@ -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);