-Warc-repeated-use-of-weak: fix a use-of-uninitialized and add a test case.

Fix-up for r165718, should get the buildbots back online.

llvm-svn: 165723
This commit is contained in:
Jordan Rose 2012-10-11 17:02:00 +00:00
parent 57b7e8f63f
commit b1e3e5f553
2 changed files with 13 additions and 1 deletions

View File

@ -159,7 +159,7 @@ void FunctionScopeInfo::markSafeWeakUse(const Expr *E) {
Uses = WeakObjectUses.find(WeakObjectProfileTy(IvarE));
else if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E))
Uses = WeakObjectUses.find(WeakObjectProfileTy(DRE));
else if (const ObjCMessageExpr *MsgE = dyn_cast<ObjCMessageExpr>(MsgE)) {
else if (const ObjCMessageExpr *MsgE = dyn_cast<ObjCMessageExpr>(E)) {
Uses = WeakObjectUses.end();
if (const ObjCMethodDecl *MD = MsgE->getMethodDecl()) {
if (const ObjCPropertyDecl *Prop = MD->findPropertyDecl()) {

View File

@ -181,6 +181,18 @@ void assignToStrongWithCasts(Test *a) {
}
}
void assignToStrongWithMessages(Test *a) {
if (condition()) {
id val = [a weakProp]; // no-warning
(void)val;
} else {
id val;
val = [a weakProp]; // no-warning
(void)val;
}
}
void assignAfterRead(Test *a) {
// Special exception for a single read before any writes.
if (!a.weakProp) // no-warning