Avoid loplugin:constparam when param is subject of cast to non-const pointer
...as in WriteCallback (desktop/source/minidump/minidump.cxx), where void *ptr is use in static_cast<char *>(ptr) Change-Id: I0bd44329029cd793390d0744de3c839612e0b494
This commit is contained in:
@@ -418,6 +418,12 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
|
||||
} else if (isa<CXXConstCastExpr>(parent)) {
|
||||
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())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return checkIfCanBeConst(parent, parmVarDecl);
|
||||
} else if (isa<MemberExpr>(parent)) {
|
||||
return checkIfCanBeConst(parent, parmVarDecl);
|
||||
|
Reference in New Issue
Block a user