]> granicus.if.org Git - clang/commitdiff
Put local variables in appropriate debug info scope.
authorDevang Patel <dpatel@apple.com>
Mon, 13 Jun 2011 23:15:32 +0000 (23:15 +0000)
committerDevang Patel <dpatel@apple.com>
Mon, 13 Jun 2011 23:15:32 +0000 (23:15 +0000)
This fixes radar 8757124.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132949 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGObjC.cpp

index fa42cd1f36ab9a367491310ab757e84ae0a2946d..cdb15bfd83ed6feb242fcf809535e46890a920dd 100644 (file)
@@ -808,17 +808,17 @@ void CodeGenFunction::EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S){
     return;
   }
 
-  // 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()));
-
   CGDebugInfo *DI = getDebugInfo();
   if (DI) {
     DI->setLocation(S.getSourceRange().getBegin());
     DI->EmitRegionStart(Builder);
   }
 
+  // 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");
   JumpDest AfterBody = getJumpDestInCurrentScope("forcoll.next");