[cfe-commits] r165723 - in /cfe/trunk: lib/Sema/ScopeInfo.cpp test/SemaObjC/arc-repeated-weak.mm

Jordan Rose jordan_rose at apple.com
Thu Oct 11 10:02:01 PDT 2012


Author: jrose
Date: Thu Oct 11 12:02:00 2012
New Revision: 165723

URL: http://llvm.org/viewvc/llvm-project?rev=165723&view=rev
Log:
-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.

Modified:
    cfe/trunk/lib/Sema/ScopeInfo.cpp
    cfe/trunk/test/SemaObjC/arc-repeated-weak.mm

Modified: cfe/trunk/lib/Sema/ScopeInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/ScopeInfo.cpp?rev=165723&r1=165722&r2=165723&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/ScopeInfo.cpp (original)
+++ cfe/trunk/lib/Sema/ScopeInfo.cpp Thu Oct 11 12:02:00 2012
@@ -159,7 +159,7 @@
     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()) {

Modified: cfe/trunk/test/SemaObjC/arc-repeated-weak.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc-repeated-weak.mm?rev=165723&r1=165722&r2=165723&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/arc-repeated-weak.mm (original)
+++ cfe/trunk/test/SemaObjC/arc-repeated-weak.mm Thu Oct 11 12:02:00 2012
@@ -181,6 +181,18 @@
   }
 }
 
+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





More information about the cfe-commits mailing list