[cfe-commits] r164418 - /cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Eric Christopher echristo at apple.com
Fri Sep 21 15:18:42 PDT 2012


Author: echristo
Date: Fri Sep 21 17:18:42 2012
New Revision: 164418

URL: http://llvm.org/viewvc/llvm-project?rev=164418&view=rev
Log:
Mark the passed in "self" for a block as an object pointer so
that the backend can mark it as the representative pointer for
the block.

rdar://12001329

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=164418&r1=164417&r2=164418&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Sep 21 17:18:42 2012
@@ -2418,9 +2418,10 @@
   EmitDeclare(VD, llvm::dwarf::DW_TAG_auto_variable, Storage, 0, Builder);
 }
 
-void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(
-  const VarDecl *VD, llvm::Value *Storage, CGBuilderTy &Builder,
-  const CGBlockInfo &blockInfo) {
+void CGDebugInfo::EmitDeclareOfBlockDeclRefVariable(const VarDecl *VD,
+                                                    llvm::Value *Storage,
+                                                    CGBuilderTy &Builder,
+                                                 const CGBlockInfo &blockInfo) {
   assert(CGM.getCodeGenOpts().DebugInfo >= CodeGenOptions::LimitedDebugInfo);
   assert(!LexicalBlockStack.empty() && "Region stack mismatch, stack empty!");
   
@@ -2437,6 +2438,11 @@
   else 
     Ty = getOrCreateType(VD->getType(), Unit);
 
+  // Self is passed along as an implicit non-arg variable in a
+  // block. Mark it as the object pointer.
+  if (isa<ImplicitParamDecl>(VD) && VD->getName() == "self")
+    Ty = DBuilder.createObjectPointerType(Ty);
+
   // Get location information.
   unsigned Line = getLineNumber(VD->getLocation());
   unsigned Column = getColumnNumber(VD->getLocation());





More information about the cfe-commits mailing list