[Lldb-commits] [lldb] r361503 - [lldb] fix cannot convert from 'nullptr' to 'lldb::thread_result_t'

Konrad Kleine via lldb-commits lldb-commits at lists.llvm.org
Thu May 23 08:17:40 PDT 2019


Author: kwk
Date: Thu May 23 08:17:39 2019
New Revision: 361503

URL: http://llvm.org/viewvc/llvm-project?rev=361503&view=rev
Log:
[lldb] fix cannot convert from 'nullptr' to 'lldb::thread_result_t'

Summary:
On Windows `lldb::thread_result_t` resolves to `typedef unsigned thread_result_t;` and on other platforms it resolves to `typedef void *thread_result_t;`.
 Therefore one cannot use `nullptr` when returning from a function that returns `thread_result_t`.

I've made this change because a windows build bot fails with these errors:

```
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Communication.cpp(362): error C2440: 'return': cannot convert from 'nullptr' to 'lldb::thread_result_t'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Communication.cpp(362): note: A native nullptr can only be converted to bool or, using reinterpret_cast, to an integral type
```

and

```
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1619): error C2440: 'return': cannot convert from 'nullptr' to 'lldb::thread_result_t'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1619): note: A native nullptr can only be converted to bool or, using reinterpret_cast, to an integral type
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1664): error C2440: 'return': cannot convert from 'nullptr' to 'lldb::thread_result_t'
E:\build_slave\lldb-x64-windows-ninja\llvm\tools\lldb\source\Core\Debugger.cpp(1664): note: A native nullptr can only be converted to bool or, using reinterpret_cast, to an integral type
```

This is the failing build: http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/5035/steps/build/logs/stdio

Reviewers: JDevlieghere, teemperor, jankratochvil, labath, clayborg, RKSimon, courbet, jhenderson

Reviewed By: labath, clayborg

Subscribers: labath, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D62305

Modified:
    lldb/trunk/source/Core/Communication.cpp
    lldb/trunk/source/Core/Debugger.cpp
    lldb/trunk/source/Host/common/TaskPool.cpp
    lldb/trunk/source/Host/windows/HostProcessWindows.cpp
    lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp

Modified: lldb/trunk/source/Core/Communication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=361503&r1=361502&r2=361503&view=diff
==============================================================================
--- lldb/trunk/source/Core/Communication.cpp (original)
+++ lldb/trunk/source/Core/Communication.cpp Thu May 23 08:17:39 2019
@@ -359,7 +359,7 @@ lldb::thread_result_t Communication::Rea
   // Let clients know that this thread is exiting
   comm->BroadcastEvent(eBroadcastBitNoMorePendingInput);
   comm->BroadcastEvent(eBroadcastBitReadThreadDidExit);
-  return nullptr;
+  return {};
 }
 
 void Communication::SetReadThreadBytesReceivedCallback(

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=361503&r1=361502&r2=361503&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Thu May 23 08:17:39 2019
@@ -1616,7 +1616,7 @@ void Debugger::DefaultEventHandler() {
 
 lldb::thread_result_t Debugger::EventHandlerThread(lldb::thread_arg_t arg) {
   ((Debugger *)arg)->DefaultEventHandler();
-  return nullptr;
+  return {};
 }
 
 bool Debugger::StartEventHandlerThread() {
@@ -1661,7 +1661,7 @@ lldb::thread_result_t Debugger::IOHandle
   Debugger *debugger = (Debugger *)arg;
   debugger->ExecuteIOHandlers();
   debugger->StopEventHandlerThread();
-  return nullptr;
+  return {};
 }
 
 bool Debugger::HasIOHandlerThread() { return m_io_handler_thread.IsJoinable(); }

Modified: lldb/trunk/source/Host/common/TaskPool.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/TaskPool.cpp?rev=361503&r1=361502&r2=361503&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/TaskPool.cpp (original)
+++ lldb/trunk/source/Host/common/TaskPool.cpp Thu May 23 08:17:39 2019
@@ -73,7 +73,7 @@ void TaskPoolImpl::AddTask(std::function
 
 lldb::thread_result_t TaskPoolImpl::WorkerPtr(void *pool) {
   Worker((TaskPoolImpl *)pool);
-  return nullptr;
+  return {};
 }
 
 void TaskPoolImpl::Worker(TaskPoolImpl *pool) {

Modified: lldb/trunk/source/Host/windows/HostProcessWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/HostProcessWindows.cpp?rev=361503&r1=361502&r2=361503&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/HostProcessWindows.cpp (original)
+++ lldb/trunk/source/Host/windows/HostProcessWindows.cpp Thu May 23 08:17:39 2019
@@ -109,7 +109,7 @@ lldb::thread_result_t HostProcessWindows
     ::CloseHandle(info->process_handle);
     delete (info);
   }
-  return 0;
+  return {};
 }
 
 void HostProcessWindows::Close() {

Modified: lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp?rev=361503&r1=361502&r2=361503&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp Thu May 23 08:17:39 2019
@@ -132,7 +132,7 @@ lldb::thread_result_t DebuggerThread::De
   else
     m_debug_delegate->OnDebuggerError(error, 0);
 
-  return 0;
+  return {};
 }
 
 lldb::thread_result_t DebuggerThread::DebuggerThreadAttachRoutine(
@@ -148,7 +148,7 @@ lldb::thread_result_t DebuggerThread::De
   if (!DebugActiveProcess((DWORD)pid)) {
     Status error(::GetLastError(), eErrorTypeWin32);
     m_debug_delegate->OnDebuggerError(error, 0);
-    return 0;
+    return {};
   }
 
   // The attach was successful, enter the debug loop.  From here on out, this
@@ -156,7 +156,7 @@ lldb::thread_result_t DebuggerThread::De
   // in DebugLaunch should apply from this point out.
   DebugLoop();
 
-  return 0;
+  return {};
 }
 
 Status DebuggerThread::StopDebugging(bool terminate) {




More information about the lldb-commits mailing list