mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-06 10:57:35 +03:00
Fix debuginfo generation for the local variable frame for a function with nested functions.
Declare debuginfo directly on the GEP instead of on the frame alloca+offset, . An explicit DW_OP_deref is necessary (tested in LLDB). Resolves an ICE introduced by PR #1598.
This commit is contained in:
parent
6b647bfb0a
commit
197b63a04f
4 changed files with 7 additions and 5 deletions
|
@ -507,8 +507,10 @@ void DtoCreateNestedContext(FuncDeclaration *fd) {
|
||||||
#else
|
#else
|
||||||
LLSmallVector<LLValue *, 2> addr;
|
LLSmallVector<LLValue *, 2> addr;
|
||||||
#endif
|
#endif
|
||||||
gIR->DBuilder.OpOffset(addr, frameType, irLocal->nestedIndex);
|
// Because we are passing a GEP instead of an alloca to
|
||||||
gIR->DBuilder.EmitLocalVariable(frame, vd, nullptr, false, false, addr);
|
// llvm.dbg.declare, we have to make the address dereference explicit.
|
||||||
|
gIR->DBuilder.OpDeref(addr);
|
||||||
|
gIR->DBuilder.EmitLocalVariable(gep, vd, nullptr, false, false, addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// CHECK-SAME: !dbg
|
// CHECK-SAME: !dbg
|
||||||
void encloser(int arg0, int arg1)
|
void encloser(int arg0, int arg1)
|
||||||
{
|
{
|
||||||
// CHECK: @llvm.dbg.declare{{.*}}%.frame{{.*}}enc_n
|
// CHECK: @llvm.dbg.declare{{.*}}%enc_n{{.*}}enc_n
|
||||||
int enc_n;
|
int enc_n;
|
||||||
|
|
||||||
// CHECK-LABEL: define {{.*}}encloser{{.*}}nested
|
// CHECK-LABEL: define {{.*}}encloser{{.*}}nested
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
// CHECK-LABEL: define {{.*}} @_D{{.*}}8encloserFiiZv
|
// CHECK-LABEL: define {{.*}} @_D{{.*}}8encloserFiiZv
|
||||||
void encloser(int arg0, int arg1)
|
void encloser(int arg0, int arg1)
|
||||||
{
|
{
|
||||||
// CHECK: @llvm.dbg.declare{{.*}}%.frame{{.*}}enc_n
|
// CHECK: @llvm.dbg.declare{{.*}}%enc_n{{.*}}enc_n
|
||||||
int enc_n;
|
int enc_n;
|
||||||
|
|
||||||
// CHECK-LABEL: define {{.*}} @_D{{.*}}encloser{{.*}}nested
|
// CHECK-LABEL: define {{.*}} @_D{{.*}}encloser{{.*}}nested
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
// CHECK-LABEL: define {{.*}} @_D{{.*}}8encloser
|
// CHECK-LABEL: define {{.*}} @_D{{.*}}8encloser
|
||||||
void encloser(int arg0, int arg1)
|
void encloser(int arg0, int arg1)
|
||||||
{
|
{
|
||||||
// CHECK: @llvm.dbg.declare{{.*}}%.frame{{.*}}enc_n
|
// CHECK: @llvm.dbg.declare{{.*}}%enc_n{{.*}}enc_n
|
||||||
int enc_n;
|
int enc_n;
|
||||||
|
|
||||||
// CHECK-LABEL: define {{.*}} @_D{{.*}}8encloser{{.*}}nested
|
// CHECK-LABEL: define {{.*}} @_D{{.*}}8encloser{{.*}}nested
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue