[cfe-commits] r123802 - in /cfe/trunk: lib/CodeGen/CGObjC.cpp test/CodeGenObjC/debug-info-foreach.m

Devang Patel dpatel at apple.com
Tue Jan 18 17:36:36 PST 2011


Author: dpatel
Date: Tue Jan 18 19:36:36 2011
New Revision: 123802

URL: http://llvm.org/viewvc/llvm-project?rev=123802&view=rev
Log:
Emit DW_TAG_lexical_scope to surround foreach.

Added:
    cfe/trunk/test/CodeGenObjC/debug-info-foreach.m
Modified:
    cfe/trunk/lib/CodeGen/CGObjC.cpp

Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=123802&r1=123801&r2=123802&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Tue Jan 18 19:36:36 2011
@@ -11,6 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "CGDebugInfo.h"
 #include "CGObjCRuntime.h"
 #include "CodeGenFunction.h"
 #include "CodeGenModule.h"
@@ -612,6 +613,12 @@
     return;
   }
 
+  CGDebugInfo *DI = getDebugInfo();
+  if (DI) {
+    DI->setLocation(S.getSourceRange().getBegin());
+    DI->EmitRegionStart(Builder);
+  }
+
   JumpDest LoopEnd = getJumpDestInCurrentScope("forcoll.end");
   JumpDest AfterBody = getJumpDestInCurrentScope("forcoll.next");
 
@@ -842,6 +849,11 @@
     EmitStoreThroughLValue(RValue::get(null), elementLValue, elementType);
   }
 
+  if (DI) {
+    DI->setLocation(S.getSourceRange().getEnd());
+    DI->EmitRegionEnd(Builder);
+  }
+
   EmitBlock(LoopEnd.getBlock());
 }
 

Added: cfe/trunk/test/CodeGenObjC/debug-info-foreach.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/debug-info-foreach.m?rev=123802&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjC/debug-info-foreach.m (added)
+++ cfe/trunk/test/CodeGenObjC/debug-info-foreach.m Tue Jan 18 19:36:36 2011
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-default-synthesize-properties -emit-llvm -g %s -o %t 
+// RUN: grep DW_TAG_lexical_block %t | count 5
+// rdar://8757124
+
+ at class NSArray;
+
+void f(NSArray *a) {
+  id keys;
+  for (id thisKey in keys) {
+  }
+  for (id thisKey in keys) {
+  }
+}





More information about the cfe-commits mailing list