aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectSource.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-12-09 05:46:41 +0000
committerZachary Turner <zturner@google.com>2016-12-09 05:46:41 +0000
commit2c84f908afc851a1ba83c6a8471a62db81475ef8 (patch)
treed51372b98dfbb090aafdab5dc233b32f790981d3 /lldb/source/Commands/CommandObjectSource.cpp
parent8db7e5e4eed4c4e697dc3164f2c9351d8c3e942b (diff)
downloadllvm-2c84f908afc851a1ba83c6a8471a62db81475ef8.zip
llvm-2c84f908afc851a1ba83c6a8471a62db81475ef8.tar.gz
llvm-2c84f908afc851a1ba83c6a8471a62db81475ef8.tar.bz2
Remove some more uses of Args::GetArgumentAtIndex.
llvm-svn: 289188
Diffstat (limited to 'lldb/source/Commands/CommandObjectSource.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectSource.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp
index e44ef6d..6ff3208 100644
--- a/lldb/source/Commands/CommandObjectSource.cpp
+++ b/lldb/source/Commands/CommandObjectSource.cpp
@@ -774,24 +774,20 @@ public:
const char *GetRepeatCommand(Args &current_command_args,
uint32_t index) override {
// This is kind of gross, but the command hasn't been parsed yet so we can't
- // look at the option
- // values for this invocation... I have to scan the arguments directly.
- size_t num_args = current_command_args.GetArgumentCount();
- bool is_reverse = false;
- for (size_t i = 0; i < num_args; i++) {
- const char *arg = current_command_args.GetArgumentAtIndex(i);
- if (arg && (strcmp(arg, "-r") == 0 || strcmp(arg, "--reverse") == 0)) {
- is_reverse = true;
- }
- }
- if (is_reverse) {
- if (m_reverse_name.empty()) {
- m_reverse_name = m_cmd_name;
- m_reverse_name.append(" -r");
- }
- return m_reverse_name.c_str();
- } else
+ // look at the option values for this invocation... I have to scan the
+ // arguments directly.
+ auto iter =
+ llvm::find_if(current_command_args, [](const Args::ArgEntry &e) {
+ return e.ref == "-r" || e.ref == "--reverse";
+ });
+ if (iter == current_command_args.end())
return m_cmd_name.c_str();
+
+ if (m_reverse_name.empty()) {
+ m_reverse_name = m_cmd_name;
+ m_reverse_name.append(" -r");
+ }
+ return m_reverse_name.c_str();
}
protected: