[Lldb-commits] [lldb] 989f250 - [lldb] 'scoped_lock' may not intend to support class template argument deduction (NFC)

Jie Fu via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 10 18:09:31 PDT 2023


Author: Jie Fu
Date: 2023-08-11T09:06:11+08:00
New Revision: 989f25001aee3457738c431ba1e977a8140726a0

URL: https://github.com/llvm/llvm-project/commit/989f25001aee3457738c431ba1e977a8140726a0
DIFF: https://github.com/llvm/llvm-project/commit/989f25001aee3457738c431ba1e977a8140726a0.diff

LOG: [lldb] 'scoped_lock' may not intend to support class template argument deduction (NFC)

/data/home/jiefu/llvm-project/lldb/source/Host/common/File.cpp:251:3: error: 'scoped_lock' may not intend to support class template argument deduction [-Werror,-Wctad-maybe-unsupported]
  std::scoped_lock lock(m_descriptor_mutex, m_stream_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
          ^
/data/home/jiefu/llvm-project/lldb/source/Host/common/File.cpp:316:3: error: 'scoped_lock' may not intend to support class template argument deduction [-Werror,-Wctad-maybe-unsupported]
  std::scoped_lock lock(m_descriptor_mutex, m_stream_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
          ^
2 errors generated.

Added: 
    

Modified: 
    lldb/source/Host/common/File.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Host/common/File.cpp b/lldb/source/Host/common/File.cpp
index 82cfcedd616fc2..174feecf2de0ad 100644
--- a/lldb/source/Host/common/File.cpp
+++ b/lldb/source/Host/common/File.cpp
@@ -248,7 +248,7 @@ uint32_t File::GetPermissions(Status &error) const {
 }
 
 bool NativeFile::IsValid() const {
-  std::scoped_lock lock(m_descriptor_mutex, m_stream_mutex);
+  std::scoped_lock<std::mutex, std::mutex> lock(m_descriptor_mutex, m_stream_mutex);
   return DescriptorIsValidUnlocked() || StreamIsValidUnlocked();
 }
 
@@ -313,7 +313,7 @@ FILE *NativeFile::GetStream() {
 }
 
 Status NativeFile::Close() {
-  std::scoped_lock lock(m_descriptor_mutex, m_stream_mutex);
+  std::scoped_lock<std::mutex, std::mutex> lock(m_descriptor_mutex, m_stream_mutex);
 
   Status error;
 


        


More information about the lldb-commits mailing list