[cfe-commits] Patch for PR5273

Sebastian Redl sebastian.redl at getdesigned.at
Tue Oct 27 14:48:45 PDT 2009


John McCall wrote:
> The correct strategy is to start with the minimal possible case 
> — here, isa<CXXThisExpr>(S). If there are cases that doesn't cover that 
> you're certain you want to warn about, then add those in specifically — 
> for example, casts of this (or casts of casts of this, etc.) — and just 
> keep whitelisting expressions until you're happy with the warnings 
> you've got.
>
> I would write this function as:
>
> static bool IsCXXThisExpr(const Expr* E) {
> while (const CastExpr *CE = dyn_cast<CastExpr>(E))
> E = CE->getSubExpr();
> return isa<CXXThisExpr>(E);
> }
>   
E = E->IgnoreParenCasts();
?

Sebastian





More information about the cfe-commits mailing list