[pkg-d-commits] [ldc] 29/211: CodeView: fix display of dynamic array arguments (#1761)
Matthias Klumpp
mak at moszumanska.debian.org
Sun Apr 23 22:36:06 UTC 2017
This is an automated email from the git hooks/post-receive script.
mak pushed a commit to annotated tag v1.1.0
in repository ldc.
commit 2dec29b82507115ec4380cecbad118703646a897
Author: Rainer Schuetze <r.sagitario at gmx.de>
Date: Sat Sep 24 21:06:58 2016 +0200
CodeView: fix display of dynamic array arguments (#1761)
---
gen/dibuilder.cpp | 6 +++---
gen/dibuilder.h | 6 +++---
gen/functions.cpp | 7 +++++--
tests/debuginfo/codeview.d | 7 ++++---
tests/debuginfo/nested.d | 1 -
tests/debuginfo/nested_llvm306.d | 2 +-
tests/debuginfo/nested_llvm307.d | 2 +-
7 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/gen/dibuilder.cpp b/gen/dibuilder.cpp
index 80cce33..b7389c4 100644
--- a/gen/dibuilder.cpp
+++ b/gen/dibuilder.cpp
@@ -969,7 +969,7 @@ void ldc::DIBuilder::EmitValue(llvm::Value *val, VarDeclaration *vd) {
void ldc::DIBuilder::EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd,
Type *type, bool isThisPtr,
- bool fromNested,
+ bool rewrittenToLocal,
#if LDC_LLVM_VER >= 306
llvm::ArrayRef<int64_t> addr
#else
@@ -1001,7 +1001,7 @@ void ldc::DIBuilder::EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd,
#if LDC_LLVM_VER < 308
unsigned tag;
- if (!fromNested && vd->isParameter()) {
+ if (!rewrittenToLocal && vd->isParameter()) {
tag = llvm::dwarf::DW_TAG_arg_variable;
} else {
tag = llvm::dwarf::DW_TAG_auto_variable;
@@ -1044,7 +1044,7 @@ void ldc::DIBuilder::EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd,
Flags // flags
);
#else
- if (!fromNested && vd->isParameter()) {
+ if (!rewrittenToLocal && vd->isParameter()) {
FuncDeclaration *fd = vd->parent->isFuncDeclaration();
assert(fd);
size_t argNo = 0;
diff --git a/gen/dibuilder.h b/gen/dibuilder.h
index cfad426..5f88f11 100644
--- a/gen/dibuilder.h
+++ b/gen/dibuilder.h
@@ -138,13 +138,13 @@ public:
/// variable vd.
/// \param ll LLVM Value of the variable.
/// \param vd Variable declaration to emit debug info for.
- /// \param type Type of parameter if diferent from vd->type
+ /// \param type Type of parameter if different from vd->type
/// \param isThisPtr Parameter is hidden this pointer
- /// \param fromNested Is a closure variable accessed through nest_arg
+ /// \param bool rewrittenToLocal Parameter is copied to local stack frame/closure
/// \param addr An array of complex address operations.
void
EmitLocalVariable(llvm::Value *ll, VarDeclaration *vd, Type *type = nullptr,
- bool isThisPtr = false, bool fromNested = false,
+ bool isThisPtr = false, bool rewrittenToLocal = false,
#if LDC_LLVM_VER >= 306
llvm::ArrayRef<int64_t> addr = llvm::ArrayRef<int64_t>()
#else
diff --git a/gen/functions.cpp b/gen/functions.cpp
index 358631f..7d42df5 100644
--- a/gen/functions.cpp
+++ b/gen/functions.cpp
@@ -705,6 +705,7 @@ void defineParameters(IrFuncTy &irFty, VarDeclarations ¶meters) {
// E.g., for a lazy parameter of type T, vd->type is T (with lazy storage
// class) while irparam->arg->type is the delegate type.
Type *const paramType = (irparam ? irparam->arg->type : vd->type);
+ bool rewrittenToLocal = false;
if (!irparam) {
// This is a parameter that is not passed on the LLVM level.
@@ -721,8 +722,10 @@ void defineParameters(IrFuncTy &irFty, VarDeclarations ¶meters) {
assert(irparam->value->getType() == DtoPtrToType(paramType));
} else {
// Let the ABI transform the parameter back to an lvalue.
- irparam->value =
+ auto Lvalue =
irFty.getParamLVal(paramType, llArgIdx, irparam->value);
+ rewrittenToLocal = Lvalue != irparam->value;
+ irparam->value = Lvalue;
}
irparam->value->setName(vd->ident->toChars());
@@ -731,7 +734,7 @@ void defineParameters(IrFuncTy &irFty, VarDeclarations ¶meters) {
}
if (global.params.symdebug)
- gIR->DBuilder.EmitLocalVariable(irparam->value, vd, paramType);
+ gIR->DBuilder.EmitLocalVariable(irparam->value, vd, paramType, false, rewrittenToLocal);
}
}
diff --git a/tests/debuginfo/codeview.d b/tests/debuginfo/codeview.d
index 9eb6a9b..77ab5e8 100644
--- a/tests/debuginfo/codeview.d
+++ b/tests/debuginfo/codeview.d
@@ -42,9 +42,7 @@ int main(string[] args)
// CHECK: +[[OFF]] ptr {{ *}}: [[PTR]]
// CDB: dv /t
-// struct arguments passed by reference on x64
-// x64: string[] * args
-// x86: string[] args
+// CHECK: string[] args
// CHECK: string[] nargs
// CHECK: string ns
// CHECK: string ws
@@ -53,6 +51,9 @@ int main(string[] args)
// CDB: ?? ns
// CHECK: +0x000 length {{ *}}: 1
// CHECK: +[[OFF]] ptr {{ *}}: 0x{{[0-9a-f`]* *}} "a"
+// CDB: ?? args.ptr[0]
+// CHECK: +0x000 length
+// CHECK: +[[OFF]] ptr {{ *}}: 0x{{[0-9a-f`]* *".*exe.*"}}
}
// CDB: q
diff --git a/tests/debuginfo/nested.d b/tests/debuginfo/nested.d
index ae02c28..92cf171 100644
--- a/tests/debuginfo/nested.d
+++ b/tests/debuginfo/nested.d
@@ -22,7 +22,6 @@ void encloser(int arg0, int arg1)
// CHECK-LABEL: !DISubprogram(name:{{.*}}"{{.*}}encloser.nested"
// CHECK: !DILocalVariable{{.*}}nes_i
-// CHECK-SAME: arg: 2
// CHECK: !DILocalVariable{{.*}}arg1
// CHECK-NOT: arg:
// CHECK-SAME: ){{$}}
diff --git a/tests/debuginfo/nested_llvm306.d b/tests/debuginfo/nested_llvm306.d
index f98ff9e..2effe0e 100644
--- a/tests/debuginfo/nested_llvm306.d
+++ b/tests/debuginfo/nested_llvm306.d
@@ -18,5 +18,5 @@ void encloser(int arg0, int arg1)
// CHECK: @_D{{.*}}8encloserFiiZv{{.*}}DW_TAG_subprogram
// CHECK: @_D{{.*}}8encloserFiiZ6nestedMFiZv{{.*}}DW_TAG_subprogram
-// CHECK: nes_i{{.*}}DW_TAG_arg_variable
+// CHECK: nes_i{{.*}}DW_TAG_auto_variable
// CHECK: arg1{{.*}}DW_TAG_auto_variable
diff --git a/tests/debuginfo/nested_llvm307.d b/tests/debuginfo/nested_llvm307.d
index 5c39898..e35c2e1 100644
--- a/tests/debuginfo/nested_llvm307.d
+++ b/tests/debuginfo/nested_llvm307.d
@@ -19,5 +19,5 @@ void encloser(int arg0, int arg1)
// CHECK: !DISubprogram(name:{{.*}}"{{.*}}.encloser"
// CHECK-SAME: function: void {{.*}} @_D{{.*}}8encloserFiiZv
// CHECK-LABEL: !DISubprogram(name:{{.*}}"{{.*}}.encloser.nested"
-// CHECK: !DILocalVariable{{.*}}DW_TAG_arg_variable{{.*}}nes_i
+// CHECK: !DILocalVariable{{.*}}DW_TAG_auto_variable{{.*}}nes_i
// CHECK: !DILocalVariable{{.*}}DW_TAG_auto_variable{{.*}}arg1
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-d/ldc.git
More information about the pkg-d-commits
mailing list