diff options
author | Pavel Labath <labath@google.com> | 2018-04-10 09:03:59 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2018-04-10 09:03:59 +0000 |
commit | 47cbf4a07bdfe8f5ef56be7a0caf003f91a00a9e (patch) | |
tree | 9d619d8e076a6c0a5113264c2b3d96369f85e275 /lldb/source/Commands/CommandObjectMemory.cpp | |
parent | bfa20dddcbf31e05be41c3bd993bf25578bfa179 (diff) | |
download | llvm-47cbf4a07bdfe8f5ef56be7a0caf003f91a00a9e.zip llvm-47cbf4a07bdfe8f5ef56be7a0caf003f91a00a9e.tar.gz llvm-47cbf4a07bdfe8f5ef56be7a0caf003f91a00a9e.tar.bz2 |
Move Args::StringTo*** functions to a new OptionArgParser class
Summary:
The idea behind this is to move the functionality which depend on other lldb
classes into a separate class. This way, the Args class can be turned
into a lightweight arc+argv wrapper and moved into the lower lldb
layers.
Reviewers: jingham, zturner
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D44306
llvm-svn: 329677
Diffstat (limited to 'lldb/source/Commands/CommandObjectMemory.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectMemory.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index 8f4c186..aacb134 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -27,6 +27,7 @@ #include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/OptionGroupFormat.h" #include "lldb/Interpreter/OptionGroupOutputFile.h" #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h" @@ -590,8 +591,8 @@ protected: } if (argc > 0) - addr = Args::StringToAddress(&m_exe_ctx, command[0].ref, - LLDB_INVALID_ADDRESS, &error); + addr = OptionArgParser::ToAddress(&m_exe_ctx, command[0].ref, + LLDB_INVALID_ADDRESS, &error); if (addr == LLDB_INVALID_ADDRESS) { result.AppendError("invalid start address expression."); @@ -601,7 +602,7 @@ protected: } if (argc == 2) { - lldb::addr_t end_addr = Args::StringToAddress( + lldb::addr_t end_addr = OptionArgParser::ToAddress( &m_exe_ctx, command[1].ref, LLDB_INVALID_ADDRESS, nullptr); if (end_addr == LLDB_INVALID_ADDRESS) { result.AppendError("invalid end address expression."); @@ -1036,13 +1037,13 @@ protected: } Status error; - lldb::addr_t low_addr = Args::StringToAddress(&m_exe_ctx, command[0].ref, - LLDB_INVALID_ADDRESS, &error); + lldb::addr_t low_addr = OptionArgParser::ToAddress( + &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 = Args::StringToAddress( + lldb::addr_t high_addr = OptionArgParser::ToAddress( &m_exe_ctx, command[1].ref, LLDB_INVALID_ADDRESS, &error); if (high_addr == LLDB_INVALID_ADDRESS || error.Fail()) { result.AppendError("invalid high address"); @@ -1345,8 +1346,8 @@ protected: size_t item_byte_size = byte_size_value.GetCurrentValue(); Status error; - lldb::addr_t addr = Args::StringToAddress(&m_exe_ctx, command[0].ref, - LLDB_INVALID_ADDRESS, &error); + lldb::addr_t addr = OptionArgParser::ToAddress( + &m_exe_ctx, command[0].ref, LLDB_INVALID_ADDRESS, &error); if (addr == LLDB_INVALID_ADDRESS) { result.AppendError("invalid address expression\n"); @@ -1469,7 +1470,7 @@ protected: break; } case eFormatBoolean: - uval64 = Args::StringToBoolean(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()); @@ -1642,8 +1643,8 @@ protected: } Status error; - lldb::addr_t addr = Args::StringToAddress(&m_exe_ctx, command[0].ref, - LLDB_INVALID_ADDRESS, &error); + lldb::addr_t addr = OptionArgParser::ToAddress( + &m_exe_ctx, command[0].ref, LLDB_INVALID_ADDRESS, &error); if (addr == LLDB_INVALID_ADDRESS) { result.AppendError("invalid address expression"); @@ -1711,8 +1712,8 @@ protected: } else { auto load_addr_str = command[0].ref; if (command.GetArgumentCount() == 1) { - load_addr = Args::StringToAddress(&m_exe_ctx, load_addr_str, - LLDB_INVALID_ADDRESS, &error); + load_addr = OptionArgParser::ToAddress(&m_exe_ctx, load_addr_str, + LLDB_INVALID_ADDRESS, &error); if (error.Fail() || load_addr == LLDB_INVALID_ADDRESS) { result.AppendErrorWithFormat( "invalid address argument \"%s\": %s\n", command[0].c_str(), |