[cfe-commits] Patch for PR5273

John McCall rjmccall at apple.com
Tue Oct 27 15:22:41 PDT 2009


Sebastian Redl wrote:
> 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();
> ?
>   

I'd forgotten about that one;  compelling point.  So we should be able 
to do without this helper function at all.

John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20091027/c39c620a/attachment.html>


More information about the cfe-commits mailing list