Host: Fix a pointer-to-function to void-pointer cast
authorDavid Majnemer <david.majnemer@gmail.com>
Tue, 22 Jul 2014 22:00:42 +0000 (22:00 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Tue, 22 Jul 2014 22:00:42 +0000 (22:00 +0000)
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

llvm-svn: 213693

lldb/source/Host/common/Host.cpp

index 0006a61df0c4b1b0fa718592ae9bb125ce78f033..4aa362ecee56fdeb436ea0f8bc66f94dbd28111b 100644 (file)
@@ -1057,7 +1057,8 @@ Host::GetLLDBPath (PathType path_type, FileSpec &file_spec)
             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());