<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Sebastian Redl wrote:
<blockquote cite="mid:4AE76ABD.2010706@getdesigned.at" type="cite">
<pre wrap="">John McCall wrote:
</pre>
<blockquote type="cite">
<pre wrap="">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);
}
</pre>
</blockquote>
<pre wrap=""><!---->E = E->IgnoreParenCasts();
?
</pre>
</blockquote>
<br>
I'd forgotten about that one; compelling point. So we should be able
to do without this helper function at all.<br>
<br>
John.<br>
</body>
</html>