[llvm] 23bb550 - DWARFVerifier: Change vector of IntervalMap to vector of unique_ptrs

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Wed May 25 11:01:10 PDT 2022


Author: Krzysztof Parzyszek
Date: 2022-05-25T10:59:46-07:00
New Revision: 23bb550eeba48651964ffeb0c8a061ac99b91034

URL: https://github.com/llvm/llvm-project/commit/23bb550eeba48651964ffeb0c8a061ac99b91034
DIFF: https://github.com/llvm/llvm-project/commit/23bb550eeba48651964ffeb0c8a061ac99b91034.diff

LOG: 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 https://github.com/llvm/llvm-project/issues/55414.

Differential Revision: https://reviews.llvm.org/D125611

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
index 1544714053728..c704f8f583af8 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -406,9 +406,9 @@ unsigned DWARFVerifier::verifyIndex(StringRef Name,
   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 @@ unsigned DWARFVerifier::verifyIndex(StringRef Name,
       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(


        


More information about the llvm-commits mailing list