[Lldb-commits] [lldb] 4d23764 - Fix -Wunused-result warnings in LLDB

Reid Kleckner via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 15 16:39:42 PST 2019


Author: Reid Kleckner
Date: 2019-11-15T16:38:00-08:00
New Revision: 4d23764dddc23e74ad165086d7f471a3e0e52bf8

URL: https://github.com/llvm/llvm-project/commit/4d23764dddc23e74ad165086d7f471a3e0e52bf8
DIFF: https://github.com/llvm/llvm-project/commit/4d23764dddc23e74ad165086d7f471a3e0e52bf8.diff

LOG: 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

Added: 
    

Modified: 
    lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
    lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
index 39b143022809..152549f8dd56 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
@@ -312,7 +312,7 @@ class ClangExpressionDeclMap : public ClangASTSource {
       if (m_exe_ctx.GetTargetPtr())
         return m_exe_ctx.GetTargetPtr();
       else if (m_sym_ctx.target_sp)
-        m_sym_ctx.target_sp.get();
+        return m_sym_ctx.target_sp.get();
       return nullptr;
     }
 

diff  --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
index b777a5319104..5761b39f1115 100644
--- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
+++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
@@ -166,7 +166,7 @@ bool OperatingSystemPython::UpdateThreadList(ThreadList &old_thread_list,
   Target &target = m_process->GetTarget();
   std::unique_lock<std::recursive_mutex> api_lock(target.GetAPIMutex(),
                                                   std::defer_lock);
-  api_lock.try_lock();
+  (void)api_lock.try_lock(); // See above.
   auto interpreter_lock = m_interpreter->AcquireInterpreterLock();
 
   LLDB_LOGF(log,
@@ -308,7 +308,7 @@ OperatingSystemPython::CreateRegisterContextForThread(Thread *thread,
   Target &target = m_process->GetTarget();
   std::unique_lock<std::recursive_mutex> api_lock(target.GetAPIMutex(),
                                                   std::defer_lock);
-  api_lock.try_lock();
+  (void)api_lock.try_lock(); // See above.
   auto interpreter_lock = m_interpreter->AcquireInterpreterLock();
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD));
@@ -395,7 +395,7 @@ lldb::ThreadSP OperatingSystemPython::CreateThread(lldb::tid_t tid,
     Target &target = m_process->GetTarget();
     std::unique_lock<std::recursive_mutex> api_lock(target.GetAPIMutex(),
                                                     std::defer_lock);
-    api_lock.try_lock();
+    (void)api_lock.try_lock(); // See above.
     auto interpreter_lock = m_interpreter->AcquireInterpreterLock();
 
     StructuredData::DictionarySP thread_info_dict =


        


More information about the lldb-commits mailing list