aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-01-22 21:16:09 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-01-22 21:16:09 +0000
commitdadbdfff07596fc3b48cc1e735181b9b8c893f67 (patch)
treeb27dffbc94bfeb477e1ff5e484d34d409ec05813 /lib/CodeGen/AsmPrinter/DwarfDebug.cpp
parentdfab1a98e00a97e03f1d59a3cbdc33ced8622a9c (diff)
downloadsrc-dadbdfff07596fc3b48cc1e735181b9b8c893f67.tar.gz
src-dadbdfff07596fc3b48cc1e735181b9b8c893f67.zip
Vendor import of llvm release_38 branch r258549:vendor/llvm/llvm-release_38-r258549
Notes
Notes: svn path=/vendor/llvm/dist/; revision=294602 svn path=/vendor/llvm/llvm-release_38-r258549/; revision=294603; tag=vendor/llvm/llvm-release_38-r258549
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index a4fb07eacb3b..ae62b6b19a42 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -805,6 +805,24 @@ static bool piecesOverlap(const DIExpression *P1, const DIExpression *P2) {
return (l1 < r2) && (l2 < r1);
}
+/// \brief If this and Next are describing different pieces of the same
+/// variable, merge them by appending Next's values to the current
+/// list of values.
+/// Return true if the merge was successful.
+bool DebugLocEntry::MergeValues(const DebugLocEntry &Next) {
+ if (Begin == Next.Begin) {
+ auto *Expr = cast_or_null<DIExpression>(Values[0].Expression);
+ auto *NextExpr = cast_or_null<DIExpression>(Next.Values[0].Expression);
+ if (Expr->isBitPiece() && NextExpr->isBitPiece() &&
+ !piecesOverlap(Expr, NextExpr)) {
+ addValues(Next.Values);
+ End = Next.End;
+ return true;
+ }
+ }
+ return false;
+}
+
/// Build the location list for all DBG_VALUEs in the function that
/// describe the same variable. If the ranges of several independent
/// pieces of the same variable overlap partially, split them up and