loplugin:cstylecast: Warn about more of the potentially suspicious ones
Change-Id: Id7a596344c21e9265e35188c477e60ce510bcc6e
This commit is contained in:
parent
e6c124ae3b
commit
3adaad3e36
@ -98,12 +98,10 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) {
|
|||||||
if( expr->getCastKind() == CK_BitCast ) {
|
if( expr->getCastKind() == CK_BitCast ) {
|
||||||
QualType t1 = resolvePointers(expr->getSubExprAsWritten()->getType());
|
QualType t1 = resolvePointers(expr->getSubExprAsWritten()->getType());
|
||||||
QualType t2 = resolvePointers(expr->getType());
|
QualType t2 = resolvePointers(expr->getType());
|
||||||
// Ignore "safe" casts for now that do not involve incomplete types (and
|
// Ignore "safe" casts for now that involve casting from or to void*
|
||||||
// can thus not be interpreted as either a static_cast or a
|
// (and can thus not be interpreted as either a static_cast or a
|
||||||
// reinterpret_cast, with potentially different results):
|
// reinterpret_cast, with potentially different results):
|
||||||
if (t1->isVoidType() || t2->isVoidType()
|
if (t1->isVoidType() || t2->isVoidType()) {
|
||||||
|| !(t1->isIncompleteType() || t2->isIncompleteType()))
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (t1->isIncompleteType()) {
|
if (t1->isIncompleteType()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user