Tweak -Wuninitialized's handling of 'int x = x' to report that as the root cause of an uninitialized variable IFF there are other uses of that uninitialized variable. Fixes <rdar://problem/9259237>.

llvm-svn: 141881
This commit is contained in:
Ted Kremenek
2011-10-13 18:50:06 +00:00
parent 7e442569dc
commit 596fa16dd3
4 changed files with 67 additions and 28 deletions

View File

@@ -484,11 +484,17 @@ void TransferFunctions::VisitDeclStmt(DeclStmt *ds) {
vals[vd] = Uninitialized;
lastLoad = 0;
lastDR = 0;
if (handler)
handler->handleSelfInit(vd);
return;
}
}
// All other cases: treat the new variable as initialized.
// This is a minor optimization to reduce the propagation
// of the analysis, since we will have already reported
// the use of the uninitialized value (which visiting the
// initializer).
vals[vd] = Initialized;
}
}