Skip to content

Commit

Permalink
[lldb] Silence warning
Browse files Browse the repository at this point in the history
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: llvm#97905
  • Loading branch information
aganea authored and bwendling committed Aug 15, 2024
1 parent e890b8e commit 39035fb
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 39035fb

Please sign in to comment.