[Lldb-commits] [lldb] r213693 - Host: Fix a pointer-to-function to void-pointer cast

David Majnemer david.majnemer at gmail.com
Tue Jul 22 15:00:42 PDT 2014


Author: majnemer
Date: Tue Jul 22 17:00:42 2014
New Revision: 213693

URL: http://llvm.org/viewvc/llvm-project?rev=213693&view=rev
Log:
Host: Fix a pointer-to-function to void-pointer cast

reinterpret_cast may not convert a pointer-to-function to a
void-pointer.  Take a detour through intptr_t and *then* convert to a
pointer-to-function.

This silences a warning emitted by GCC when building LLDB.

Differential Revision: http://reviews.llvm.org/D4631

Modified:
    lldb/trunk/source/Host/common/Host.cpp

Modified: lldb/trunk/source/Host/common/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=213693&r1=213692&r2=213693&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Host.cpp (original)
+++ lldb/trunk/source/Host/common/Host.cpp Tue Jul 22 17:00:42 2014
@@ -1057,7 +1057,8 @@ Host::GetLLDBPath (PathType path_type, F
             static ConstString g_lldb_so_dir;
             if (!g_lldb_so_dir)
             {
-                FileSpec lldb_file_spec (Host::GetModuleFileSpecForHostAddress ((void *)Host::GetLLDBPath));
+                FileSpec lldb_file_spec(Host::GetModuleFileSpecForHostAddress(
+                    reinterpret_cast<void *>(reinterpret_cast<intptr_t>(Host::GetLLDBPath))));
                 g_lldb_so_dir = lldb_file_spec.GetDirectory();
                 if (log)
                     log->Printf("Host::GetLLDBPath(ePathTypeLLDBShlibDir) => '%s'", g_lldb_so_dir.GetCString());





More information about the lldb-commits mailing list