Kaydet (Commit) 3281628e authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:redundantcast ignore functional casts involving typedefs

<sberg> noelgrandin, 718cdd43 now also
looks through typedef sugar, e.g. complaining about a gdouble -> double
expl. conversion in configmgr/source/dconf.cxx;
I think we want to remain silent about such conversions involving typedefs
<noelgrandin> sberg, ah, good point.

Change-Id: Icbb0d6be273f53e507c91556cf0ccb5a5c03e5a1
Reviewed-on: https://gerrit.libreoffice.org/41175Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
Tested-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 688624b7
......@@ -633,9 +633,13 @@ bool RedundantCast::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr const * exp
}
auto const t1 = expr->getTypeAsWritten();
auto const t2 = sub->getType().getDesugaredType(compiler.getASTContext());
auto const t2 = sub->getType().getDesugaredType(compiler.getASTContext()); // look through templated wrapped types
if (t1 != t2)
return true;
// if we are casting from/to a typedef, ignore it, even if the underlying types are the same
if ((loplugin::TypeCheck(t1).Typedef() || loplugin::TypeCheck(sub->getType()).Typedef())
&& t1 != sub->getType())
return true;
if (!isOkToRemoveArithmeticCast(t1, t2, expr->getSubExpr()))
return true;
report(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment