Restrict loplugin:constparams cast-to-void check

Change-Id: I3c4d4f99b423f46136a79f3b06c5f0e1492872f1
This commit is contained in:
Stephan Bergmann
2017-08-31 11:23:26 +02:00
parent 72cfd4d024
commit 4082b5874a

View File

@@ -425,7 +425,13 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
return false;
}
if (loplugin::TypeCheck(t).Void()) {
return false;
if (auto const sub = dyn_cast<DeclRefExpr>(
e->getSubExpr()->IgnoreParenImpCasts()))
{
if (sub->getDecl() == parmVarDecl) {
return false;
}
}
}
}
return checkIfCanBeConst(parent, parmVarDecl);