Revert r300287.
llvm-svn: 300290
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp
index 50252d5..929bda9 100644
--- a/clang/lib/CodeGen/CGObjC.cpp
+++ b/clang/lib/CodeGen/CGObjC.cpp
@@ -1469,6 +1469,11 @@
if (DI)
DI->EmitLexicalBlockStart(Builder, S.getSourceRange().getBegin());
+ // The local variable comes into scope immediately.
+ AutoVarEmission variable = AutoVarEmission::invalid();
+ if (const DeclStmt *SD = dyn_cast<DeclStmt>(S.getElement()))
+ variable = EmitAutoVarAlloca(*cast<VarDecl>(SD->getSingleDecl()));
+
JumpDest LoopEnd = getJumpDestInCurrentScope("forcoll.end");
// Fast enumeration state.
@@ -1620,10 +1625,8 @@
bool elementIsVariable;
LValue elementLValue;
QualType elementType;
- AutoVarEmission variable = AutoVarEmission::invalid();
if (const DeclStmt *SD = dyn_cast<DeclStmt>(S.getElement())) {
// Initialize the variable, in case it's a __block variable or something.
- variable = EmitAutoVarAlloca(*cast<VarDecl>(SD->getSingleDecl()));
EmitAutoVarInit(variable);
const VarDecl* D = cast<VarDecl>(SD->getSingleDecl());