[PATCH] D154924: [bolt] Fix MSVC builds

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 11 09:40:02 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGcaf5b6a21217: [bolt] Fix MSVC builds (authored by smeenai).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154924

Files:
  bolt/include/bolt/Core/DIEBuilder.h


Index: bolt/include/bolt/Core/DIEBuilder.h
===================================================================
--- bolt/include/bolt/Core/DIEBuilder.h
+++ bolt/include/bolt/Core/DIEBuilder.h
@@ -58,6 +58,20 @@
     // A map of DIE offsets in original DWARF section to DIE ID.
     // Whih is used to access DieInfoVector.
     std::unordered_map<uint64_t, uint32_t> DIEIDMap;
+
+    // Some STL implementations don't have a noexcept move constructor for
+    // unordered_map (e.g. https://github.com/microsoft/STL/issues/165 explains
+    // why the Microsoft STL doesn't). In that case, the default move
+    // constructor generated for DWARFUnitInfo isn't noexcept either, and thus
+    // resizing a vector of DWARFUnitInfo will copy elements instead of moving
+    // them (https://en.cppreference.com/w/cpp/utility/move_if_noexcept).
+    // DWARFUnitInfo isn't copyable though, since the DieInfoVector member is a
+    // vector of unique_ptrs and unique_ptr isn't copyable, so using a vector of
+    // DWARFUnitInfo causes build errors. Explicitly marking DWARFUnitInfo as
+    // non-copyable forces vector resizes to move instead and fixes the issue.
+    DWARFUnitInfo() = default;
+    DWARFUnitInfo(const DWARFUnitInfo &) = delete;
+    DWARFUnitInfo(DWARFUnitInfo &&) = default;
   };
 
   enum class ProcessingType { DWARF4TUs, DWARF5TUs, CUs };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154924.539159.patch
Type: text/x-patch
Size: 1363 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230711/42c0c574/attachment.bin>


More information about the llvm-commits mailing list