diff options
author | Noel Grandin <noel@peralex.com> | 2016-02-25 11:57:47 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-02-25 11:57:47 +0200 |
commit | 9c6b6c6c074a8597502e899a22aa7cb1c3f712ce (patch) | |
tree | 31a8df3efe73ad0d52adc8107f7bdb41e76eda5c /compilerplugins | |
parent | 4fbf95deba87ed28ee8eb8442477832e46ba76c6 (diff) |
turn unuseddefaultparams plugin off by default
add fix the method override logic
Change-Id: Ia75bc70aa1b8d26a65a4082956dc88a0fd17be9e
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/unuseddefaultparams.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compilerplugins/clang/unuseddefaultparams.cxx b/compilerplugins/clang/unuseddefaultparams.cxx index 1e33feae6330..548720fe9f08 100644 --- a/compilerplugins/clang/unuseddefaultparams.cxx +++ b/compilerplugins/clang/unuseddefaultparams.cxx @@ -130,10 +130,6 @@ bool UnusedDefaultParams::VisitCallExpr(CallExpr * callExpr) { return true; } const FunctionDecl* functionDecl = callExpr->getDirectCallee()->getCanonicalDecl(); - auto n = functionDecl->getNumParams(); - if (n == 0 || !functionDecl->getParamDecl(n - 1)->hasDefaultArg()) { - return true; - } // method overrides don't always specify the same default params (althogh they probably should) // so we need to work our way up to the root method while (isa<CXXMethodDecl>(functionDecl)) { @@ -142,6 +138,10 @@ bool UnusedDefaultParams::VisitCallExpr(CallExpr * callExpr) { break; functionDecl = *methodDecl->begin_overridden_methods(); } + auto n = functionDecl->getNumParams(); + if (n == 0 || !functionDecl->getParamDecl(n - 1)->hasDefaultArg()) { + return true; + } assert(callExpr->getNumArgs() <= n); // can be < in template code for (unsigned i = callExpr->getNumArgs(); i != 0;) { --i; @@ -208,7 +208,7 @@ bool UnusedDefaultParams::VisitFunctionDecl( const FunctionDecl* functionDecl ) return true; } -loplugin::Plugin::Registration< UnusedDefaultParams > X("unuseddefaultparams", true); +loplugin::Plugin::Registration< UnusedDefaultParams > X("unuseddefaultparams", false); } |