summaryrefslogtreecommitdiff
path: root/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/DebugInfo/DWARF/DWARFDebugAranges.cpp')
-rw-r--r--lib/DebugInfo/DWARF/DWARFDebugAranges.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp b/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
index 19bfcaed2021..e8c5dec821b4 100644
--- a/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
+++ b/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
@@ -12,6 +12,7 @@
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h"
#include "llvm/Support/DataExtractor.h"
+#include "llvm/Support/WithColor.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
@@ -53,10 +54,12 @@ void DWARFDebugAranges::generate(DWARFContext *CTX) {
for (const auto &CU : CTX->compile_units()) {
uint32_t CUOffset = CU->getOffset();
if (ParsedCUOffsets.insert(CUOffset).second) {
- DWARFAddressRangesVector CURanges;
- CU->collectAddressRanges(CURanges);
- for (const auto &R : CURanges)
- appendRange(CUOffset, R.LowPC, R.HighPC);
+ Expected<DWARFAddressRangesVector> CURanges = CU->collectAddressRanges();
+ if (!CURanges)
+ WithColor::error() << toString(CURanges.takeError()) << '\n';
+ else
+ for (const auto &R : *CURanges)
+ appendRange(CUOffset, R.LowPC, R.HighPC);
}
}
@@ -80,7 +83,7 @@ void DWARFDebugAranges::appendRange(uint32_t CUOffset, uint64_t LowPC,
void DWARFDebugAranges::construct() {
std::multiset<uint32_t> ValidCUs; // Maintain the set of CUs describing
// a current address range.
- llvm::sort(Endpoints.begin(), Endpoints.end());
+ llvm::sort(Endpoints);
uint64_t PrevAddress = -1ULL;
for (const auto &E : Endpoints) {
if (PrevAddress < E.Address && !ValidCUs.empty()) {