loplugin:redundantcast: cstyle_cast within reinterpret_cast
Change-Id: Ie31c9dd6d8741aa856553b798bb5b7f695a3fe0f Reviewed-on: https://gerrit.libreoffice.org/42776 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
@@ -522,6 +522,20 @@ bool RedundantCast::VisitCXXReinterpretCastExpr(
|
||||
expr->getExprLoc())
|
||||
<< expr->getSubExprAsWritten()->getType() << expr->getType()
|
||||
<< expr->getSourceRange();
|
||||
} else if (expr->getType()->isFundamentalType()) {
|
||||
if (auto const sub = dyn_cast<CXXConstCastExpr>(
|
||||
expr->getSubExpr()->IgnoreParens()))
|
||||
{
|
||||
report(
|
||||
DiagnosticsEngine::Warning,
|
||||
("redundant const_cast from %0 to %1 within reinterpret_cast to"
|
||||
" fundamental type %2"),
|
||||
expr->getExprLoc())
|
||||
<< sub->getSubExprAsWritten()->getType()
|
||||
<< sub->getTypeAsWritten() << expr->getTypeAsWritten()
|
||||
<< expr->getSourceRange();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user