summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectMemory.cpp
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2019-09-13 11:26:48 +0000
committerRaphael Isemann <teemperor@gmail.com>2019-09-13 11:26:48 +0000
commit0d9a201e2624998922f825ebbe01aae0cce4bbd5 (patch)
tree3d844315931e3026c40a44de0d2117368e82360d /lldb/source/Commands/CommandObjectMemory.cpp
parent930ebc15a6398710e84eea16b735721fe4a2c2fd (diff)
downloadbcm5719-llvm-0d9a201e2624998922f825ebbe01aae0cce4bbd5.tar.gz
bcm5719-llvm-0d9a201e2624998922f825ebbe01aae0cce4bbd5.zip
[lldb][NFC] Remove ArgEntry::ref member
The StringRef should always be identical to the C string, so we might as well just create the StringRef from the C-string. This might be slightly slower until we implement the storage of ArgEntry with a string instead of a std::unique_ptr<char[]>. Until then we have to do the additional strlen on the C string to construct the StringRef. llvm-svn: 371842
Diffstat (limited to 'lldb/source/Commands/CommandObjectMemory.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectMemory.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index 57ff00f3aa0..1e9c9909f54 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -593,7 +593,7 @@ protected:
}
if (argc > 0)
- addr = OptionArgParser::ToAddress(&m_exe_ctx, command[0].ref,
+ addr = OptionArgParser::ToAddress(&m_exe_ctx, command[0].ref(),
LLDB_INVALID_ADDRESS, &error);
if (addr == LLDB_INVALID_ADDRESS) {
@@ -605,7 +605,7 @@ protected:
if (argc == 2) {
lldb::addr_t end_addr = OptionArgParser::ToAddress(
- &m_exe_ctx, command[1].ref, LLDB_INVALID_ADDRESS, nullptr);
+ &m_exe_ctx, command[1].ref(), LLDB_INVALID_ADDRESS, nullptr);
if (end_addr == LLDB_INVALID_ADDRESS) {
result.AppendError("invalid end address expression.");
result.AppendError(error.AsCString());
@@ -1034,13 +1034,13 @@ protected:
Status error;
lldb::addr_t low_addr = OptionArgParser::ToAddress(
- &m_exe_ctx, command[0].ref, LLDB_INVALID_ADDRESS, &error);
+ &m_exe_ctx, command[0].ref(), LLDB_INVALID_ADDRESS, &error);
if (low_addr == LLDB_INVALID_ADDRESS || error.Fail()) {
result.AppendError("invalid low address");
return false;
}
lldb::addr_t high_addr = OptionArgParser::ToAddress(
- &m_exe_ctx, command[1].ref, LLDB_INVALID_ADDRESS, &error);
+ &m_exe_ctx, command[1].ref(), LLDB_INVALID_ADDRESS, &error);
if (high_addr == LLDB_INVALID_ADDRESS || error.Fail()) {
result.AppendError("invalid high address");
return false;
@@ -1339,7 +1339,7 @@ protected:
Status error;
lldb::addr_t addr = OptionArgParser::ToAddress(
- &m_exe_ctx, command[0].ref, LLDB_INVALID_ADDRESS, &error);
+ &m_exe_ctx, command[0].ref(), LLDB_INVALID_ADDRESS, &error);
if (addr == LLDB_INVALID_ADDRESS) {
result.AppendError("invalid address expression\n");
@@ -1442,10 +1442,10 @@ protected:
// Be careful, getAsInteger with a radix of 16 rejects "0xab" so we
// have to special case that:
bool success = false;
- if (entry.ref.startswith("0x"))
- success = !entry.ref.getAsInteger(0, uval64);
+ if (entry.ref().startswith("0x"))
+ success = !entry.ref().getAsInteger(0, uval64);
if (!success)
- success = !entry.ref.getAsInteger(16, uval64);
+ success = !entry.ref().getAsInteger(16, uval64);
if (!success) {
result.AppendErrorWithFormat(
"'%s' is not a valid hex string value.\n", entry.c_str());
@@ -1463,7 +1463,7 @@ protected:
break;
}
case eFormatBoolean:
- uval64 = OptionArgParser::ToBoolean(entry.ref, false, &success);
+ uval64 = OptionArgParser::ToBoolean(entry.ref(), false, &success);
if (!success) {
result.AppendErrorWithFormat(
"'%s' is not a valid boolean string value.\n", entry.c_str());
@@ -1474,7 +1474,7 @@ protected:
break;
case eFormatBinary:
- if (entry.ref.getAsInteger(2, uval64)) {
+ if (entry.ref().getAsInteger(2, uval64)) {
result.AppendErrorWithFormat(
"'%s' is not a valid binary string value.\n", entry.c_str());
result.SetStatus(eReturnStatusFailed);
@@ -1493,10 +1493,10 @@ protected:
case eFormatCharArray:
case eFormatChar:
case eFormatCString: {
- if (entry.ref.empty())
+ if (entry.ref().empty())
break;
- size_t len = entry.ref.size();
+ size_t len = entry.ref().size();
// Include the NULL for C strings...
if (m_format_options.GetFormat() == eFormatCString)
++len;
@@ -1513,7 +1513,7 @@ protected:
break;
}
case eFormatDecimal:
- if (entry.ref.getAsInteger(0, sval64)) {
+ if (entry.ref().getAsInteger(0, sval64)) {
result.AppendErrorWithFormat(
"'%s' is not a valid signed decimal value.\n", entry.c_str());
result.SetStatus(eReturnStatusFailed);
@@ -1531,7 +1531,7 @@ protected:
case eFormatUnsigned:
- if (!entry.ref.getAsInteger(0, uval64)) {
+ if (!entry.ref().getAsInteger(0, uval64)) {
result.AppendErrorWithFormat(
"'%s' is not a valid unsigned decimal string value.\n",
entry.c_str());
@@ -1549,7 +1549,7 @@ protected:
break;
case eFormatOctal:
- if (entry.ref.getAsInteger(8, uval64)) {
+ if (entry.ref().getAsInteger(8, uval64)) {
result.AppendErrorWithFormat(
"'%s' is not a valid octal string value.\n", entry.c_str());
result.SetStatus(eReturnStatusFailed);
@@ -1635,7 +1635,7 @@ protected:
Status error;
lldb::addr_t addr = OptionArgParser::ToAddress(
- &m_exe_ctx, command[0].ref, LLDB_INVALID_ADDRESS, &error);
+ &m_exe_ctx, command[0].ref(), LLDB_INVALID_ADDRESS, &error);
if (addr == LLDB_INVALID_ADDRESS) {
result.AppendError("invalid address expression");
@@ -1700,7 +1700,7 @@ protected:
result.SetStatus(eReturnStatusFailed);
} else {
if (command.GetArgumentCount() == 1) {
- auto load_addr_str = command[0].ref;
+ auto load_addr_str = command[0].ref();
load_addr = OptionArgParser::ToAddress(&m_exe_ctx, load_addr_str,
LLDB_INVALID_ADDRESS, &error);
if (error.Fail() || load_addr == LLDB_INVALID_ADDRESS) {
OpenPOWER on IntegriCloud