diff options
-rw-r--r-- | lldb/include/lldb/DataFormatters/StringPrinter.h | 6 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectMemory.cpp | 9 | ||||
-rw-r--r-- | lldb/source/Core/DataExtractor.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Core/Scalar.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Core/StreamString.cpp | 2 | ||||
-rw-r--r-- | lldb/source/DataFormatters/StringPrinter.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Host/common/Host.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Interpreter/Args.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp | 9 | ||||
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp | 3 | ||||
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Symbol/CompilerType.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Symbol/Type.cpp | 2 |
13 files changed, 33 insertions, 28 deletions
diff --git a/lldb/include/lldb/DataFormatters/StringPrinter.h b/lldb/include/lldb/DataFormatters/StringPrinter.h index f11156d1d8d..295f3d4abb8 100644 --- a/lldb/include/lldb/DataFormatters/StringPrinter.h +++ b/lldb/include/lldb/DataFormatters/StringPrinter.h @@ -432,13 +432,13 @@ namespace lldb_private { m_size(size), m_deleter(deleter) {} - + StringPrinterBufferPointer(const U* bytes, S size, Deleter deleter = nullptr) : - m_data((T*)bytes), + m_data(reinterpret_cast<const T*>(bytes)), m_size(size), m_deleter(deleter) {} - + StringPrinterBufferPointer(StringPrinterBufferPointer&& rhs) : m_data(rhs.m_data), m_size(rhs.m_size), diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index 35e65514abc..f91a6be6d79 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -527,20 +527,21 @@ protected: 1, type_list); } - + if (type_list.GetSize() == 0 && lookup_type_name.GetCString() && *lookup_type_name.GetCString() == '$') { if (ClangPersistentVariables *persistent_vars = llvm::dyn_cast_or_null<ClangPersistentVariables>(target->GetPersistentExpressionStateForLanguage(lldb::eLanguageTypeC))) { clang::TypeDecl *tdecl = persistent_vars->GetPersistentType(ConstString(lookup_type_name)); - + if (tdecl) { - clang_ast_type.SetCompilerType(ClangASTContext::GetASTContext(&tdecl->getASTContext()),(const lldb::opaque_compiler_type_t)tdecl->getTypeForDecl()); + clang_ast_type.SetCompilerType(ClangASTContext::GetASTContext(&tdecl->getASTContext()), + reinterpret_cast<lldb::opaque_compiler_type_t>(const_cast<clang::Type*>(tdecl->getTypeForDecl()))); } } } - + if (clang_ast_type.IsValid() == false) { if (type_list.GetSize() == 0) diff --git a/lldb/source/Core/DataExtractor.cpp b/lldb/source/Core/DataExtractor.cpp index 9e447983301..a8843767fa5 100644 --- a/lldb/source/Core/DataExtractor.cpp +++ b/lldb/source/Core/DataExtractor.cpp @@ -142,8 +142,8 @@ DataExtractor::DataExtractor () : // The data must stay around as long as this object is valid. //---------------------------------------------------------------------- DataExtractor::DataExtractor (const void* data, offset_t length, ByteOrder endian, uint32_t addr_size, uint32_t target_byte_size/*=1*/) : - m_start ((uint8_t*)data), - m_end ((uint8_t*)data + length), + 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_byte_order(endian), m_addr_size (addr_size), m_data_sp (), @@ -287,7 +287,7 @@ DataExtractor::SetData (const void *bytes, offset_t length, ByteOrder endian) } else { - m_start = (uint8_t *)bytes; + m_start = const_cast<uint8_t *>(reinterpret_cast<const uint8_t *>(bytes)); m_end = m_start + length; } return GetByteSize(); diff --git a/lldb/source/Core/Scalar.cpp b/lldb/source/Core/Scalar.cpp index 879c7eb30c7..e16f74b19ae 100644 --- a/lldb/source/Core/Scalar.cpp +++ b/lldb/source/Core/Scalar.cpp @@ -264,7 +264,7 @@ Scalar::GetBytes() const case e_ulonglong: case e_sint128: case e_uint128: - return (void *)m_integer.getRawData(); + return const_cast<void *>(reinterpret_cast<const void *>(m_integer.getRawData())); case e_float: flt_val = m_float.convertToFloat(); return (void *)&flt_val; @@ -273,7 +273,7 @@ Scalar::GetBytes() const return (void *)&dbl_val; case e_long_double: llvm::APInt ldbl_val = m_float.bitcastToAPInt(); - return (void *)ldbl_val.getRawData(); + return const_cast<void *>(reinterpret_cast<const void *>(ldbl_val.getRawData())); } return NULL; } diff --git a/lldb/source/Core/StreamString.cpp b/lldb/source/Core/StreamString.cpp index ef2b70583eb..36e086b0b43 100644 --- a/lldb/source/Core/StreamString.cpp +++ b/lldb/source/Core/StreamString.cpp @@ -37,7 +37,7 @@ StreamString::Flush () size_t StreamString::Write (const void *s, size_t length) { - m_packet.append ((char *)s, length); + m_packet.append (reinterpret_cast<const char *>(s), length); return length; } diff --git a/lldb/source/DataFormatters/StringPrinter.cpp b/lldb/source/DataFormatters/StringPrinter.cpp index 98a9e1a5398..a63a1fe9221 100644 --- a/lldb/source/DataFormatters/StringPrinter.cpp +++ b/lldb/source/DataFormatters/StringPrinter.cpp @@ -324,8 +324,8 @@ DumpUTFBufferToStream (ConversionResult (*ConvertFunction) (const SourceDataType { // just copy the pointers - the cast is necessary to make the compiler happy // but this should only happen if we are reading UTF8 data - utf8_data_ptr = (UTF8*)data_ptr; - utf8_data_end_ptr = (UTF8*)data_end_ptr; + utf8_data_ptr = const_cast<UTF8 *>(reinterpret_cast<const UTF8*>(data_ptr)); + utf8_data_end_ptr = const_cast<UTF8 *>(reinterpret_cast<const UTF8*>(data_end_ptr)); } const bool escape_non_printables = dump_options.GetEscapeNonPrintables(); diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index c2f07ecf6bb..e89f4def478 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -820,8 +820,8 @@ Host::LaunchProcessPosixSpawn(const char *exe_path, const ProcessLaunchInfo &lau #endif const char *tmp_argv[2]; - char * const *argv = (char * const*)launch_info.GetArguments().GetConstArgumentVector(); - char * const *envp = (char * const*)launch_info.GetEnvironmentEntries().GetConstArgumentVector(); + char * const *argv = const_cast<char * const*>(launch_info.GetArguments().GetConstArgumentVector()); + char * const *envp = const_cast<char * const*>(launch_info.GetEnvironmentEntries().GetConstArgumentVector()); if (argv == NULL) { // posix_spawn gets very unhappy if it doesn't have at least the program @@ -829,7 +829,7 @@ Host::LaunchProcessPosixSpawn(const char *exe_path, const ProcessLaunchInfo &lau // variables don't make it into the child process if "argv == NULL"!!! tmp_argv[0] = exe_path; tmp_argv[1] = NULL; - argv = (char * const*)tmp_argv; + argv = const_cast<char * const*>(tmp_argv); } #if !defined (__APPLE__) diff --git a/lldb/source/Interpreter/Args.cpp b/lldb/source/Interpreter/Args.cpp index d9371fe9fa9..7c9f5c35ecb 100644 --- a/lldb/source/Interpreter/Args.cpp +++ b/lldb/source/Interpreter/Args.cpp @@ -371,7 +371,7 @@ char ** Args::GetArgumentVector() { if (!m_argv.empty()) - return (char **)&m_argv[0]; + return const_cast<char **>(&m_argv[0]); return nullptr; } @@ -379,7 +379,7 @@ const char ** Args::GetConstArgumentVector() const { if (!m_argv.empty()) - return (const char **)&m_argv[0]; + return const_cast<const char **>(&m_argv[0]); return nullptr; } @@ -1387,7 +1387,7 @@ Args::ParseArgsForCompletion int long_options_index = -1; val = OptionParser::Parse (dummy_vec.size() - 1, - (char *const *) &dummy_vec.front(), + const_cast<char *const *>(&dummy_vec.front()), sstr.GetData(), long_options, &long_options_index); diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp index b4f841a16de..cb285c27821 100644 --- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -673,9 +673,12 @@ PlatformPOSIX::ConnectRemote (Args& args) if (m_options.get()) { OptionGroupOptions* options = m_options.get(); - const OptionGroupPlatformRSync* m_rsync_options = (OptionGroupPlatformRSync*)options->GetGroupWithOption('r'); - const OptionGroupPlatformSSH* m_ssh_options = (OptionGroupPlatformSSH*)options->GetGroupWithOption('s'); - const OptionGroupPlatformCaching* m_cache_options = (OptionGroupPlatformCaching*)options->GetGroupWithOption('c'); + const OptionGroupPlatformRSync *m_rsync_options = + static_cast<const OptionGroupPlatformRSync *>(options->GetGroupWithOption('r')); + const OptionGroupPlatformSSH *m_ssh_options = + static_cast<const OptionGroupPlatformSSH *>(options->GetGroupWithOption('s')); + const OptionGroupPlatformCaching *m_cache_options = + static_cast<const OptionGroupPlatformCaching *>(options->GetGroupWithOption('c')); if (m_rsync_options->m_rsync) { diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp index f95c683cbc6..99f01e19032 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -183,7 +183,8 @@ GDBRemoteRegisterContext::ReadRegisterBytes (const RegisterInfo *reg_info, DataE if (!gdb_comm.ReadAllRegisters(m_thread.GetProtocolID(), response)) return false; if (response.IsNormalResponse()) - if (response.GetHexBytes ((void *)m_reg_data.GetDataStart(), m_reg_data.GetByteSize(), '\xcc') == m_reg_data.GetByteSize()) + if (response.GetHexBytes(const_cast<void *>(reinterpret_cast<const void *>(m_reg_data.GetDataStart())), + m_reg_data.GetByteSize(), '\xcc') == m_reg_data.GetByteSize()) SetAllRegisterValid (true); } else if (reg_info->value_regs) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp index 1b7b5d557bc..b9d825489ae 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp @@ -227,7 +227,7 @@ DWARFDebugInfoEntry::Extract bool isCompileUnitTag = m_tag == DW_TAG_compile_unit; if (cu && isCompileUnitTag) - ((DWARFCompileUnit*)cu)->SetBaseAddress(0); + const_cast<DWARFCompileUnit *>(cu)->SetBaseAddress(0); // Skip all data in the .debug_info for the attributes const uint32_t numAttributes = abbrevDecl->NumAttributes(); diff --git a/lldb/source/Symbol/CompilerType.cpp b/lldb/source/Symbol/CompilerType.cpp index e39e97b9ece..84e446b3b93 100644 --- a/lldb/source/Symbol/CompilerType.cpp +++ b/lldb/source/Symbol/CompilerType.cpp @@ -1201,7 +1201,7 @@ CompilerType::ReadFromMemory (lldb_private::ExecutionContext *exe_ctx, data.SetData(data_sp); } - uint8_t* dst = (uint8_t*)data.PeekData(0, byte_size); + uint8_t* dst = const_cast<uint8_t*>(data.PeekData(0, byte_size)); if (dst != nullptr) { if (address_type == eAddressTypeHost) diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp index efd146c1e7b..7e0d3b61ced 100644 --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -445,7 +445,7 @@ Type::ReadFromMemory (ExecutionContext *exe_ctx, lldb::addr_t addr, AddressType data.SetData(data_sp); } - uint8_t* dst = (uint8_t*)data.PeekData(0, byte_size); + uint8_t* dst = const_cast<uint8_t*>(data.PeekData(0, byte_size)); if (dst != nullptr) { if (address_type == eAddressTypeHost) |