Avoid loplugin:constparam when param is cast to void

...which typically indicates that the param just has to be of the given type for
some reason

Change-Id: Ide30f514c5a849ae897c31c1744ece9df712a9fc
This commit is contained in:
Stephan Bergmann 2017-08-30 15:14:19 +02:00
parent 0660a30d54
commit 5d2e830a30

View File

@ -187,8 +187,6 @@ bool ConstParams::VisitFunctionDecl(const FunctionDecl * functionDecl)
|| name == "egiGraphicExport"
|| name == "etiGraphicExport"
|| name == "epsGraphicExport"
|| name == "QueueCallbackFunction"
// apple_remote/source/HIDRemoteControlDevice.m
)
return true;
}
@ -419,8 +417,8 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
return false;
} else if (isa<CastExpr>(parent)) { // all other cast expression subtypes
if (auto e = dyn_cast<ExplicitCastExpr>(parent)) {
if (loplugin::TypeCheck(e->getTypeAsWritten()).Pointer().NonConst())
{
loplugin::TypeCheck tc(e->getTypeAsWritten());
if (tc.Pointer().NonConst() || tc.Void()) {
return false;
}
}