Skip to content

Commit 23bb550

Browse files
author
Krzysztof Parzyszek
committed
DWARFVerifier: Change vector of IntervalMap to vector of unique_ptrs
This is a workaround for compilation issue on FreeBSD. See comments in https://reviews.llvm.org/rG0d8cb8b399ad for more information. This fixes #55414. Differential Revision: https://reviews.llvm.org/D125611
1 parent 0ee1c03 commit 23bb550

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,9 @@ unsigned DWARFVerifier::verifyIndex(StringRef Name,
406406
DataExtractor D(IndexStr, DCtx.isLittleEndian(), 0);
407407
if (!Index.parse(D))
408408
return 1;
409-
IntervalMap<uint32_t, uint64_t>::Allocator Alloc;
410-
std::vector<IntervalMap<uint32_t, uint64_t>> Sections(
411-
Index.getColumnKinds().size(), IntervalMap<uint32_t, uint64_t>(Alloc));
409+
using MapType = IntervalMap<uint32_t, uint64_t>;
410+
MapType::Allocator Alloc;
411+
std::vector<std::unique_ptr<MapType>> Sections(Index.getColumnKinds().size());
412412
for (const DWARFUnitIndex::Entry &E : Index.getRows()) {
413413
uint64_t Sig = E.getSignature();
414414
if (!E.getContributions())
@@ -421,7 +421,9 @@ unsigned DWARFVerifier::verifyIndex(StringRef Name,
421421
int Col = E.index();
422422
if (SC.Length == 0)
423423
continue;
424-
auto &M = Sections[Col];
424+
if (!Sections[Col])
425+
Sections[Col] = std::make_unique<MapType>(Alloc);
426+
auto &M = *Sections[Col];
425427
auto I = M.find(SC.Offset);
426428
if (I != M.end() && I.start() < (SC.Offset + SC.Length)) {
427429
error() << llvm::formatv(

0 commit comments

Comments
 (0)