summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/UninitializedValues.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-11-14 18:21:25 +0000
committerTed Kremenek <kremenek@apple.com>2008-11-14 18:21:25 +0000
commit8959a1a69a0b386499deed1bc4ef49cc94fdc979 (patch)
treef06c48ef76ab81cedb79112c04cd3083bf4858d7 /clang/lib/Analysis/UninitializedValues.cpp
parent80cd21dba617bfef80964fefc508252790beb7ae (diff)
downloadbcm5719-llvm-8959a1a69a0b386499deed1bc4ef49cc94fdc979.tar.gz
bcm5719-llvm-8959a1a69a0b386499deed1bc4ef49cc94fdc979.zip
Flow-sensitive uninitialized values analysis: properly handle the 'element' expression of ObjCForCollectionStmt (can be anything).
llvm-svn: 59312
Diffstat (limited to 'clang/lib/Analysis/UninitializedValues.cpp')
-rw-r--r--clang/lib/Analysis/UninitializedValues.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/Analysis/UninitializedValues.cpp b/clang/lib/Analysis/UninitializedValues.cpp
index b673713bb35..490aef2467b 100644
--- a/clang/lib/Analysis/UninitializedValues.cpp
+++ b/clang/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;
}
OpenPOWER on IntegriCloud