]> granicus.if.org Git - clang/commitdiff
Flow-sensitive uninitialized values analysis: properly handle the 'element' expressio...
authorTed Kremenek <kremenek@apple.com>
Fri, 14 Nov 2008 18:21:25 +0000 (18:21 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 14 Nov 2008 18:21:25 +0000 (18:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59312 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/UninitializedValues.cpp

index b673713bb35613aceeedca9c911ce78912f5580d..490aef2467bed22fd303ff54bb647746915110a6 100644 (file)
@@ -194,9 +194,16 @@ TransferFuncs::BlockStmt_VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) {
 
   if (DeclStmt* DS = dyn_cast<DeclStmt>(Element))
     VD = cast<VarDecl>(DS->getSolitaryDecl());
-  else
-    VD = cast<VarDecl>(cast<DeclRefExpr>(Element)->getDecl());
-
+  else {
+    Expr* ElemExpr = cast<Expr>(Element)->IgnoreParens();
+
+    // Initialize the value of the reference variable.
+    if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(ElemExpr))
+      VD = cast<VarDecl>(DR->getDecl());
+    else
+      return Visit(ElemExpr);
+  }
+      
   V(VD,AD) = Initialized;
   return Initialized;
 }