]> granicus.if.org Git - clang/commitdiff
-Warc-repeated-use-of-weak: fix a use-of-uninitialized and add a test case.
authorJordan Rose <jordan_rose@apple.com>
Thu, 11 Oct 2012 17:02:00 +0000 (17:02 +0000)
committerJordan Rose <jordan_rose@apple.com>
Thu, 11 Oct 2012 17:02:00 +0000 (17:02 +0000)
Fix-up for r165718, should get the buildbots back online.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165723 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/ScopeInfo.cpp
test/SemaObjC/arc-repeated-weak.mm

index c1d66299058361c8c790e3a55de63f2d018ce885..4d29a34a73ef92530bffef7e0fba4e95f8cc442a 100644 (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()) {
index a59f435693dfb30249d230c8a6f858e6d0ff588c..1539a9bcae07579cf3bef9d43e04294a7489d6a5 100644 (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