Skip to content

Commit 4d23764

Browse files
committed
Fix -Wunused-result warnings in LLDB
Three uses of try_lock intentionally ignore the result, as explained in the comment. Make that explicit with a void cast. Add what appears to be a missing return in the clang expression parser code. It's a functional change, but presumably the right one. Differential Revision: https://reviews.llvm.org/D70281
1 parent 0304360 commit 4d23764

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ class ClangExpressionDeclMap : public ClangASTSource {
312312
if (m_exe_ctx.GetTargetPtr())
313313
return m_exe_ctx.GetTargetPtr();
314314
else if (m_sym_ctx.target_sp)
315-
m_sym_ctx.target_sp.get();
315+
return m_sym_ctx.target_sp.get();
316316
return nullptr;
317317
}
318318

lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ bool OperatingSystemPython::UpdateThreadList(ThreadList &old_thread_list,
166166
Target &target = m_process->GetTarget();
167167
std::unique_lock<std::recursive_mutex> api_lock(target.GetAPIMutex(),
168168
std::defer_lock);
169-
api_lock.try_lock();
169+
(void)api_lock.try_lock(); // See above.
170170
auto interpreter_lock = m_interpreter->AcquireInterpreterLock();
171171

172172
LLDB_LOGF(log,
@@ -308,7 +308,7 @@ OperatingSystemPython::CreateRegisterContextForThread(Thread *thread,
308308
Target &target = m_process->GetTarget();
309309
std::unique_lock<std::recursive_mutex> api_lock(target.GetAPIMutex(),
310310
std::defer_lock);
311-
api_lock.try_lock();
311+
(void)api_lock.try_lock(); // See above.
312312
auto interpreter_lock = m_interpreter->AcquireInterpreterLock();
313313

314314
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
@@ -395,7 +395,7 @@ lldb::ThreadSP OperatingSystemPython::CreateThread(lldb::tid_t tid,
395395
Target &target = m_process->GetTarget();
396396
std::unique_lock<std::recursive_mutex> api_lock(target.GetAPIMutex(),
397397
std::defer_lock);
398-
api_lock.try_lock();
398+
(void)api_lock.try_lock(); // See above.
399399
auto interpreter_lock = m_interpreter->AcquireInterpreterLock();
400400

401401
StructuredData::DictionarySP thread_info_dict =

0 commit comments

Comments
 (0)