diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-11-14 18:21:25 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-11-14 18:21:25 +0000 |
commit | c2813f77bad184470f81f85f7df88b87eb1bb915 (patch) | |
tree | 98973b8af2d77cd91d73fd44cfafb421ae7bebaf /lib/Analysis | |
parent | b4609806e9232593ece09ce08b630836e825865c (diff) |
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
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/UninitializedValues.cpp | 13 |
1 files 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<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; } |