[PATCH] D125611: DWARFVerifier: Change vector of IntervalMap to vector of unique_ptrs

Krzysztof Parzyszek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 25 06:51:09 PDT 2022


kparzysz updated this revision to Diff 431968.
kparzysz added a comment.

Changed type of `M`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125611/new/

https://reviews.llvm.org/D125611

Files:
  llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp


Index: llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -406,9 +406,9 @@
   DataExtractor D(IndexStr, DCtx.isLittleEndian(), 0);
   if (!Index.parse(D))
     return 1;
-  IntervalMap<uint32_t, uint64_t>::Allocator Alloc;
-  std::vector<IntervalMap<uint32_t, uint64_t>> Sections(
-      Index.getColumnKinds().size(), IntervalMap<uint32_t, uint64_t>(Alloc));
+  using MapType = IntervalMap<uint32_t, uint64_t>;
+  MapType::Allocator Alloc;
+  std::vector<std::unique_ptr<MapType>> 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<MapType>(Alloc);
+      auto &M = *Sections[Col];
       auto I = M.find(SC.Offset);
       if (I != M.end() && I.start() < (SC.Offset + SC.Length)) {
         error() << llvm::formatv(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125611.431968.patch
Type: text/x-patch
Size: 1191 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220525/ec7a0f17/attachment.bin>


More information about the llvm-commits mailing list