[Lldb-commits] [lldb] 04da749 - [lldb] Fix warnings
Kazu Hirata via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 15 12:51:38 PDT 2023
Author: Kazu Hirata
Date: 2023-08-15T12:46:36-07:00
New Revision: 04da7490d85dab7f2f97d0a782b674088bc5a10f
URL: https://github.com/llvm/llvm-project/commit/04da7490d85dab7f2f97d0a782b674088bc5a10f
DIFF: https://github.com/llvm/llvm-project/commit/04da7490d85dab7f2f97d0a782b674088bc5a10f.diff
LOG: [lldb] Fix warnings
This patch fixes warnings like:
lldb/source/Core/ModuleList.cpp:1086:3: error: 'scoped_lock' may not
intend to support class template argument deduction
[-Werror,-Wctad-maybe-unsupported]
Added:
Modified:
lldb/source/Core/ModuleList.cpp
lldb/source/Host/posix/PipePosix.cpp
Removed:
################################################################################
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index 6cb086f9f55d2c..17d4560f724b84 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -1083,6 +1083,7 @@ bool ModuleList::AnyOf(
void ModuleList::Swap(ModuleList &other) {
// scoped_lock locks both mutexes at once.
- std::scoped_lock lock(m_modules_mutex, other.m_modules_mutex);
+ std::scoped_lock<std::recursive_mutex, std::recursive_mutex> lock(
+ m_modules_mutex, other.m_modules_mutex);
m_modules.swap(other.m_modules);
}
diff --git a/lldb/source/Host/posix/PipePosix.cpp b/lldb/source/Host/posix/PipePosix.cpp
index 0050731acb3fcb..c02869cbf4d730 100644
--- a/lldb/source/Host/posix/PipePosix.cpp
+++ b/lldb/source/Host/posix/PipePosix.cpp
@@ -65,8 +65,9 @@ PipePosix::PipePosix(PipePosix &&pipe_posix)
pipe_posix.ReleaseWriteFileDescriptor()} {}
PipePosix &PipePosix::operator=(PipePosix &&pipe_posix) {
- std::scoped_lock guard(m_read_mutex, m_write_mutex, pipe_posix.m_read_mutex,
- pipe_posix.m_write_mutex);
+ std::scoped_lock<std::mutex, std::mutex, std::mutex, std::mutex> guard(
+ m_read_mutex, m_write_mutex, pipe_posix.m_read_mutex,
+ pipe_posix.m_write_mutex);
PipeBase::operator=(std::move(pipe_posix));
m_fds[READ] = pipe_posix.ReleaseReadFileDescriptorUnlocked();
@@ -77,7 +78,7 @@ PipePosix &PipePosix::operator=(PipePosix &&pipe_posix) {
PipePosix::~PipePosix() { Close(); }
Status PipePosix::CreateNew(bool child_processes_inherit) {
- std::scoped_lock guard(m_read_mutex, m_write_mutex);
+ std::scoped_lock<std::mutex, std::mutex> guard(m_read_mutex, m_write_mutex);
if (CanReadUnlocked() || CanWriteUnlocked())
return Status(EINVAL, eErrorTypePOSIX);
@@ -107,7 +108,7 @@ Status PipePosix::CreateNew(bool child_processes_inherit) {
}
Status PipePosix::CreateNew(llvm::StringRef name, bool child_process_inherit) {
- std::scoped_lock (m_read_mutex, m_write_mutex);
+ std::scoped_lock<std::mutex, std::mutex> (m_read_mutex, m_write_mutex);
if (CanReadUnlocked() || CanWriteUnlocked())
return Status("Pipe is already opened");
@@ -145,7 +146,7 @@ Status PipePosix::CreateWithUniqueName(llvm::StringRef prefix,
Status PipePosix::OpenAsReader(llvm::StringRef name,
bool child_process_inherit) {
- std::scoped_lock (m_read_mutex, m_write_mutex);
+ std::scoped_lock<std::mutex, std::mutex> (m_read_mutex, m_write_mutex);
if (CanReadUnlocked() || CanWriteUnlocked())
return Status("Pipe is already opened");
@@ -168,7 +169,7 @@ Status
PipePosix::OpenAsWriterWithTimeout(llvm::StringRef name,
bool child_process_inherit,
const std::chrono::microseconds &timeout) {
- std::lock_guard guard(m_write_mutex);
+ std::lock_guard<std::mutex> guard(m_write_mutex);
if (CanReadUnlocked() || CanWriteUnlocked())
return Status("Pipe is already opened");
@@ -205,7 +206,7 @@ PipePosix::OpenAsWriterWithTimeout(llvm::StringRef name,
}
int PipePosix::GetReadFileDescriptor() const {
- std::lock_guard guard(m_read_mutex);
+ std::lock_guard<std::mutex> guard(m_read_mutex);
return GetReadFileDescriptorUnlocked();
}
@@ -214,7 +215,7 @@ int PipePosix::GetReadFileDescriptorUnlocked() const {
}
int PipePosix::GetWriteFileDescriptor() const {
- std::lock_guard guard(m_write_mutex);
+ std::lock_guard<std::mutex> guard(m_write_mutex);
return GetWriteFileDescriptorUnlocked();
}
@@ -223,7 +224,7 @@ int PipePosix::GetWriteFileDescriptorUnlocked() const {
}
int PipePosix::ReleaseReadFileDescriptor() {
- std::lock_guard guard(m_read_mutex);
+ std::lock_guard<std::mutex> guard(m_read_mutex);
return ReleaseReadFileDescriptorUnlocked();
}
@@ -234,7 +235,7 @@ int PipePosix::ReleaseReadFileDescriptorUnlocked() {
}
int PipePosix::ReleaseWriteFileDescriptor() {
- std::lock_guard guard(m_write_mutex);
+ std::lock_guard<std::mutex> guard(m_write_mutex);
return ReleaseWriteFileDescriptorUnlocked();
}
@@ -245,7 +246,7 @@ int PipePosix::ReleaseWriteFileDescriptorUnlocked() {
}
void PipePosix::Close() {
- std::scoped_lock guard(m_read_mutex, m_write_mutex);
+ std::scoped_lock<std::mutex, std::mutex> guard(m_read_mutex, m_write_mutex);
CloseUnlocked();
}
@@ -259,7 +260,7 @@ Status PipePosix::Delete(llvm::StringRef name) {
}
bool PipePosix::CanRead() const {
- std::lock_guard guard(m_read_mutex);
+ std::lock_guard<std::mutex> guard(m_read_mutex);
return CanReadUnlocked();
}
@@ -268,7 +269,7 @@ bool PipePosix::CanReadUnlocked() const {
}
bool PipePosix::CanWrite() const {
- std::lock_guard guard(m_write_mutex);
+ std::lock_guard<std::mutex> guard(m_write_mutex);
return CanWriteUnlocked();
}
@@ -277,7 +278,7 @@ bool PipePosix::CanWriteUnlocked() const {
}
void PipePosix::CloseReadFileDescriptor() {
- std::lock_guard guard(m_read_mutex);
+ std::lock_guard<std::mutex> guard(m_read_mutex);
CloseReadFileDescriptorUnlocked();
}
void PipePosix::CloseReadFileDescriptorUnlocked() {
@@ -288,7 +289,7 @@ void PipePosix::CloseReadFileDescriptorUnlocked() {
}
void PipePosix::CloseWriteFileDescriptor() {
- std::lock_guard guard(m_write_mutex);
+ std::lock_guard<std::mutex> guard(m_write_mutex);
CloseWriteFileDescriptorUnlocked();
}
@@ -302,7 +303,7 @@ void PipePosix::CloseWriteFileDescriptorUnlocked() {
Status PipePosix::ReadWithTimeout(void *buf, size_t size,
const std::chrono::microseconds &timeout,
size_t &bytes_read) {
- std::lock_guard guard(m_read_mutex);
+ std::lock_guard<std::mutex> guard(m_read_mutex);
bytes_read = 0;
if (!CanReadUnlocked())
return Status(EINVAL, eErrorTypePOSIX);
@@ -335,7 +336,7 @@ Status PipePosix::ReadWithTimeout(void *buf, size_t size,
}
Status PipePosix::Write(const void *buf, size_t size, size_t &bytes_written) {
- std::lock_guard guard(m_write_mutex);
+ std::lock_guard<std::mutex> guard(m_write_mutex);
bytes_written = 0;
if (!CanWriteUnlocked())
return Status(EINVAL, eErrorTypePOSIX);
More information about the lldb-commits
mailing list