Kaydet (Commit) 9c6b6c6c authored tarafından Noel Grandin's avatar Noel Grandin

turn unuseddefaultparams plugin off by default

add fix the method override logic

Change-Id: Ia75bc70aa1b8d26a65a4082956dc88a0fd17be9e
üst 4fbf95de
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment