diff options
author | David Spickett <david.spickett@linaro.org> | 2021-06-17 12:32:23 +0100 |
---|---|---|
committer | David Spickett <david.spickett@linaro.org> | 2021-06-17 14:39:35 +0100 |
commit | eaf60a4411f79a1addfa6c5d8ddf4b47e082881e (patch) | |
tree | 8ea76ea64b562f4386e0ce802a430a1292f5da89 /lldb/source/Commands/CommandObjectMemory.cpp | |
parent | 3f596842e3d25009c4d62c75e5b24b515bde8e93 (diff) | |
download | llvm-eaf60a4411f79a1addfa6c5d8ddf4b47e082881e.zip llvm-eaf60a4411f79a1addfa6c5d8ddf4b47e082881e.tar.gz llvm-eaf60a4411f79a1addfa6c5d8ddf4b47e082881e.tar.bz2 |
[lldb] Remove redundant calls to set eReturnStatusFailed
This is part 2, covering the commands source.
Some uses remain where it's tricky to see what the
logic is or they are not used with AppendError.
Reviewed By: teemperor
Differential Revision: https://reviews.llvm.org/D104448
Diffstat (limited to 'lldb/source/Commands/CommandObjectMemory.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectMemory.cpp | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index e6decf1..5c1bbc2 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -358,7 +358,6 @@ protected: m_cmd_name.c_str()); result.AppendWarning("Expressions should be quoted if they contain " "spaces or other special characters."); - result.SetStatus(eReturnStatusFailed); return false; } @@ -439,7 +438,6 @@ protected: } else { result.AppendErrorWithFormat("invalid type string: '%s'\n", view_as_type_cstr); - result.SetStatus(eReturnStatusFailed); return false; } break; @@ -489,7 +487,6 @@ protected: "Mutiple types found matching raw type '%s', please disambiguate " "by specifying the language with -x", lookup_type_name.GetCString()); - result.SetStatus(eReturnStatusFailed); return false; } @@ -504,7 +501,6 @@ protected: "the raw type '%s' for full type '%s'\n", lookup_type_name.GetCString(), view_as_type_cstr); - result.SetStatus(eReturnStatusFailed); return false; } else { TypeSP type_sp(type_list.GetTypeAtIndex(0)); @@ -518,7 +514,6 @@ protected: compiler_type = pointer_type; else { result.AppendError("unable make a pointer type\n"); - result.SetStatus(eReturnStatusFailed); return false; } --pointer_count; @@ -529,7 +524,6 @@ protected: result.AppendErrorWithFormat( "unable to get the byte size of the type '%s'\n", view_as_type_cstr); - result.SetStatus(eReturnStatusFailed); return false; } m_format_options.GetByteSizeValue() = *size; @@ -543,7 +537,6 @@ protected: // Look for invalid combinations of settings if (error.Fail()) { result.AppendError(error.AsCString()); - result.SetStatus(eReturnStatusFailed); return false; } @@ -593,7 +586,6 @@ protected: if (addr == LLDB_INVALID_ADDRESS) { result.AppendError("invalid start address expression."); result.AppendError(error.AsCString()); - result.SetStatus(eReturnStatusFailed); return false; } @@ -603,21 +595,18 @@ protected: if (end_addr == LLDB_INVALID_ADDRESS) { result.AppendError("invalid end address expression."); result.AppendError(error.AsCString()); - result.SetStatus(eReturnStatusFailed); return false; } else if (end_addr <= addr) { result.AppendErrorWithFormat( "end address (0x%" PRIx64 ") must be greater than the start address (0x%" PRIx64 ").\n", end_addr, addr); - result.SetStatus(eReturnStatusFailed); return false; } else if (m_format_options.GetCountValue().OptionWasSet()) { result.AppendErrorWithFormat( "specify either the end address (0x%" PRIx64 ") or the count (--count %" PRIu64 "), not both.\n", end_addr, (uint64_t)item_count); - result.SetStatus(eReturnStatusFailed); return false; } @@ -664,7 +653,6 @@ protected: "can't allocate 0x%" PRIx32 " bytes for the memory read buffer, specify a smaller size to read", (uint32_t)total_byte_size); - result.SetStatus(eReturnStatusFailed); return false; } @@ -679,7 +667,6 @@ protected: result.AppendErrorWithFormat( "failed to read memory from 0x%" PRIx64 ".\n", addr); } - result.SetStatus(eReturnStatusFailed); return false; } @@ -706,7 +693,6 @@ protected: "can't allocate 0x%" PRIx64 " bytes for the memory read buffer, specify a smaller size to read", (uint64_t)((item_byte_size + 1) * item_count)); - result.SetStatus(eReturnStatusFailed); return false; } uint8_t *data_ptr = data_sp->GetBytes(); @@ -723,7 +709,6 @@ protected: if (error.Fail()) { result.AppendErrorWithFormat( "failed to read memory from 0x%" PRIx64 ".\n", addr); - result.SetStatus(eReturnStatusFailed); return false; } @@ -790,7 +775,6 @@ protected: result.AppendErrorWithFormat("Failed to write %" PRIu64 " bytes to '%s'.\n", (uint64_t)bytes_read, path.c_str()); - result.SetStatus(eReturnStatusFailed); return false; } } else { @@ -804,7 +788,6 @@ protected: path.c_str(), append ? "append" : "write"); result.AppendError(llvm::toString(outfile.takeError())); - result.SetStatus(eReturnStatusFailed); return false; } } else { @@ -833,7 +816,6 @@ protected: result.AppendErrorWithFormat( "failed to create a value object for: (%s) %s\n", view_as_type_cstr, name_strm.GetData()); - result.SetStatus(eReturnStatusFailed); return false; } } @@ -863,7 +845,6 @@ protected: result.AppendErrorWithFormat( "reading memory as characters of size %" PRIu64 " is not supported", (uint64_t)item_byte_size); - result.SetStatus(eReturnStatusFailed); return false; } } @@ -1294,14 +1275,12 @@ protected: result.AppendErrorWithFormat( "%s takes a destination address when writing file contents.\n", m_cmd_name.c_str()); - result.SetStatus(eReturnStatusFailed); return false; } } else if (argc < 2) { result.AppendErrorWithFormat( "%s takes a destination address and at least one value.\n", m_cmd_name.c_str()); - result.SetStatus(eReturnStatusFailed); return false; } @@ -1320,7 +1299,6 @@ protected: if (addr == LLDB_INVALID_ADDRESS) { result.AppendError("invalid address expression\n"); result.AppendError(error.AsCString()); - result.SetStatus(eReturnStatusFailed); return false; } @@ -1355,12 +1333,10 @@ protected: result.AppendErrorWithFormat("Memory write to 0x%" PRIx64 " failed: %s.\n", addr, error.AsCString()); - result.SetStatus(eReturnStatusFailed); } } } else { result.AppendErrorWithFormat("Unable to read contents of file.\n"); - result.SetStatus(eReturnStatusFailed); } return result.Succeeded(); } else if (item_byte_size == 0) { @@ -1405,7 +1381,6 @@ protected: case eFormatInstruction: case eFormatVoid: result.AppendError("unsupported format for writing memory"); - result.SetStatus(eReturnStatusFailed); return false; case eFormatDefault: @@ -1424,14 +1399,12 @@ protected: if (!success) { result.AppendErrorWithFormat( "'%s' is not a valid hex string value.\n", entry.c_str()); - result.SetStatus(eReturnStatusFailed); return false; } else if (!llvm::isUIntN(item_byte_size * 8, uval64)) { result.AppendErrorWithFormat("Value 0x%" PRIx64 " is too large to fit in a %" PRIu64 " byte unsigned integer value.\n", uval64, (uint64_t)item_byte_size); - result.SetStatus(eReturnStatusFailed); return false; } buffer.PutMaxHex64(uval64, item_byte_size); @@ -1442,7 +1415,6 @@ protected: if (!success) { result.AppendErrorWithFormat( "'%s' is not a valid boolean string value.\n", entry.c_str()); - result.SetStatus(eReturnStatusFailed); return false; } buffer.PutMaxHex64(uval64, item_byte_size); @@ -1452,14 +1424,12 @@ protected: if (entry.ref().getAsInteger(2, uval64)) { result.AppendErrorWithFormat( "'%s' is not a valid binary string value.\n", entry.c_str()); - result.SetStatus(eReturnStatusFailed); return false; } else if (!llvm::isUIntN(item_byte_size * 8, uval64)) { result.AppendErrorWithFormat("Value 0x%" PRIx64 " is too large to fit in a %" PRIu64 " byte unsigned integer value.\n", uval64, (uint64_t)item_byte_size); - result.SetStatus(eReturnStatusFailed); return false; } buffer.PutMaxHex64(uval64, item_byte_size); @@ -1482,7 +1452,6 @@ protected: result.AppendErrorWithFormat("Memory write to 0x%" PRIx64 " failed: %s.\n", addr, error.AsCString()); - result.SetStatus(eReturnStatusFailed); return false; } break; @@ -1491,14 +1460,12 @@ protected: if (entry.ref().getAsInteger(0, sval64)) { result.AppendErrorWithFormat( "'%s' is not a valid signed decimal value.\n", entry.c_str()); - result.SetStatus(eReturnStatusFailed); return false; } else if (!llvm::isIntN(item_byte_size * 8, sval64)) { result.AppendErrorWithFormat( "Value %" PRIi64 " is too large or small to fit in a %" PRIu64 " byte signed integer value.\n", sval64, (uint64_t)item_byte_size); - result.SetStatus(eReturnStatusFailed); return false; } buffer.PutMaxHex64(sval64, item_byte_size); @@ -1510,14 +1477,12 @@ protected: result.AppendErrorWithFormat( "'%s' is not a valid unsigned decimal string value.\n", entry.c_str()); - result.SetStatus(eReturnStatusFailed); return false; } else if (!llvm::isUIntN(item_byte_size * 8, uval64)) { result.AppendErrorWithFormat("Value %" PRIu64 " is too large to fit in a %" PRIu64 " byte unsigned integer value.\n", uval64, (uint64_t)item_byte_size); - result.SetStatus(eReturnStatusFailed); return false; } buffer.PutMaxHex64(uval64, item_byte_size); @@ -1527,14 +1492,12 @@ protected: if (entry.ref().getAsInteger(8, uval64)) { result.AppendErrorWithFormat( "'%s' is not a valid octal string value.\n", entry.c_str()); - result.SetStatus(eReturnStatusFailed); return false; } else if (!llvm::isUIntN(item_byte_size * 8, uval64)) { result.AppendErrorWithFormat("Value %" PRIo64 " is too large to fit in a %" PRIu64 " byte unsigned integer value.\n", uval64, (uint64_t)item_byte_size); - result.SetStatus(eReturnStatusFailed); return false; } buffer.PutMaxHex64(uval64, item_byte_size); @@ -1552,7 +1515,6 @@ protected: result.AppendErrorWithFormat("Memory write to 0x%" PRIx64 " failed: %s.\n", addr, error.AsCString()); - result.SetStatus(eReturnStatusFailed); return false; } } @@ -1605,7 +1567,6 @@ protected: if (argc == 0 || argc > 1) { result.AppendErrorWithFormat("%s takes an address expression", m_cmd_name.c_str()); - result.SetStatus(eReturnStatusFailed); return false; } @@ -1616,7 +1577,6 @@ protected: if (addr == LLDB_INVALID_ADDRESS) { result.AppendError("invalid address expression"); result.AppendError(error.AsCString()); - result.SetStatus(eReturnStatusFailed); return false; } @@ -1628,7 +1588,6 @@ protected: if (!memory_history) { result.AppendError("no available memory history provider"); - result.SetStatus(eReturnStatusFailed); return false; } @@ -1667,7 +1626,6 @@ protected: if (!process_sp) { m_prev_end_addr = LLDB_INVALID_ADDRESS; result.AppendError("invalid process"); - result.SetStatus(eReturnStatusFailed); return false; } @@ -1679,7 +1637,6 @@ protected: if (argc > 1 || (argc == 0 && load_addr == LLDB_INVALID_ADDRESS)) { result.AppendErrorWithFormat("'%s' takes one argument:\nUsage: %s\n", m_cmd_name.c_str(), m_cmd_syntax.c_str()); - result.SetStatus(eReturnStatusFailed); return false; } @@ -1690,7 +1647,6 @@ protected: if (error.Fail() || load_addr == LLDB_INVALID_ADDRESS) { result.AppendErrorWithFormat("invalid address argument \"%s\": %s\n", command[0].c_str(), error.AsCString()); - result.SetStatus(eReturnStatusFailed); return false; } } @@ -1727,7 +1683,6 @@ protected: return true; } - result.SetStatus(eReturnStatusFailed); result.AppendErrorWithFormat("%s\n", error.AsCString()); return false; } |