forked from OSchip/llvm-project
Silence -Wqual-cast warnings from GCC 5.2
There were a number of const qualifiers being cast away which caused warnings. This cluttered the output hiding real errors. Silence them by explicit casting. NFC. llvm-svn: 250662
This commit is contained in:
parent
8b8d2a4d99
commit
ba507b04e1
|
@ -434,7 +434,7 @@ namespace lldb_private {
|
|||
{}
|
||||
|
||||
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)
|
||||
{}
|
||||
|
|
|
@ -536,7 +536,8 @@ protected:
|
|||
|
||||
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())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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__)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue