[Lldb-commits] [PATCH] D109339: Fix compilation error with older libstdc++

Vadim Chugunov via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 6 16:55:04 PDT 2021


vadimcn created this revision.
vadimcn added a reviewer: jingham.
vadimcn added a project: LLDB.
Herald added a subscriber: JDevlieghere.
vadimcn requested review of this revision.
Herald added a subscriber: lldb-commits.

Until GCC 6, std::unordered_map could not emplace non-copyable values, which results in this error: "error: call to implicitly-deleted copy constructor of 'lldb_private::ThreadPlanStack'" (due to ThreadPlanStack::m_stack_mutex not being copyable).   Using std::piecewise_construct works around this problem.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109339

Files:
  lldb/include/lldb/Target/ThreadPlanStack.h


Index: lldb/include/lldb/Target/ThreadPlanStack.h
===================================================================
--- lldb/include/lldb/Target/ThreadPlanStack.h
+++ lldb/include/lldb/Target/ThreadPlanStack.h
@@ -124,7 +124,9 @@
 
   void AddThread(Thread &thread) {
     lldb::tid_t tid = thread.GetID();
-    m_plans_list.emplace(tid, thread);
+    m_plans_list.emplace(std::piecewise_construct,
+                         std::forward_as_tuple(tid),
+                         std::forward_as_tuple(thread));
   }
 
   bool RemoveTID(lldb::tid_t tid) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109339.370971.patch
Type: text/x-patch
Size: 557 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210906/30307da4/attachment.bin>


More information about the lldb-commits mailing list