From c2813f77bad184470f81f85f7df88b87eb1bb915 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Fri, 14 Nov 2008 18:21:25 +0000 Subject: [PATCH] Flow-sensitive uninitialized values analysis: properly handle the 'element' expression of ObjCForCollectionStmt (can be anything). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59312 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/UninitializedValues.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/Analysis/UninitializedValues.cpp b/lib/Analysis/UninitializedValues.cpp index b673713bb3..490aef2467 100644 --- a/lib/Analysis/UninitializedValues.cpp +++ b/lib/Analysis/UninitializedValues.cpp @@ -194,9 +194,16 @@ TransferFuncs::BlockStmt_VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) { if (DeclStmt* DS = dyn_cast(Element)) VD = cast(DS->getSolitaryDecl()); - else - VD = cast(cast(Element)->getDecl()); - + else { + Expr* ElemExpr = cast(Element)->IgnoreParens(); + + // Initialize the value of the reference variable. + if (DeclRefExpr* DR = dyn_cast(ElemExpr)) + VD = cast(DR->getDecl()); + else + return Visit(ElemExpr); + } + V(VD,AD) = Initialized; return Initialized; } -- 2.40.0