Use DeclStmt::getSolitaryDecl() instead of DeclStmt::getDecl() when processing the Decl of an Objective-C foreach statement.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57209 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp
index c389adb..9849fb6 100644
--- a/lib/CodeGen/CGObjC.cpp
+++ b/lib/CodeGen/CGObjC.cpp
@@ -342,9 +342,9 @@
 
   if (const DeclStmt *SD = dyn_cast<DeclStmt>(S.getElement())) {
     EmitStmt(SD);
-    
-    ElementTy = cast<ValueDecl>(SD->getDecl())->getType();
-    DeclAddress = LocalDeclMap[SD->getDecl()];    
+    const ScopedDecl* D = SD->getSolitaryDecl();
+    ElementTy = cast<ValueDecl>(D)->getType();
+    DeclAddress = LocalDeclMap[D];    
   } else {
     ElementTy = cast<Expr>(S.getElement())->getType();
     DeclAddress = 0;