[Lldb-commits] [lldb] 34fe58e - [lldb] Add a deduction guides for scoped_lock in OptionValue.cpp & ThreadList.cpp (NFC)

Jie Fu via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 4 16:56:46 PDT 2023


Author: Jie Fu
Date: 2023-08-05T07:56:38+08:00
New Revision: 34fe58e0bc76eff973c9dd7daeddf13c38d184d9

URL: https://github.com/llvm/llvm-project/commit/34fe58e0bc76eff973c9dd7daeddf13c38d184d9
DIFF: https://github.com/llvm/llvm-project/commit/34fe58e0bc76eff973c9dd7daeddf13c38d184d9.diff

LOG: [lldb] Add a deduction guides for scoped_lock in OptionValue.cpp & ThreadList.cpp (NFC)

/data/llvm-project/lldb/source/Interpreter/OptionValue.cpp:28:3: error: 'scoped_lock' may not intend to support class template argument deduction [-Werror,-Wctad-maybe-unsupported]
  std::scoped_lock lock(m_mutex, other.m_mutex);
  ^
/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/mutex:692:11: note: add a deduction guide to suppress this warning
    class scoped_lock
          ^
1 error generated.

/data/llvm-project/lldb/source/Target/ThreadList.cpp:739:5: error: 'scoped_lock' may not intend to support class template argument deduction [-Werror,-Wctad-maybe-unsupported]
    std::scoped_lock guard(GetMutex(), rhs.GetMutex());
    ^
/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/mutex:692:11: note: add a deduction guide to suppress this warning
    class scoped_lock
          ^
1 error generated.

Added: 
    

Modified: 
    lldb/source/Interpreter/OptionValue.cpp
    lldb/source/Target/ThreadList.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Interpreter/OptionValue.cpp b/lldb/source/Interpreter/OptionValue.cpp
index 5ff7e3c3208980..fe1d8829c5adf6 100644
--- a/lldb/source/Interpreter/OptionValue.cpp
+++ b/lldb/source/Interpreter/OptionValue.cpp
@@ -25,7 +25,7 @@ OptionValue::OptionValue(const OptionValue &other) {
 }
 
 OptionValue& OptionValue::operator=(const OptionValue &other) {
-  std::scoped_lock lock(m_mutex, other.m_mutex);
+  std::scoped_lock<std::mutex, std::mutex> lock(m_mutex, other.m_mutex);
 
   m_parent_wp = other.m_parent_wp;
   m_callback = other.m_callback;

diff  --git a/lldb/source/Target/ThreadList.cpp b/lldb/source/Target/ThreadList.cpp
index c5c3f667c90471..1ba0c435b993d3 100644
--- a/lldb/source/Target/ThreadList.cpp
+++ b/lldb/source/Target/ThreadList.cpp
@@ -736,7 +736,7 @@ void ThreadList::Update(ThreadList &rhs) {
   if (this != &rhs) {
     // Lock both mutexes to make sure neither side changes anyone on us while
     // the assignment occurs
-    std::scoped_lock guard(GetMutex(), rhs.GetMutex());
+    std::scoped_lock<std::recursive_mutex, std::recursive_mutex> guard(GetMutex(), rhs.GetMutex());
 
     m_process = rhs.m_process;
     m_stop_id = rhs.m_stop_id;


        


More information about the lldb-commits mailing list