summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
diff options
context:
space:
mode:
authorDavid Stenberg <david.stenberg@ericsson.com>2019-04-09 10:08:26 +0000
committerDavid Stenberg <david.stenberg@ericsson.com>2019-04-09 10:08:26 +0000
commit2028ae975c6aa65df3d89c10c95bf9b7baa5e0ab (patch)
tree179bf5622bdf3dfcc03db4a5be9e1706fccb14c2 /llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
parenta30ba452c6725068c3f73175ee9938985f088d56 (diff)
downloadbcm5719-llvm-2028ae975c6aa65df3d89c10c95bf9b7baa5e0ab.tar.gz
bcm5719-llvm-2028ae975c6aa65df3d89c10c95bf9b7baa5e0ab.zip
[DebugInfo] Pass all values in DebugLocEntry's constructor, NFC
Summary: With MergeValues() removed, amend DebugLocEntry's constructor so that it takes multiple values rather than a single, and keep non-fragment values in OpenRanges, as this allows some cleanup of the code in buildLocationList(). Reviewers: aprantl, dblaikie, loladiro Reviewed By: aprantl Subscribers: hiraditya, llvm-commits Tags: #debug-info, #llvm Differential Revision: https://reviews.llvm.org/D59303 llvm-svn: 357988
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp23
1 files changed, 5 insertions, 18 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 2b4ba37df1e..224365e6559 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1134,7 +1134,7 @@ DwarfDebug::buildLocationList(SmallVectorImpl<DebugLocEntry> &DebugLoc,
continue;
}
- // If this fragment overlaps with any open ranges, truncate them.
+ // If this debug value overlaps with any open ranges, truncate them.
const DIExpression *DIExpr = Begin->getDebugExpression();
auto Last = remove_if(OpenRanges, [&](DebugLocEntry::Value R) {
return DIExpr->fragmentsOverlap(R.getExpression());
@@ -1156,30 +1156,15 @@ DwarfDebug::buildLocationList(SmallVectorImpl<DebugLocEntry> &DebugLoc,
LLVM_DEBUG(dbgs() << "DotDebugLoc: " << *Begin << "\n");
auto Value = getDebugLocValue(Begin);
+ OpenRanges.push_back(Value);
// Omit entries with empty ranges as they do not have any effect in DWARF.
if (StartLabel == EndLabel) {
- // If this is a fragment, we must still add the value to the list of
- // open ranges, since it may describe non-overlapping parts of the
- // variable.
- if (DIExpr->isFragment())
- OpenRanges.push_back(Value);
LLVM_DEBUG(dbgs() << "Omitting location list entry with empty range.\n");
continue;
}
- DebugLocEntry Loc(StartLabel, EndLabel, Value);
-
- if (DIExpr->isFragment()) {
- // Add this value to the list of open ranges.
- OpenRanges.push_back(Value);
- }
-
- // Add all values from still valid non-overlapping fragments.
- if (OpenRanges.size())
- Loc.addValues(OpenRanges);
-
- DebugLoc.push_back(std::move(Loc));
+ DebugLoc.emplace_back(StartLabel, EndLabel, OpenRanges);
// Attempt to coalesce the ranges of two otherwise identical
// DebugLocEntries.
@@ -1962,6 +1947,8 @@ void DebugLocEntry::finalize(const AsmPrinter &AP,
DebugLocStream::ListBuilder &List,
const DIBasicType *BT,
DwarfCompileUnit &TheCU) {
+ assert(!Values.empty() &&
+ "location list entries without values are redundant");
assert(Begin != End && "unexpected location list entry with empty range");
DebugLocStream::EntryBuilder Entry(List, Begin, End);
BufferByteStreamer Streamer = Entry.getStreamer();
OpenPOWER on IntegriCloud