mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-05 07:32:36 +00:00
Remove null checks of results of new expressions
operator new doesn't return a null pointer, even if one turns off exceptions (it calls std::terminate instead). Therefore, all of this is dead code. llvm-svn: 364744
This commit is contained in:
parent
ed13fef477
commit
0f73709cb7
@ -246,14 +246,12 @@ size_t ObjectFileJIT::ReadSectionData(
|
||||
if (section->GetFileSize()) {
|
||||
const void *src = (void *)(uintptr_t)section->GetFileOffset();
|
||||
|
||||
DataBufferSP data_sp(
|
||||
new lldb_private::DataBufferHeap(src, section->GetFileSize()));
|
||||
if (data_sp) {
|
||||
section_data.SetData(data_sp, 0, data_sp->GetByteSize());
|
||||
section_data.SetByteOrder(GetByteOrder());
|
||||
section_data.SetAddressByteSize(GetAddressByteSize());
|
||||
return section_data.GetByteSize();
|
||||
}
|
||||
DataBufferSP data_sp =
|
||||
std::make_shared<DataBufferHeap>(src, section->GetFileSize());
|
||||
section_data.SetData(data_sp, 0, data_sp->GetByteSize());
|
||||
section_data.SetByteOrder(GetByteOrder());
|
||||
section_data.SetAddressByteSize(GetAddressByteSize());
|
||||
return section_data.GetByteSize();
|
||||
}
|
||||
section_data.Clear();
|
||||
return 0;
|
||||
|
@ -155,7 +155,7 @@ bool RegisterContextPOSIXProcessMonitor_arm::ReadAllRegisterValues(
|
||||
DataBufferSP &data_sp) {
|
||||
bool success = false;
|
||||
data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0));
|
||||
if (data_sp && ReadGPR() && ReadFPR()) {
|
||||
if (ReadGPR() && ReadFPR()) {
|
||||
uint8_t *dst = data_sp->GetBytes();
|
||||
success = dst != 0;
|
||||
|
||||
|
@ -164,7 +164,7 @@ bool RegisterContextPOSIXProcessMonitor_arm64::ReadAllRegisterValues(
|
||||
lldb::DataBufferSP &data_sp) {
|
||||
bool success = false;
|
||||
data_sp.reset(new lldb_private::DataBufferHeap(REG_CONTEXT_SIZE, 0));
|
||||
if (data_sp && ReadGPR() && ReadFPR()) {
|
||||
if (ReadGPR() && ReadFPR()) {
|
||||
uint8_t *dst = data_sp->GetBytes();
|
||||
success = dst != 0;
|
||||
|
||||
|
@ -160,7 +160,7 @@ bool RegisterContextPOSIXProcessMonitor_mips64::ReadAllRegisterValues(
|
||||
DataBufferSP &data_sp) {
|
||||
bool success = false;
|
||||
data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0));
|
||||
if (data_sp && ReadGPR() && ReadFPR()) {
|
||||
if (ReadGPR() && ReadFPR()) {
|
||||
uint8_t *dst = data_sp->GetBytes();
|
||||
success = dst != 0;
|
||||
|
||||
|
@ -170,7 +170,7 @@ bool RegisterContextPOSIXProcessMonitor_powerpc::ReadAllRegisterValues(
|
||||
DataBufferSP &data_sp) {
|
||||
bool success = false;
|
||||
data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0));
|
||||
if (data_sp && ReadGPR() && ReadFPR()) {
|
||||
if (ReadGPR() && ReadFPR()) {
|
||||
uint8_t *dst = data_sp->GetBytes();
|
||||
success = dst != 0;
|
||||
|
||||
|
@ -344,7 +344,7 @@ bool RegisterContextPOSIXProcessMonitor_x86_64::ReadAllRegisterValues(
|
||||
DataBufferSP &data_sp) {
|
||||
bool success = false;
|
||||
data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0));
|
||||
if (data_sp && ReadGPR() && ReadFPR()) {
|
||||
if (ReadGPR() && ReadFPR()) {
|
||||
uint8_t *dst = data_sp->GetBytes();
|
||||
success = dst != 0;
|
||||
|
||||
|
@ -276,10 +276,6 @@ Status NativeRegisterContextLinux_arm::ReadAllRegisterValues(
|
||||
Status error;
|
||||
|
||||
data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0));
|
||||
if (!data_sp)
|
||||
return Status("failed to allocate DataBufferHeap instance of size %" PRIu64,
|
||||
(uint64_t)REG_CONTEXT_SIZE);
|
||||
|
||||
error = ReadGPR();
|
||||
if (error.Fail())
|
||||
return error;
|
||||
|
@ -277,10 +277,6 @@ Status NativeRegisterContextLinux_arm64::ReadAllRegisterValues(
|
||||
Status error;
|
||||
|
||||
data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0));
|
||||
if (!data_sp)
|
||||
return Status("failed to allocate DataBufferHeap instance of size %" PRIu64,
|
||||
REG_CONTEXT_SIZE);
|
||||
|
||||
error = ReadGPR();
|
||||
if (error.Fail())
|
||||
return error;
|
||||
|
@ -381,13 +381,6 @@ Status NativeRegisterContextLinux_mips64::ReadAllRegisterValues(
|
||||
Status error;
|
||||
|
||||
data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0));
|
||||
if (!data_sp) {
|
||||
error.SetErrorStringWithFormat(
|
||||
"failed to allocate DataBufferHeap instance of size %" PRIu64,
|
||||
REG_CONTEXT_SIZE);
|
||||
return error;
|
||||
}
|
||||
|
||||
error = ReadGPR();
|
||||
if (!error.Success()) {
|
||||
error.SetErrorString("ReadGPR() failed");
|
||||
|
@ -354,10 +354,6 @@ Status NativeRegisterContextLinux_ppc64le::ReadAllRegisterValues(
|
||||
Status error;
|
||||
|
||||
data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0));
|
||||
if (!data_sp)
|
||||
return Status("failed to allocate DataBufferHeap instance of size %" PRIu64,
|
||||
REG_CONTEXT_SIZE);
|
||||
|
||||
error = ReadGPR();
|
||||
if (error.Fail())
|
||||
return error;
|
||||
|
@ -336,13 +336,6 @@ Status NativeRegisterContextLinux_s390x::ReadAllRegisterValues(
|
||||
Status error;
|
||||
|
||||
data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0));
|
||||
if (!data_sp) {
|
||||
error.SetErrorStringWithFormat(
|
||||
"failed to allocate DataBufferHeap instance of size %" PRIu64,
|
||||
REG_CONTEXT_SIZE);
|
||||
return error;
|
||||
}
|
||||
|
||||
uint8_t *dst = data_sp->GetBytes();
|
||||
if (dst == nullptr) {
|
||||
error.SetErrorStringWithFormat("DataBufferHeap instance of size %" PRIu64
|
||||
|
@ -572,13 +572,6 @@ Status NativeRegisterContextNetBSD_x86_64::ReadAllRegisterValues(
|
||||
Status error;
|
||||
|
||||
data_sp.reset(new DataBufferHeap(REG_CONTEXT_SIZE, 0));
|
||||
if (!data_sp) {
|
||||
error.SetErrorStringWithFormat(
|
||||
"failed to allocate DataBufferHeap instance of size %" PRIu64,
|
||||
REG_CONTEXT_SIZE);
|
||||
return error;
|
||||
}
|
||||
|
||||
error = ReadRegisterSet(GPRegSet);
|
||||
if (error.Fail())
|
||||
return error;
|
||||
|
@ -646,8 +646,8 @@ bool RegisterContextDarwin_arm64::WriteRegister(const RegisterInfo *reg_info,
|
||||
bool RegisterContextDarwin_arm64::ReadAllRegisterValues(
|
||||
lldb::DataBufferSP &data_sp) {
|
||||
data_sp = std::make_shared<DataBufferHeap>(REG_CONTEXT_SIZE, 0);
|
||||
if (data_sp && ReadGPR(false) == KERN_SUCCESS &&
|
||||
ReadFPU(false) == KERN_SUCCESS && ReadEXC(false) == KERN_SUCCESS) {
|
||||
if (ReadGPR(false) == KERN_SUCCESS && ReadFPU(false) == KERN_SUCCESS &&
|
||||
ReadEXC(false) == KERN_SUCCESS) {
|
||||
uint8_t *dst = data_sp->GetBytes();
|
||||
::memcpy(dst, &gpr, sizeof(gpr));
|
||||
dst += sizeof(gpr);
|
||||
|
@ -830,8 +830,7 @@ bool RegisterContextDarwin_i386::WriteRegister(const RegisterInfo *reg_info,
|
||||
bool RegisterContextDarwin_i386::ReadAllRegisterValues(
|
||||
lldb::DataBufferSP &data_sp) {
|
||||
data_sp = std::make_shared<DataBufferHeap>(REG_CONTEXT_SIZE, 0);
|
||||
if (data_sp && ReadGPR(false) == 0 && ReadFPU(false) == 0 &&
|
||||
ReadEXC(false) == 0) {
|
||||
if (ReadGPR(false) == 0 && ReadFPU(false) == 0 && ReadEXC(false) == 0) {
|
||||
uint8_t *dst = data_sp->GetBytes();
|
||||
::memcpy(dst, &gpr, sizeof(gpr));
|
||||
dst += sizeof(gpr);
|
||||
|
@ -910,8 +910,7 @@ bool RegisterContextDarwin_x86_64::WriteRegister(const RegisterInfo *reg_info,
|
||||
bool RegisterContextDarwin_x86_64::ReadAllRegisterValues(
|
||||
lldb::DataBufferSP &data_sp) {
|
||||
data_sp = std::make_shared<DataBufferHeap>(REG_CONTEXT_SIZE, 0);
|
||||
if (data_sp && ReadGPR(false) == 0 && ReadFPU(false) == 0 &&
|
||||
ReadEXC(false) == 0) {
|
||||
if (ReadGPR(false) == 0 && ReadFPU(false) == 0 && ReadEXC(false) == 0) {
|
||||
uint8_t *dst = data_sp->GetBytes();
|
||||
::memcpy(dst, &gpr, sizeof(gpr));
|
||||
dst += sizeof(gpr);
|
||||
|
Loading…
Reference in New Issue
Block a user