r241511 - Debug info: Don't emit a bogus location for the global block pointer type
Adrian Prantl
aprantl at apple.com
Mon Jul 6 14:31:36 PDT 2015
Author: adrian
Date: Mon Jul 6 16:31:35 2015
New Revision: 241511
URL: http://llvm.org/viewvc/llvm-project?rev=241511&view=rev
Log:
Debug info: Don't emit a bogus location for the global block pointer type
(__block_literal_generic).
The arbitrary nature of the location confuses lldb and prevents type
uniquing.
rdar://problem/21602473
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/test/CodeGen/debug-info-block.c
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=241511&r1=241510&r2=241511&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Jul 6 16:31:35 2015
@@ -723,10 +723,10 @@ llvm::DIType *CGDebugInfo::CreateType(co
EltTys.clear();
unsigned Flags = llvm::DINode::FlagAppleBlock;
- unsigned LineNo = getLineNumber(CurLoc);
+ unsigned LineNo = 0;
auto *EltTy =
- DBuilder.createStructType(Unit, "__block_descriptor", Unit, LineNo,
+ DBuilder.createStructType(Unit, "__block_descriptor", nullptr, LineNo,
FieldOffset, 0, Flags, nullptr, Elements);
// Bit size, align and offset of the type.
@@ -746,7 +746,7 @@ llvm::DIType *CGDebugInfo::CreateType(co
FType = CGM.getContext().getPointerType(CGM.getContext().VoidTy);
FieldSize = CGM.getContext().getTypeSize(Ty);
FieldAlign = CGM.getContext().getTypeAlign(Ty);
- EltTys.push_back(DBuilder.createMemberType(Unit, "__descriptor", Unit, LineNo,
+ EltTys.push_back(DBuilder.createMemberType(Unit, "__descriptor", nullptr, LineNo,
FieldSize, FieldAlign, FieldOffset,
0, DescTy));
@@ -754,7 +754,7 @@ llvm::DIType *CGDebugInfo::CreateType(co
Elements = DBuilder.getOrCreateArray(EltTys);
EltTy =
- DBuilder.createStructType(Unit, "__block_literal_generic", Unit, LineNo,
+ DBuilder.createStructType(Unit, "__block_literal_generic", nullptr, LineNo,
FieldOffset, 0, Flags, nullptr, Elements);
BlockLiteralGeneric = DBuilder.createPointerType(EltTy, Size);
Modified: cfe/trunk/test/CodeGen/debug-info-block.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-block.c?rev=241511&r1=241510&r2=241511&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/debug-info-block.c (original)
+++ cfe/trunk/test/CodeGen/debug-info-block.c Mon Jul 6 16:31:35 2015
@@ -1,9 +1,11 @@
// RUN: %clang_cc1 -fblocks -g -emit-llvm -o - %s | FileCheck %s
// Verify that the desired debugging type is generated for a structure
-// member that is a pointer to a block.
+// member that is a pointer to a block.
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "__block_literal_generic"
+// CHECK-NOT: line
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "__block_descriptor"
+// CHECK-NOT: line
struct inStruct {
void (^genericBlockPtr)();
} is;
More information about the cfe-commits
mailing list