diff options
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Interpreter/Args.cpp')
-rw-r--r-- | contrib/llvm/tools/lldb/source/Interpreter/Args.cpp | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/contrib/llvm/tools/lldb/source/Interpreter/Args.cpp b/contrib/llvm/tools/lldb/source/Interpreter/Args.cpp index 6984328..a23ba30 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/Args.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/Args.cpp @@ -12,18 +12,15 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Stream.h" -#include "lldb/Core/StreamFile.h" -#include "lldb/Core/StreamString.h" #include "lldb/DataFormatters/FormatManager.h" -#include "lldb/Host/StringConvert.h" +#include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/Options.h" -#include "lldb/Target/Process.h" -#include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/StreamString.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringExtras.h" @@ -423,10 +420,10 @@ void Args::SetArguments(const char **argv) { SetArguments(ArgvToArgc(argv), argv); } -Error Args::ParseOptions(Options &options, ExecutionContext *execution_context, - PlatformSP platform_sp, bool require_validation) { +Status Args::ParseOptions(Options &options, ExecutionContext *execution_context, + PlatformSP platform_sp, bool require_validation) { StreamString sstr; - Error error; + Status error; Option *long_options = options.GetLongOptions(); if (long_options == nullptr) { error.SetErrorStringWithFormat("invalid long options"); @@ -550,7 +547,7 @@ void Args::Clear() { lldb::addr_t Args::StringToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s, lldb::addr_t fail_value, - Error *error_ptr) { + Status *error_ptr) { bool error_set = false; if (s.empty()) { if (error_ptr) @@ -632,10 +629,8 @@ lldb::addr_t Args::StringToAddress(const ExecutionContext *exe_ctx, add = str[0] == '+'; if (regex_match.GetMatchAtIndex(s, 3, str)) { - offset = StringConvert::ToUInt64(str.c_str(), 0, 0, &success); - - if (success) { - Error error; + if (!llvm::StringRef(str).getAsInteger(0, offset)) { + Status error; addr = StringToAddress(exe_ctx, name.c_str(), LLDB_INVALID_ADDRESS, &error); if (addr != LLDB_INVALID_ADDRESS) { @@ -779,7 +774,7 @@ const char *Args::GetShellSafeArgument(const FileSpec &shell, int64_t Args::StringToOptionEnum(llvm::StringRef s, OptionEnumValueElement *enum_values, - int32_t fail_value, Error &error) { + int32_t fail_value, Status &error) { error.Clear(); if (!enum_values) { error.SetErrorString("invalid enumeration argument"); @@ -824,10 +819,10 @@ Args::StringToScriptLanguage(llvm::StringRef s, lldb::ScriptLanguage fail_value, return fail_value; } -Error Args::StringToFormat(const char *s, lldb::Format &format, - size_t *byte_size_ptr) { +Status Args::StringToFormat(const char *s, lldb::Format &format, + size_t *byte_size_ptr) { format = eFormatInvalid; - Error error; + Status error; if (s && s[0]) { if (byte_size_ptr) { @@ -931,12 +926,12 @@ bool Args::ContainsEnvironmentVariable(llvm::StringRef env_var_name, // Check each arg to see if it matches the env var name. for (auto arg : llvm::enumerate(m_entries)) { llvm::StringRef name, value; - std::tie(name, value) = arg.Value.ref.split('='); + std::tie(name, value) = arg.value().ref.split('='); if (name != env_var_name) continue; if (argument_index) - *argument_index = arg.Index; + *argument_index = arg.index(); return true; } @@ -954,9 +949,9 @@ size_t Args::FindArgumentIndexForOption(Option *long_options, long_options[long_options_index].definition->long_option); for (auto entry : llvm::enumerate(m_entries)) { - if (entry.Value.ref.startswith(short_buffer) || - entry.Value.ref.startswith(long_buffer)) - return entry.Index; + if (entry.value().ref.startswith(short_buffer) || + entry.value().ref.startswith(long_buffer)) + return entry.index(); } return size_t(-1); |