<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Brandon Pearcy wrote:
<blockquote
 cite="mid:e6daa70e0910290817o4612cc3dy50fe6ee565944c38@mail.gmail.com"
 type="cite">
  <div class="gmail_quote">Hello again John!</div>
  <div class="gmail_quote"><br>
  <div>As discussed, I have dropped the IsCXXThisExpression in favor of
a much simpler couple lines of code:</div>
  <div><br>
  </div>
  <div>      const Expr* base = ME->getBase();</div>
  <div>      if (base != NULL &&
!isa<CXXThisExpr>(base->IgnoreParenCasts())) {</div>
  <div>        // Even though the field matches, it does not belong to
this record.</div>
  <div>        return false;</div>
  <div>      }</div>
  </div>
</blockquote>
<br>
Excellent.<br>
<br>
<blockquote
 cite="mid:e6daa70e0910290817o4612cc3dy50fe6ee565944c38@mail.gmail.com"
 type="cite">
  <div class="gmail_quote">
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">This
catches the case where we're taking the address of the argument, but
not the case where we're passing it by reference argument to some
function.<br>
  </blockquote>
  <div><br>
  </div>
  <div>I am sure I am overlooking something, but I thought I'd push
back for now. Do we care if it is passed by reference to a function?
The only valid operations within that function (that I can imagine)
would be to take the address of the uninitialized field, or assign a
value to it. The former can be achieved by passing the address into the
function, and the latter is just strange considering it is being called
from an initialization list).</div>
  </div>
</blockquote>
<br>
I agree with Sebastian; we don't want to be policing code style.  If we
don't understand the code, we have to assume that it's valid.<br>
<br>
Like I said in the bug, I think there are common cases we can
green-light a warning for:  for example, if we're passing an
uninitialized field by reference to a copy constructor, then sure,
let's warn about it.  But for arbitrary function calls?  No.<br>
<br>
<blockquote
 cite="mid:e6daa70e0910290817o4612cc3dy50fe6ee565944c38@mail.gmail.com"
 type="cite">
  <div class="gmail_quote">
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">This
can still warn twice for a single initializer if the initializer has
multiple arguments, e.g.<br>
    <br>
A() : B(B, B) {}<br>
    <br>
Please fix this and add a test to make sure this only warns once.<br>
  </blockquote>
  <div><br>
  </div>
  <div>I'm sure there is a good reason to have it only warn once, but I
thought it would be better to point out as many potential bugs as
possible per pass of the compiler. Do you want the warning to point out
both instances of B? Or just the first one? What if we have two
different uninitialized fields used in an initializer, e.g.</div>
  <div><br>
  </div>
  <div>A() : B(B, C) {} (where C declared after B)</div>
  <div><br>
  </div>
  <div>I want this check to eventually report a warning for the use of
any and all uninitialized fields, and I am assuming we want to report
all of them in a single pass of the compiler.</div>
  </div>
</blockquote>
<br>
Thinking twice about it, warning for each use is probably fine.<br>
<br>
John.
</body>
</html>