diff options
author | Zachary Turner <zturner@google.com> | 2016-11-12 16:56:47 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2016-11-12 16:56:47 +0000 |
commit | fe11483b57c1dc6a6758725e6de0d6804ec59ed1 (patch) | |
tree | af50255449e1a57e1a528735cfa3458a5e9e66d2 /lldb/source/Commands/CommandObjectSource.cpp | |
parent | c351fb16079ae8c88e868960829107a823a86246 (diff) | |
download | llvm-fe11483b57c1dc6a6758725e6de0d6804ec59ed1.zip llvm-fe11483b57c1dc6a6758725e6de0d6804ec59ed1.tar.gz llvm-fe11483b57c1dc6a6758725e6de0d6804ec59ed1.tar.bz2 |
Make Options::SetOptionValue take a StringRef.
llvm-svn: 286723
Diffstat (limited to 'lldb/source/Commands/CommandObjectSource.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectSource.cpp | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp index 6f1a50d..e44ef6d 100644 --- a/lldb/source/Commands/CommandObjectSource.cpp +++ b/lldb/source/Commands/CommandObjectSource.cpp @@ -59,30 +59,27 @@ class CommandObjectSourceInfo : public CommandObjectParsed { ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, const char *option_arg, + Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override { Error error; const int short_option = GetDefinitions()[option_idx].short_option; switch (short_option) { case 'l': - start_line = StringConvert::ToUInt32(option_arg, 0); - if (start_line == 0) + if (option_arg.getAsInteger(0, start_line)) error.SetErrorStringWithFormat("invalid line number: '%s'", - option_arg); + option_arg.str().c_str()); break; case 'e': - end_line = StringConvert::ToUInt32(option_arg, 0); - if (end_line == 0) + if (option_arg.getAsInteger(0, end_line)) error.SetErrorStringWithFormat("invalid line number: '%s'", - option_arg); + option_arg.str().c_str()); break; case 'c': - num_lines = StringConvert::ToUInt32(option_arg, 0); - if (num_lines == 0) + if (option_arg.getAsInteger(0, num_lines)) error.SetErrorStringWithFormat("invalid line count: '%s'", - option_arg); + option_arg.str().c_str()); break; case 'f': @@ -686,23 +683,21 @@ class CommandObjectSourceList : public CommandObjectParsed { ~CommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, const char *option_arg, + Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override { Error error; const int short_option = GetDefinitions()[option_idx].short_option; switch (short_option) { case 'l': - start_line = StringConvert::ToUInt32(option_arg, 0); - if (start_line == 0) + if (option_arg.getAsInteger(0, start_line)) error.SetErrorStringWithFormat("invalid line number: '%s'", - option_arg); + option_arg.str().c_str()); break; case 'c': - num_lines = StringConvert::ToUInt32(option_arg, 0); - if (num_lines == 0) + if (option_arg.getAsInteger(0, num_lines)) error.SetErrorStringWithFormat("invalid line count: '%s'", - option_arg); + option_arg.str().c_str()); break; case 'f': |