Author: Raphael Isemann Date: 2020-01-07T13:03:56+01:00 New Revision: 65fdb34219f33b2871a532a38814ac4ebea10abc
URL: https://github.com/llvm/llvm-project/commit/65fdb34219f33b2871a532a38814ac4ebea10abc DIFF: https://github.com/llvm/llvm-project/commit/65fdb34219f33b2871a532a38814ac4ebea10abc.diff LOG: [lldb][NFC] Use static_cast instead of reinterpret_cast where possible Summary: There are a few places in LLDB where we do a `reinterpret_cast` for conversions that we could also do with `static_cast`. This patch moves all this code to `static_cast`. Reviewers: shafik, JDevlieghere, labath Reviewed By: labath Subscribers: arphaman, usaxena95, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D72161 Added: Modified: lldb/source/API/SBEvent.cpp lldb/source/Core/Debugger.cpp lldb/source/Host/common/NativeProcessProtocol.cpp lldb/source/Host/macosx/objcxx/Host.mm lldb/source/Host/posix/PipePosix.cpp lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp lldb/source/Target/Target.cpp lldb/source/Utility/DataExtractor.cpp lldb/source/Utility/Environment.cpp lldb/source/Utility/Scalar.cpp lldb/source/Utility/StreamString.cpp lldb/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp lldb/tools/debugserver/source/MacOSX/MachProcess.mm lldb/tools/debugserver/source/MacOSX/MachThread.cpp Removed: ################################################################################ diff --git a/lldb/source/API/SBEvent.cpp b/lldb/source/API/SBEvent.cpp index 75ca2830df9f..fb2ad10ddcf9 100644 --- a/lldb/source/API/SBEvent.cpp +++ b/lldb/source/API/SBEvent.cpp @@ -175,7 +175,7 @@ const char *SBEvent::GetCStringFromEvent(const SBEvent &event) { LLDB_RECORD_STATIC_METHOD(const char *, SBEvent, GetCStringFromEvent, (const lldb::SBEvent &), event); - return reinterpret_cast<const char *>( + return static_cast<const char *>( EventDataBytes::GetBytesFromEvent(event.get())); } diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index c4619776c11c..33f72a0896cb 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -1456,7 +1456,7 @@ void Debugger::DefaultEventHandler() { done = true; } else if (event_type & CommandInterpreter::eBroadcastBitAsynchronousErrorData) { - const char *data = reinterpret_cast<const char *>( + const char *data = static_cast<const char *>( EventDataBytes::GetBytesFromEvent(event_sp.get())); if (data && data[0]) { StreamSP error_sp(GetAsyncErrorStream()); @@ -1467,7 +1467,7 @@ void Debugger::DefaultEventHandler() { } } else if (event_type & CommandInterpreter:: eBroadcastBitAsynchronousOutputData) { - const char *data = reinterpret_cast<const char *>( + const char *data = static_cast<const char *>( EventDataBytes::GetBytesFromEvent(event_sp.get())); if (data && data[0]) { StreamSP output_sp(GetAsyncOutputStream()); diff --git a/lldb/source/Host/common/NativeProcessProtocol.cpp b/lldb/source/Host/common/NativeProcessProtocol.cpp index fd349cc2915b..712c448dc2c1 100644 --- a/lldb/source/Host/common/NativeProcessProtocol.cpp +++ b/lldb/source/Host/common/NativeProcessProtocol.cpp @@ -682,7 +682,7 @@ NativeProcessProtocol::ReadCStringFromMemory(lldb::addr_t addr, char *buffer, addr_t cache_line_bytes_left = cache_line_size - (curr_addr % cache_line_size); addr_t bytes_to_read = std::min<addr_t>(bytes_left, cache_line_bytes_left); - status = ReadMemory(curr_addr, reinterpret_cast<void *>(curr_buffer), + status = ReadMemory(curr_addr, static_cast<void *>(curr_buffer), bytes_to_read, bytes_read); if (bytes_read == 0) @@ -691,7 +691,7 @@ NativeProcessProtocol::ReadCStringFromMemory(lldb::addr_t addr, char *buffer, void *str_end = std::memchr(curr_buffer, '\0', bytes_read); if (str_end != nullptr) { total_bytes_read = - (size_t)(reinterpret_cast<char *>(str_end) - buffer + 1); + static_cast<size_t>((static_cast<char *>(str_end) - buffer + 1)); status.Clear(); break; } diff --git a/lldb/source/Host/macosx/objcxx/Host.mm b/lldb/source/Host/macosx/objcxx/Host.mm index 03880ff433bd..9febb8fb8b29 100644 --- a/lldb/source/Host/macosx/objcxx/Host.mm +++ b/lldb/source/Host/macosx/objcxx/Host.mm @@ -1013,7 +1013,7 @@ static bool AddPosixSpawnFileAction(void *_file_actions, const FileAction *info, return false; posix_spawn_file_actions_t *file_actions = - reinterpret_cast<posix_spawn_file_actions_t *>(_file_actions); + static_cast<posix_spawn_file_actions_t *>(_file_actions); switch (info->GetAction()) { case FileAction::eFileActionNone: @@ -1447,7 +1447,7 @@ static bool ShouldLaunchUsingXPC(ProcessLaunchInfo &launch_info) { "(callback, pid=%i, monitor_signals=%i) " "source = %p\n", static_cast<int>(pid), monitor_signals, - reinterpret_cast<void *>(source)); + static_cast<void *>(source)); if (source) { Host::MonitorChildProcessCallback callback_copy = callback; diff --git a/lldb/source/Host/posix/PipePosix.cpp b/lldb/source/Host/posix/PipePosix.cpp index efdc151e3763..ce1baf3f12a3 100644 --- a/lldb/source/Host/posix/PipePosix.cpp +++ b/lldb/source/Host/posix/PipePosix.cpp @@ -270,8 +270,8 @@ Status PipePosix::ReadWithTimeout(void *buf, size_t size, while (error.Success()) { error = select_helper.Select(); if (error.Success()) { - auto result = ::read(fd, reinterpret_cast<char *>(buf) + bytes_read, - size - bytes_read); + auto result = + ::read(fd, static_cast<char *>(buf) + bytes_read, size - bytes_read); if (result != -1) { bytes_read += result; if (bytes_read == size || result == 0) @@ -301,9 +301,8 @@ Status PipePosix::Write(const void *buf, size_t size, size_t &bytes_written) { while (error.Success()) { error = select_helper.Select(); if (error.Success()) { - auto result = - ::write(fd, reinterpret_cast<const char *>(buf) + bytes_written, - size - bytes_written); + auto result = ::write(fd, static_cast<const char *>(buf) + bytes_written, + size - bytes_written); if (result != -1) { bytes_written += result; if (bytes_written == size) diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp index 5e6a1ac2a083..19cab1dafd44 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -388,8 +388,7 @@ bool ASTResultSynthesizer::SynthesizeBodyResult(CompoundStmt *Body, // replace the old statement with the new one // - *last_stmt_ptr = - reinterpret_cast<Stmt *>(result_initialization_stmt_result.get()); + *last_stmt_ptr = static_cast<Stmt *>(result_initialization_stmt_result.get()); return true; } diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp index 0c5796650d45..c87507a25855 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp @@ -22,8 +22,7 @@ uint32_t ClangDeclVendor::FindDecls(ConstString name, bool append, std::vector<CompilerDecl> compiler_decls; uint32_t ret = FindDecls(name, /*append*/ false, max_matches, compiler_decls); for (CompilerDecl compiler_decl : compiler_decls) { - clang::Decl *d = - reinterpret_cast<clang::Decl *>(compiler_decl.GetOpaqueDecl()); + clang::Decl *d = static_cast<clang::Decl *>(compiler_decl.GetOpaqueDecl()); clang::NamedDecl *nd = llvm::cast<clang::NamedDecl>(d); decls.push_back(nd); } diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp index ddfae7e7d120..f33f0ee66304 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -2013,7 +2013,7 @@ GDBRemoteCommunicationServerLLGS::Handle_p(StringExtractorGDBRemote &packet) { } const uint8_t *const data = - reinterpret_cast<const uint8_t *>(reg_value.GetBytes()); + static_cast<const uint8_t *>(reg_value.GetBytes()); if (!data) { LLDB_LOGF(log, "GDBRemoteCommunicationServerLLGS::%s failed to get data " diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 83dc3de3ce56..e35a10a3f6bf 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -3978,14 +3978,14 @@ void TargetProperties::SetRequireHardwareBreakpoints(bool b) { void TargetProperties::Arg0ValueChangedCallback(void *target_property_ptr, OptionValue *) { TargetProperties *this_ = - reinterpret_cast<TargetProperties *>(target_property_ptr); + static_cast<TargetProperties *>(target_property_ptr); this_->m_launch_info.SetArg0(this_->GetArg0()); } void TargetProperties::RunArgsValueChangedCallback(void *target_property_ptr, OptionValue *) { TargetProperties *this_ = - reinterpret_cast<TargetProperties *>(target_property_ptr); + static_cast<TargetProperties *>(target_property_ptr); Args args; if (this_->GetRunArguments(args)) this_->m_launch_info.GetArguments() = args; @@ -3994,14 +3994,14 @@ void TargetProperties::RunArgsValueChangedCallback(void *target_property_ptr, void TargetProperties::EnvVarsValueChangedCallback(void *target_property_ptr, OptionValue *) { TargetProperties *this_ = - reinterpret_cast<TargetProperties *>(target_property_ptr); + static_cast<TargetProperties *>(target_property_ptr); this_->m_launch_info.GetEnvironment() = this_->GetEnvironment(); } void TargetProperties::InputPathValueChangedCallback(void *target_property_ptr, OptionValue *) { TargetProperties *this_ = - reinterpret_cast<TargetProperties *>(target_property_ptr); + static_cast<TargetProperties *>(target_property_ptr); this_->m_launch_info.AppendOpenFileAction( STDIN_FILENO, this_->GetStandardInputPath(), true, false); } @@ -4009,7 +4009,7 @@ void TargetProperties::InputPathValueChangedCallback(void *target_property_ptr, void TargetProperties::OutputPathValueChangedCallback(void *target_property_ptr, OptionValue *) { TargetProperties *this_ = - reinterpret_cast<TargetProperties *>(target_property_ptr); + static_cast<TargetProperties *>(target_property_ptr); this_->m_launch_info.AppendOpenFileAction( STDOUT_FILENO, this_->GetStandardOutputPath(), false, true); } @@ -4017,7 +4017,7 @@ void TargetProperties::OutputPathValueChangedCallback(void *target_property_ptr, void TargetProperties::ErrorPathValueChangedCallback(void *target_property_ptr, OptionValue *) { TargetProperties *this_ = - reinterpret_cast<TargetProperties *>(target_property_ptr); + static_cast<TargetProperties *>(target_property_ptr); this_->m_launch_info.AppendOpenFileAction( STDERR_FILENO, this_->GetStandardErrorPath(), false, true); } @@ -4025,7 +4025,7 @@ void TargetProperties::ErrorPathValueChangedCallback(void *target_property_ptr, void TargetProperties::DetachOnErrorValueChangedCallback( void *target_property_ptr, OptionValue *) { TargetProperties *this_ = - reinterpret_cast<TargetProperties *>(target_property_ptr); + static_cast<TargetProperties *>(target_property_ptr); if (this_->GetDetachOnError()) this_->m_launch_info.GetFlags().Set(lldb::eLaunchFlagDetachOnError); else @@ -4035,7 +4035,7 @@ void TargetProperties::DetachOnErrorValueChangedCallback( void TargetProperties::DisableASLRValueChangedCallback( void *target_property_ptr, OptionValue *) { TargetProperties *this_ = - reinterpret_cast<TargetProperties *>(target_property_ptr); + static_cast<TargetProperties *>(target_property_ptr); if (this_->GetDisableASLR()) this_->m_launch_info.GetFlags().Set(lldb::eLaunchFlagDisableASLR); else @@ -4045,7 +4045,7 @@ void TargetProperties::DisableASLRValueChangedCallback( void TargetProperties::DisableSTDIOValueChangedCallback( void *target_property_ptr, OptionValue *) { TargetProperties *this_ = - reinterpret_cast<TargetProperties *>(target_property_ptr); + static_cast<TargetProperties *>(target_property_ptr); if (this_->GetDisableSTDIO()) this_->m_launch_info.GetFlags().Set(lldb::eLaunchFlagDisableSTDIO); else diff --git a/lldb/source/Utility/DataExtractor.cpp b/lldb/source/Utility/DataExtractor.cpp index ea4fb09bdaab..fed2a1326b86 100644 --- a/lldb/source/Utility/DataExtractor.cpp +++ b/lldb/source/Utility/DataExtractor.cpp @@ -129,9 +129,8 @@ DataExtractor::DataExtractor() DataExtractor::DataExtractor(const void *data, offset_t length, ByteOrder endian, uint32_t addr_size, uint32_t target_byte_size /*=1*/) - : m_start(const_cast<uint8_t *>(reinterpret_cast<const uint8_t *>(data))), - m_end(const_cast<uint8_t *>(reinterpret_cast<const uint8_t *>(data)) + - length), + : m_start(const_cast<uint8_t *>(static_cast<const uint8_t *>(data))), + m_end(const_cast<uint8_t *>(static_cast<const uint8_t *>(data)) + length), m_byte_order(endian), m_addr_size(addr_size), m_data_sp(), m_target_byte_size(target_byte_size) { assert(addr_size == 4 || addr_size == 8); @@ -232,7 +231,7 @@ lldb::offset_t DataExtractor::SetData(const void *bytes, offset_t length, m_start = nullptr; m_end = nullptr; } else { - m_start = const_cast<uint8_t *>(reinterpret_cast<const uint8_t *>(bytes)); + m_start = const_cast<uint8_t *>(static_cast<const uint8_t *>(bytes)); m_end = m_start + length; } return GetByteSize(); diff --git a/lldb/source/Utility/Environment.cpp b/lldb/source/Utility/Environment.cpp index 140533600712..8cafd3024618 100644 --- a/lldb/source/Utility/Environment.cpp +++ b/lldb/source/Utility/Environment.cpp @@ -13,7 +13,7 @@ using namespace lldb_private; char *Environment::Envp::make_entry(llvm::StringRef Key, llvm::StringRef Value) { const size_t size = Key.size() + 1 /*=*/ + Value.size() + 1 /*\0*/; - char *Result = reinterpret_cast<char *>( + char *Result = static_cast<char *>( Allocator.Allocate(sizeof(char) * size, alignof(char))); char *Next = Result; @@ -26,7 +26,7 @@ char *Environment::Envp::make_entry(llvm::StringRef Key, } Environment::Envp::Envp(const Environment &Env) { - Data = reinterpret_cast<char **>( + Data = static_cast<char **>( Allocator.Allocate(sizeof(char *) * (Env.size() + 1), alignof(char *))); char **Next = Data; for (const auto &KV : Env) diff --git a/lldb/source/Utility/Scalar.cpp b/lldb/source/Utility/Scalar.cpp index aefa8c744905..a9293e87220b 100644 --- a/lldb/source/Utility/Scalar.cpp +++ b/lldb/source/Utility/Scalar.cpp @@ -74,7 +74,7 @@ Scalar::Scalar() : m_type(e_void), m_float(static_cast<float>(0)) {} bool Scalar::GetData(DataExtractor &data, size_t limit_byte_size) const { size_t byte_size = GetByteSize(); if (byte_size > 0) { - const uint8_t *bytes = reinterpret_cast<const uint8_t *>(GetBytes()); + const uint8_t *bytes = static_cast<const uint8_t *>(GetBytes()); if (limit_byte_size < byte_size) { if (endian::InlHostByteOrder() == eByteOrderLittle) { @@ -132,7 +132,7 @@ const void *Scalar::GetBytes() const { swapped_words[1] = apint_words[0]; apint_words = swapped_words; } - return reinterpret_cast<const void *>(apint_words); + return static_cast<const void *>(apint_words); case e_sint256: case e_uint256: apint_words = m_integer.getRawData(); @@ -143,7 +143,7 @@ const void *Scalar::GetBytes() const { swapped_words[3] = apint_words[0]; apint_words = swapped_words; } - return reinterpret_cast<const void *>(apint_words); + return static_cast<const void *>(apint_words); case e_sint512: case e_uint512: apint_words = m_integer.getRawData(); @@ -158,13 +158,13 @@ const void *Scalar::GetBytes() const { swapped_words[7] = apint_words[0]; apint_words = swapped_words; } - return reinterpret_cast<const void *>(apint_words); + return static_cast<const void *>(apint_words); case e_float: flt_val = m_float.convertToFloat(); - return reinterpret_cast<const void *>(&flt_val); + return static_cast<const void *>(&flt_val); case e_double: dbl_val = m_float.convertToDouble(); - return reinterpret_cast<const void *>(&dbl_val); + return static_cast<const void *>(&dbl_val); case e_long_double: llvm::APInt ldbl_val = m_float.bitcastToAPInt(); apint_words = ldbl_val.getRawData(); @@ -176,7 +176,7 @@ const void *Scalar::GetBytes() const { swapped_words[1] = apint_words[0]; apint_words = swapped_words; } - return reinterpret_cast<const void *>(apint_words); + return static_cast<const void *>(apint_words); } return nullptr; } diff --git a/lldb/source/Utility/StreamString.cpp b/lldb/source/Utility/StreamString.cpp index bf9814d6c305..6b5b7d337fcc 100644 --- a/lldb/source/Utility/StreamString.cpp +++ b/lldb/source/Utility/StreamString.cpp @@ -24,7 +24,7 @@ void StreamString::Flush() { } size_t StreamString::WriteImpl(const void *s, size_t length) { - m_packet.append(reinterpret_cast<const char *>(s), length); + m_packet.append(static_cast<const char *>(s), length); return length; } diff --git a/lldb/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp b/lldb/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp index be50f04c4d8c..a9f8956b8d42 100644 --- a/lldb/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp +++ b/lldb/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp @@ -690,9 +690,10 @@ void DarwinLogCollector::CancelActivityStream() { if (!m_activity_stream) return; - DNBLogThreadedIf(LOG_DARWIN_LOG, "DarwinLogCollector::%s(): canceling " - "activity stream %p", - __FUNCTION__, reinterpret_cast<void *>(m_activity_stream)); + DNBLogThreadedIf(LOG_DARWIN_LOG, + "DarwinLogCollector::%s(): canceling " + "activity stream %p", + __FUNCTION__, static_cast<void *>(m_activity_stream)); (*s_os_activity_stream_cancel)(m_activity_stream); m_activity_stream = nullptr; } diff --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm index 652a531dab01..2e952d6ad0bc 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm +++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm @@ -1413,29 +1413,29 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary *options, bool MachProcess::Signal(int signal, const struct timespec *timeout_abstime) { DNBLogThreadedIf(LOG_PROCESS, "MachProcess::Signal (signal = %d, timeout = %p)", signal, - reinterpret_cast<const void *>(timeout_abstime)); + static_cast<const void *>(timeout_abstime)); nub_state_t state = GetState(); if (::kill(ProcessID(), signal) == 0) { // If we were running and we have a timeout, wait for the signal to stop if (IsRunning(state) && timeout_abstime) { - DNBLogThreadedIf(LOG_PROCESS, "MachProcess::Signal (signal = %d, timeout " - "= %p) waiting for signal to stop " - "process...", - signal, reinterpret_cast<const void *>(timeout_abstime)); + DNBLogThreadedIf(LOG_PROCESS, + "MachProcess::Signal (signal = %d, timeout " + "= %p) waiting for signal to stop " + "process...", + signal, static_cast<const void *>(timeout_abstime)); m_private_events.WaitForSetEvents(eEventProcessStoppedStateChanged, timeout_abstime); state = GetState(); DNBLogThreadedIf( LOG_PROCESS, "MachProcess::Signal (signal = %d, timeout = %p) state = %s", signal, - reinterpret_cast<const void *>(timeout_abstime), - DNBStateAsString(state)); + static_cast<const void *>(timeout_abstime), DNBStateAsString(state)); return !IsRunning(state); } DNBLogThreadedIf( LOG_PROCESS, "MachProcess::Signal (signal = %d, timeout = %p) not waiting...", - signal, reinterpret_cast<const void *>(timeout_abstime)); + signal, static_cast<const void *>(timeout_abstime)); return true; } DNBError err(errno, DNBError::POSIX); @@ -1739,10 +1739,10 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary *options, bp = m_breakpoints.Add(addr, length, hardware); if (EnableBreakpoint(addr)) { - DNBLogThreadedIf(LOG_BREAKPOINTS, "MachProcess::CreateBreakpoint ( addr = " - "0x%8.8llx, length = %llu) => %p", - (uint64_t)addr, (uint64_t)length, - reinterpret_cast<void *>(bp)); + DNBLogThreadedIf(LOG_BREAKPOINTS, + "MachProcess::CreateBreakpoint ( addr = " + "0x%8.8llx, length = %llu) => %p", + (uint64_t)addr, (uint64_t)length, static_cast<void *>(bp)); return bp; } else if (bp->Release() == 0) { m_breakpoints.Remove(addr); @@ -1771,10 +1771,10 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary *options, wp->SetIsWatchpoint(watch_flags); if (EnableWatchpoint(addr)) { - DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = " - "0x%8.8llx, length = %llu) => %p", - (uint64_t)addr, (uint64_t)length, - reinterpret_cast<void *>(wp)); + DNBLogThreadedIf(LOG_WATCHPOINTS, + "MachProcess::CreateWatchpoint ( addr = " + "0x%8.8llx, length = %llu) => %p", + (uint64_t)addr, (uint64_t)length, static_cast<void *>(wp)); return wp; } else { DNBLogThreadedIf(LOG_WATCHPOINTS, "MachProcess::CreateWatchpoint ( addr = " @@ -2303,7 +2303,7 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary *options, size_t MachProcess::GetAvailableSTDOUT(char *buf, size_t buf_size) { DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s (&%p[%llu]) ...", __FUNCTION__, - reinterpret_cast<void *>(buf), (uint64_t)buf_size); + static_cast<void *>(buf), (uint64_t)buf_size); PTHREAD_MUTEX_LOCKER(locker, m_stdio_mutex); size_t bytes_available = m_stdout_data.size(); if (bytes_available > 0) { @@ -2463,7 +2463,7 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary *options, size_t MachProcess::GetAsyncProfileData(char *buf, size_t buf_size) { DNBLogThreadedIf(LOG_PROCESS, "MachProcess::%s (&%p[%llu]) ...", __FUNCTION__, - reinterpret_cast<void *>(buf), (uint64_t)buf_size); + static_cast<void *>(buf), (uint64_t)buf_size); PTHREAD_MUTEX_LOCKER(locker, m_profile_data_mutex); if (m_profile_data.empty()) return 0; @@ -2995,8 +2995,8 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary *options, DNBLogThreadedIf(LOG_PROCESS, "%s( path = '%s', argv = %p, envp = %p, " "launch_flavor = %u, disable_aslr = %d )", - __FUNCTION__, path, reinterpret_cast<const void *>(argv), - reinterpret_cast<const void *>(envp), launch_flavor, + __FUNCTION__, path, static_cast<const void *>(argv), + static_cast<const void *>(envp), launch_flavor, disable_aslr); // Fork a child process for debugging @@ -3138,11 +3138,12 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary *options, MachProcess *process, int disable_aslr, DNBError &err) { posix_spawnattr_t attr; short flags; - DNBLogThreadedIf(LOG_PROCESS, "%s ( path='%s', argv=%p, envp=%p, " - "working_dir=%s, stdin=%s, stdout=%s " - "stderr=%s, no-stdio=%i)", - __FUNCTION__, path, reinterpret_cast<const void *>(argv), - reinterpret_cast<const void *>(envp), working_directory, + DNBLogThreadedIf(LOG_PROCESS, + "%s ( path='%s', argv=%p, envp=%p, " + "working_dir=%s, stdin=%s, stdout=%s " + "stderr=%s, no-stdio=%i)", + __FUNCTION__, path, static_cast<const void *>(argv), + static_cast<const void *>(envp), working_directory, stdin_path, stdout_path, stderr_path, no_stdio); err.SetError(::posix_spawnattr_init(&attr), DNBError::POSIX); diff --git a/lldb/tools/debugserver/source/MacOSX/MachThread.cpp b/lldb/tools/debugserver/source/MacOSX/MachThread.cpp index b51ea6949229..80d6042caa59 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachThread.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachThread.cpp @@ -49,7 +49,7 @@ MachThread::MachThread(MachProcess *process, bool is_64_bit, DNBLogThreadedIf(LOG_THREAD | LOG_VERBOSE, "MachThread::MachThread ( process = %p, tid = 0x%8.8" PRIx64 ", seq_id = %u )", - reinterpret_cast<void *>(&m_process), m_unique_id, m_seq_id); + static_cast<void *>(&m_process), m_unique_id, m_seq_id); } MachThread::~MachThread() { _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits