Skip to content

Commit

Permalink
[DwarfDebug] Move MergeValues to .cpp, NFC
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257977 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Keno committed Jan 16, 2016
1 parent 0caa8a3 commit 243be96
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
13 changes: 1 addition & 12 deletions lib/CodeGen/AsmPrinter/DebugLocEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,7 @@ class DebugLocEntry {
/// variable, merge them by appending Next's values to the current
/// list of values.
/// Return true if the merge was successful.
bool 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()) {
addValues(Next.Values);
End = Next.End;
return true;
}
}
return false;
}
bool MergeValues(const DebugLocEntry &Next);

/// \brief Attempt to merge this DebugLocEntry with Next and return
/// true if the merge was successful. Entries can be merged if they
Expand Down
17 changes: 17 additions & 0 deletions lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,23 @@ 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()) {
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
Expand Down

0 comments on commit 243be96

Please sign in to comment.