summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/DebugInfoMetadata.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2017-12-08 21:58:18 +0000
committerAdrian Prantl <aprantl@apple.com>2017-12-08 21:58:18 +0000
commitd13170174c656a6dbf2f4b30b638645d6e0727fd (patch)
tree48e17ffc3aa57c3277dd85aa052f4075a22f6cb5 /llvm/lib/IR/DebugInfoMetadata.cpp
parent195dfd10a679ed4860200e935d1ca292d09bb64b (diff)
downloadbcm5719-llvm-d13170174c656a6dbf2f4b30b638645d6e0727fd.tar.gz
bcm5719-llvm-d13170174c656a6dbf2f4b30b638645d6e0727fd.zip
Generalize llvm::replaceDbgDeclare and actually support the use-case that
is mentioned in the documentation (inserting a deref before the plus_uconst). llvm-svn: 320203
Diffstat (limited to 'llvm/lib/IR/DebugInfoMetadata.cpp')
-rw-r--r--llvm/lib/IR/DebugInfoMetadata.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
index 940c4d1f366..75ddd47b259 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -750,12 +750,17 @@ bool DIExpression::extractIfOffset(int64_t &Offset) const {
return false;
}
-DIExpression *DIExpression::prepend(const DIExpression *Expr, bool Deref,
- int64_t Offset, bool StackValue) {
+DIExpression *DIExpression::prepend(const DIExpression *Expr, bool DerefBefore,
+ int64_t Offset, bool DerefAfter,
+ bool StackValue) {
SmallVector<uint64_t, 8> Ops;
+ if (DerefBefore)
+ Ops.push_back(dwarf::DW_OP_deref);
+
appendOffset(Ops, Offset);
- if (Deref)
+ if (DerefAfter)
Ops.push_back(dwarf::DW_OP_deref);
+
if (Expr)
for (auto Op : Expr->expr_ops()) {
// A DW_OP_stack_value comes at the end, but before a DW_OP_LLVM_fragment.
OpenPOWER on IntegriCloud