[Lldb-commits] [lldb] a819b0e - [lldb] Silence warning

Alexandre Ganea via lldb-commits lldb-commits at lists.llvm.org
Sun Aug 11 16:01:35 PDT 2024


Author: Alexandre Ganea
Date: 2024-08-11T19:01:12-04:00
New Revision: a819b0e55fafab0c6c4b059fc0132620f43ac38a

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

LOG: [lldb] Silence warning

This fixes the following warning, when building with Clang ToT on
Windows:
```
[6668/7618] Building CXX object
tools\lldb\source\Plugins\Process\Windows\Common\CMakeFiles\lldbPluginProcessWindowsCommon.dir\TargetThreadWindows.cpp.obj
C:\src\git\llvm-project\lldb\source\Plugins\Process\Windows\Common\TargetThreadWindows.cpp(182,22):
warning: cast from 'FARPROC' (aka 'long long (*)()') to
'GetThreadDescriptionFunctionPtr' (aka 'long (*)(void *, wchar_t **)')
converts to incompatible function type [-Wcast-function-type-mismatch]
```

This is similar to: https://github.com/llvm/llvm-project/pull/97905

Added: 
    

Modified: 
    lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp
index a69c10081ff190..a0d0f0ea0abc80 100644
--- a/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp
@@ -179,9 +179,10 @@ const char *TargetThreadWindows::GetName() {
   Log *log = GetLog(LLDBLog::Thread);
   static GetThreadDescriptionFunctionPtr GetThreadDescription = []() {
     HMODULE hModule = ::LoadLibraryW(L"Kernel32.dll");
-    return hModule ? reinterpret_cast<GetThreadDescriptionFunctionPtr>(
-                         ::GetProcAddress(hModule, "GetThreadDescription"))
-                   : nullptr;
+    return hModule
+               ? reinterpret_cast<GetThreadDescriptionFunctionPtr>(
+                     (void *)::GetProcAddress(hModule, "GetThreadDescription"))
+               : nullptr;
   }();
   LLDB_LOGF(log, "GetProcAddress: %p",
             reinterpret_cast<void *>(GetThreadDescription));


        


More information about the lldb-commits mailing list