diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp @@ -406,9 +406,9 @@ DataExtractor D(IndexStr, DCtx.isLittleEndian(), 0); if (!Index.parse(D)) return 1; - IntervalMap::Allocator Alloc; - std::vector> Sections( - Index.getColumnKinds().size(), IntervalMap(Alloc)); + using MapType = IntervalMap; + MapType::Allocator Alloc; + std::vector> Sections(Index.getColumnKinds().size()); for (const DWARFUnitIndex::Entry &E : Index.getRows()) { uint64_t Sig = E.getSignature(); if (!E.getContributions()) @@ -421,7 +421,9 @@ int Col = E.index(); if (SC.Length == 0) continue; - auto &M = Sections[Col]; + if (!Sections[Col]) + Sections[Col] = std::make_unique(Alloc); + auto &M = *Sections[Col]; auto I = M.find(SC.Offset); if (I != M.end() && I.start() < (SC.Offset + SC.Length)) { error() << llvm::formatv(