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
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index b68aa92..43c5c54 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -21,6 +21,7 @@
 #include "lldb/Host/StringConvert.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Interpreter/Options.h"
 #include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Symbol/Function.h"
@@ -290,7 +291,7 @@
       case 'e': {
         bool success;
         m_extended_backtrace =
-            Args::StringToBoolean(option_arg, false, &success);
+            OptionArgParser::ToBoolean(option_arg, false, &success);
         if (!success)
           error.SetErrorStringWithFormat(
               "invalid boolean value for option '%c'", short_option);
@@ -447,7 +448,8 @@
       switch (short_option) {
       case 'a': {
         bool success;
-        bool avoid_no_debug = Args::StringToBoolean(option_arg, true, &success);
+        bool avoid_no_debug =
+            OptionArgParser::ToBoolean(option_arg, true, &success);
         if (!success)
           error.SetErrorStringWithFormat(
               "invalid boolean value for option '%c'", short_option);
@@ -459,7 +461,8 @@
 
       case 'A': {
         bool success;
-        bool avoid_no_debug = Args::StringToBoolean(option_arg, true, &success);
+        bool avoid_no_debug =
+            OptionArgParser::ToBoolean(option_arg, true, &success);
         if (!success)
           error.SetErrorStringWithFormat(
               "invalid boolean value for option '%c'", short_option);
@@ -483,7 +486,7 @@
       case 'm': {
         OptionEnumValueElement *enum_values =
             GetDefinitions()[option_idx].enum_values;
-        m_run_mode = (lldb::RunMode)Args::StringToOptionEnum(
+        m_run_mode = (lldb::RunMode)OptionArgParser::ToOptionEnum(
             option_arg, enum_values, eOnlyDuringStepping, error);
       } break;
 
@@ -1030,7 +1033,7 @@
 
       switch (short_option) {
       case 'a': {
-        lldb::addr_t tmp_addr = Args::StringToAddress(
+        lldb::addr_t tmp_addr = OptionArgParser::ToAddress(
             execution_context, option_arg, LLDB_INVALID_ADDRESS, &error);
         if (error.Success())
           m_until_addrs.push_back(tmp_addr);
@@ -1052,7 +1055,7 @@
       case 'm': {
         OptionEnumValueElement *enum_values =
             GetDefinitions()[option_idx].enum_values;
-        lldb::RunMode run_mode = (lldb::RunMode)Args::StringToOptionEnum(
+        lldb::RunMode run_mode = (lldb::RunMode)OptionArgParser::ToOptionEnum(
             option_arg, enum_values, eOnlyDuringStepping, error);
 
         if (error.Success()) {
@@ -1541,7 +1544,8 @@
       switch (short_option) {
       case 'x': {
         bool success;
-        bool tmp_value = Args::StringToBoolean(option_arg, false, &success);
+        bool tmp_value =
+            OptionArgParser::ToBoolean(option_arg, false, &success);
         if (success)
           m_from_expression = tmp_value;
         else {
@@ -1737,8 +1741,8 @@
           return Status("invalid line offset: '%s'.", option_arg.str().c_str());
         break;
       case 'a':
-        m_load_addr = Args::StringToAddress(execution_context, option_arg,
-                                            LLDB_INVALID_ADDRESS, &error);
+        m_load_addr = OptionArgParser::ToAddress(execution_context, option_arg,
+                                                 LLDB_INVALID_ADDRESS, &error);
         break;
       case 'r':
         m_force = true;