labath updated this revision to Diff 138540.
labath added a comment.

s/toAddress/ToAddress/


https://reviews.llvm.org/D44306

Files:
  include/lldb/Interpreter/Args.h
  include/lldb/Interpreter/OptionArgParser.h
  include/lldb/Interpreter/Options.h
  source/API/SBDebugger.cpp
  source/Commands/CommandObjectBreakpoint.cpp
  source/Commands/CommandObjectBreakpointCommand.cpp
  source/Commands/CommandObjectCommands.cpp
  source/Commands/CommandObjectDisassemble.cpp
  source/Commands/CommandObjectExpression.cpp
  source/Commands/CommandObjectLog.cpp
  source/Commands/CommandObjectMemory.cpp
  source/Commands/CommandObjectProcess.cpp
  source/Commands/CommandObjectSource.cpp
  source/Commands/CommandObjectTarget.cpp
  source/Commands/CommandObjectThread.cpp
  source/Commands/CommandObjectType.cpp
  source/Commands/CommandObjectWatchpointCommand.cpp
  source/Interpreter/Args.cpp
  source/Interpreter/CMakeLists.txt
  source/Interpreter/OptionArgParser.cpp
  source/Interpreter/OptionGroupValueObjectDisplay.cpp
  source/Interpreter/OptionGroupWatchpoint.cpp
  source/Interpreter/OptionValueBoolean.cpp
  source/Interpreter/OptionValueChar.cpp
  source/Interpreter/OptionValueFormat.cpp
  source/Interpreter/Property.cpp
  source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
  source/Target/Process.cpp
  unittests/Interpreter/CMakeLists.txt
  unittests/Interpreter/TestArgs.cpp
  unittests/Interpreter/TestOptionArgParser.cpp

Index: unittests/Interpreter/TestOptionArgParser.cpp
===================================================================
--- /dev/null
+++ unittests/Interpreter/TestOptionArgParser.cpp
@@ -0,0 +1,121 @@
+//===-- ArgsTest.cpp --------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "gtest/gtest.h"
+#include "lldb/Interpreter/OptionArgParser.h"
+
+using namespace lldb_private;
+
+TEST(OptionArgParserTest, toBoolean) {
+  bool success = false;
+  EXPECT_TRUE(
+      OptionArgParser::ToBoolean(llvm::StringRef("true"), false, nullptr));
+  EXPECT_TRUE(
+      OptionArgParser::ToBoolean(llvm::StringRef("on"), false, nullptr));
+  EXPECT_TRUE(
+      OptionArgParser::ToBoolean(llvm::StringRef("yes"), false, nullptr));
+  EXPECT_TRUE(OptionArgParser::ToBoolean(llvm::StringRef("1"), false, nullptr));
+
+  EXPECT_TRUE(
+      OptionArgParser::ToBoolean(llvm::StringRef("true"), false, &success));
+  EXPECT_TRUE(success);
+  EXPECT_TRUE(
+      OptionArgParser::ToBoolean(llvm::StringRef("on"), false, &success));
+  EXPECT_TRUE(success);
+  EXPECT_TRUE(
+      OptionArgParser::ToBoolean(llvm::StringRef("yes"), false, &success));
+  EXPECT_TRUE(success);
+  EXPECT_TRUE(
+      OptionArgParser::ToBoolean(llvm::StringRef("1"), false, &success));
+  EXPECT_TRUE(success);
+
+  EXPECT_FALSE(
+      OptionArgParser::ToBoolean(llvm::StringRef("false"), true, nullptr));
+  EXPECT_FALSE(
+      OptionArgParser::ToBoolean(llvm::StringRef("off"), true, nullptr));
+  EXPECT_FALSE(
+      OptionArgParser::ToBoolean(llvm::StringRef("no"), true, nullptr));
+  EXPECT_FALSE(OptionArgParser::ToBoolean(llvm::StringRef("0"), true, nullptr));
+
+  EXPECT_FALSE(
+      OptionArgParser::ToBoolean(llvm::StringRef("false"), true, &success));
+  EXPECT_TRUE(success);
+  EXPECT_FALSE(
+      OptionArgParser::ToBoolean(llvm::StringRef("off"), true, &success));
+  EXPECT_TRUE(success);
+  EXPECT_FALSE(
+      OptionArgParser::ToBoolean(llvm::StringRef("no"), true, &success));
+  EXPECT_TRUE(success);
+  EXPECT_FALSE(
+      OptionArgParser::ToBoolean(llvm::StringRef("0"), true, &success));
+  EXPECT_TRUE(success);
+
+  EXPECT_FALSE(
+      OptionArgParser::ToBoolean(llvm::StringRef("10"), false, &success));
+  EXPECT_FALSE(success);
+  EXPECT_TRUE(
+      OptionArgParser::ToBoolean(llvm::StringRef("10"), true, &success));
+  EXPECT_FALSE(success);
+  EXPECT_TRUE(OptionArgParser::ToBoolean(llvm::StringRef(""), true, &success));
+  EXPECT_FALSE(success);
+}
+
+TEST(OptionArgParserTest, toChar) {
+  bool success = false;
+
+  EXPECT_EQ('A', OptionArgParser::ToChar("A", 'B', nullptr));
+  EXPECT_EQ('B', OptionArgParser::ToChar("B", 'A', nullptr));
+
+  EXPECT_EQ('A', OptionArgParser::ToChar("A", 'B', &success));
+  EXPECT_TRUE(success);
+  EXPECT_EQ('B', OptionArgParser::ToChar("B", 'A', &success));
+  EXPECT_TRUE(success);
+
+  EXPECT_EQ('A', OptionArgParser::ToChar("", 'A', &success));
+  EXPECT_FALSE(success);
+  EXPECT_EQ('A', OptionArgParser::ToChar("ABC", 'A', &success));
+  EXPECT_FALSE(success);
+}
+
+TEST(OptionArgParserTest, toScriptLanguage) {
+  bool success = false;
+
+  EXPECT_EQ(lldb::eScriptLanguageDefault,
+            OptionArgParser::ToScriptLanguage(llvm::StringRef("default"),
+                                              lldb::eScriptLanguageNone,
+                                              nullptr));
+  EXPECT_EQ(lldb::eScriptLanguagePython,
+            OptionArgParser::ToScriptLanguage(
+                llvm::StringRef("python"), lldb::eScriptLanguageNone, nullptr));
+  EXPECT_EQ(lldb::eScriptLanguageNone,
+            OptionArgParser::ToScriptLanguage(
+                llvm::StringRef("none"), lldb::eScriptLanguagePython, nullptr));
+
+  EXPECT_EQ(lldb::eScriptLanguageDefault,
+            OptionArgParser::ToScriptLanguage(llvm::StringRef("default"),
+                                              lldb::eScriptLanguageNone,
+                                              &success));
+  EXPECT_TRUE(success);
+  EXPECT_EQ(lldb::eScriptLanguagePython,
+            OptionArgParser::ToScriptLanguage(llvm::StringRef("python"),
+                                              lldb::eScriptLanguageNone,
+                                              &success));
+  EXPECT_TRUE(success);
+  EXPECT_EQ(lldb::eScriptLanguageNone,
+            OptionArgParser::ToScriptLanguage(llvm::StringRef("none"),
+                                              lldb::eScriptLanguagePython,
+                                              &success));
+  EXPECT_TRUE(success);
+
+  EXPECT_EQ(lldb::eScriptLanguagePython,
+            OptionArgParser::ToScriptLanguage(llvm::StringRef("invalid"),
+                                              lldb::eScriptLanguagePython,
+                                              &success));
+  EXPECT_FALSE(success);
+}
Index: unittests/Interpreter/TestArgs.cpp
===================================================================
--- unittests/Interpreter/TestArgs.cpp
+++ unittests/Interpreter/TestArgs.cpp
@@ -187,92 +187,3 @@
   EXPECT_STREQ("foo", ref[0]);
   EXPECT_STREQ("bar", ref[1]);
 }
-
-TEST(ArgsTest, StringToBoolean) {
-  bool success = false;
-  EXPECT_TRUE(Args::StringToBoolean(llvm::StringRef("true"), false, nullptr));
-  EXPECT_TRUE(Args::StringToBoolean(llvm::StringRef("on"), false, nullptr));
-  EXPECT_TRUE(Args::StringToBoolean(llvm::StringRef("yes"), false, nullptr));
-  EXPECT_TRUE(Args::StringToBoolean(llvm::StringRef("1"), false, nullptr));
-
-  EXPECT_TRUE(Args::StringToBoolean(llvm::StringRef("true"), false, &success));
-  EXPECT_TRUE(success);
-  EXPECT_TRUE(Args::StringToBoolean(llvm::StringRef("on"), false, &success));
-  EXPECT_TRUE(success);
-  EXPECT_TRUE(Args::StringToBoolean(llvm::StringRef("yes"), false, &success));
-  EXPECT_TRUE(success);
-  EXPECT_TRUE(Args::StringToBoolean(llvm::StringRef("1"), false, &success));
-  EXPECT_TRUE(success);
-
-  EXPECT_FALSE(Args::StringToBoolean(llvm::StringRef("false"), true, nullptr));
-  EXPECT_FALSE(Args::StringToBoolean(llvm::StringRef("off"), true, nullptr));
-  EXPECT_FALSE(Args::StringToBoolean(llvm::StringRef("no"), true, nullptr));
-  EXPECT_FALSE(Args::StringToBoolean(llvm::StringRef("0"), true, nullptr));
-
-  EXPECT_FALSE(Args::StringToBoolean(llvm::StringRef("false"), true, &success));
-  EXPECT_TRUE(success);
-  EXPECT_FALSE(Args::StringToBoolean(llvm::StringRef("off"), true, &success));
-  EXPECT_TRUE(success);
-  EXPECT_FALSE(Args::StringToBoolean(llvm::StringRef("no"), true, &success));
-  EXPECT_TRUE(success);
-  EXPECT_FALSE(Args::StringToBoolean(llvm::StringRef("0"), true, &success));
-  EXPECT_TRUE(success);
-
-  EXPECT_FALSE(Args::StringToBoolean(llvm::StringRef("10"), false, &success));
-  EXPECT_FALSE(success);
-  EXPECT_TRUE(Args::StringToBoolean(llvm::StringRef("10"), true, &success));
-  EXPECT_FALSE(success);
-  EXPECT_TRUE(Args::StringToBoolean(llvm::StringRef(""), true, &success));
-  EXPECT_FALSE(success);
-}
-
-TEST(ArgsTest, StringToChar) {
-  bool success = false;
-
-  EXPECT_EQ('A', Args::StringToChar("A", 'B', nullptr));
-  EXPECT_EQ('B', Args::StringToChar("B", 'A', nullptr));
-
-  EXPECT_EQ('A', Args::StringToChar("A", 'B', &success));
-  EXPECT_TRUE(success);
-  EXPECT_EQ('B', Args::StringToChar("B", 'A', &success));
-  EXPECT_TRUE(success);
-
-  EXPECT_EQ('A', Args::StringToChar("", 'A', &success));
-  EXPECT_FALSE(success);
-  EXPECT_EQ('A', Args::StringToChar("ABC", 'A', &success));
-  EXPECT_FALSE(success);
-}
-
-TEST(ArgsTest, StringToScriptLanguage) {
-  bool success = false;
-
-  EXPECT_EQ(lldb::eScriptLanguageDefault,
-            Args::StringToScriptLanguage(llvm::StringRef("default"),
-                                         lldb::eScriptLanguageNone, nullptr));
-  EXPECT_EQ(lldb::eScriptLanguagePython,
-            Args::StringToScriptLanguage(llvm::StringRef("python"),
-                                         lldb::eScriptLanguageNone, nullptr));
-  EXPECT_EQ(lldb::eScriptLanguageNone,
-            Args::StringToScriptLanguage(llvm::StringRef("none"),
-                                         lldb::eScriptLanguagePython, nullptr));
-
-  EXPECT_EQ(lldb::eScriptLanguageDefault,
-            Args::StringToScriptLanguage(llvm::StringRef("default"),
-                                         lldb::eScriptLanguageNone, &success));
-  EXPECT_TRUE(success);
-  EXPECT_EQ(lldb::eScriptLanguagePython,
-            Args::StringToScriptLanguage(llvm::StringRef("python"),
-                                         lldb::eScriptLanguageNone, &success));
-  EXPECT_TRUE(success);
-  EXPECT_EQ(lldb::eScriptLanguageNone,
-            Args::StringToScriptLanguage(llvm::StringRef("none"),
-                                         lldb::eScriptLanguagePython,
-                                         &success));
-  EXPECT_TRUE(success);
-
-  EXPECT_EQ(lldb::eScriptLanguagePython,
-            Args::StringToScriptLanguage(llvm::StringRef("invalid"),
-                                         lldb::eScriptLanguagePython,
-                                         &success));
-  EXPECT_FALSE(success);
-}
Index: unittests/Interpreter/CMakeLists.txt
===================================================================
--- unittests/Interpreter/CMakeLists.txt
+++ unittests/Interpreter/CMakeLists.txt
@@ -1,6 +1,7 @@
 add_lldb_unittest(InterpreterTests
   TestArgs.cpp
   TestCompletion.cpp
+  TestOptionArgParser.cpp
 
   LINK_LIBS
     lldbInterpreter
Index: source/Target/Process.cpp
===================================================================
--- source/Target/Process.cpp
+++ source/Target/Process.cpp
@@ -39,6 +39,7 @@
 #include "lldb/Host/Terminal.h"
 #include "lldb/Host/ThreadLauncher.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Interpreter/OptionValueProperties.h"
 #include "lldb/Symbol/Function.h"
 #include "lldb/Symbol/Symbol.h"
@@ -489,7 +490,7 @@
   {
     bool success;
     const bool disable_aslr_arg =
-        Args::StringToBoolean(option_arg, true, &success);
+        OptionArgParser::ToBoolean(option_arg, true, &success);
     if (success)
       disable_aslr = disable_aslr_arg ? eLazyBoolYes : eLazyBoolNo;
     else
@@ -502,7 +503,8 @@
   case 'X': // shell expand args.
   {
     bool success;
-    const bool expand_args = Args::StringToBoolean(option_arg, true, &success);
+    const bool expand_args =
+        OptionArgParser::ToBoolean(option_arg, true, &success);
     if (success)
       launch_info.SetShellExpandArguments(expand_args);
     else
Index: source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
===================================================================
--- source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
+++ source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
@@ -23,6 +23,7 @@
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandObjectMultiword.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Interpreter/OptionValueProperties.h"
 #include "lldb/Interpreter/OptionValueString.h"
 #include "lldb/Interpreter/Property.h"
@@ -544,7 +545,8 @@
       break;
 
     case 'b':
-      m_broadcast_events = Args::StringToBoolean(option_arg, true, nullptr);
+      m_broadcast_events =
+          OptionArgParser::ToBoolean(option_arg, true, nullptr);
       break;
 
     case 'c':
@@ -560,7 +562,7 @@
       break;
 
     case 'e':
-      m_echo_to_stderr = Args::StringToBoolean(option_arg, false, nullptr);
+      m_echo_to_stderr = OptionArgParser::ToBoolean(option_arg, false, nullptr);
       break;
 
     case 'f':
@@ -571,12 +573,12 @@
       break;
 
     case 'l':
-      m_live_stream = Args::StringToBoolean(option_arg, false, nullptr);
+      m_live_stream = OptionArgParser::ToBoolean(option_arg, false, nullptr);
       break;
 
     case 'n':
       m_filter_fall_through_accepts =
-          Args::StringToBoolean(option_arg, true, nullptr);
+          OptionArgParser::ToBoolean(option_arg, true, nullptr);
       break;
 
     case 'r':
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===================================================================
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -51,6 +51,7 @@
 #include "lldb/Interpreter/CommandObject.h"
 #include "lldb/Interpreter/CommandObjectMultiword.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Interpreter/OptionGroupBoolean.h"
 #include "lldb/Interpreter/OptionGroupUInt64.h"
 #include "lldb/Interpreter/OptionValueProperties.h"
@@ -531,7 +532,7 @@
               reg_info.encoding = encoding;
           } else if (name.equals("format")) {
             Format format = eFormatInvalid;
-            if (Args::StringToFormat(value.str().c_str(), format, NULL)
+            if (OptionArgParser::ToFormat(value.str().c_str(), format, NULL)
                     .Success())
               reg_info.format = format;
             else {
@@ -4223,7 +4224,7 @@
           } else if (name == "format") {
             format_set = true;
             Format format = eFormatInvalid;
-            if (Args::StringToFormat(value.data(), format, NULL).Success())
+            if (OptionArgParser::ToFormat(value.data(), format, NULL).Success())
               reg_info.format = format;
             else if (value == "vector-sint8")
               reg_info.format = eFormatVectorOfSInt8;
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
===================================================================
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
@@ -28,7 +28,7 @@
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/HostInfo.h"
-#include "lldb/Interpreter/Args.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Target/FileAction.h"
 #include "lldb/Target/Platform.h"
@@ -405,7 +405,7 @@
         match_info.GetProcessInfo().SetEffectiveGroupID(gid);
       } else if (key.equals("all_users")) {
         match_info.SetMatchAllUsers(
-            Args::StringToBoolean(value, false, &success));
+            OptionArgParser::ToBoolean(value, false, &success));
       } else if (key.equals("triple")) {
         match_info.GetProcessInfo().GetArchitecture() =
             HostInfo::GetAugmentedArchSpec(value);
Index: source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
===================================================================
--- source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
+++ source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
@@ -12,6 +12,7 @@
 #include "lldb/Core/StreamFile.h"
 #include "lldb/DataFormatters/FormatManager.h"
 #include "lldb/Host/StringConvert.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Utility/ArchSpec.h"
 #include "lldb/Utility/RegularExpression.h"
 #include "lldb/Utility/StringExtractor.h"
@@ -286,7 +287,8 @@
 
     llvm::StringRef format_str;
     if (reg_info_dict->GetValueForKeyAsString("format", format_str, nullptr)) {
-      if (Args::StringToFormat(format_str.str().c_str(), reg_info.format, NULL)
+      if (OptionArgParser::ToFormat(format_str.str().c_str(), reg_info.format,
+                                    NULL)
               .Fail()) {
         Clear();
         printf("error: invalid 'format' value in register dictionary\n");
Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
===================================================================
--- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -37,6 +37,7 @@
 #include "lldb/Interpreter/CommandObject.h"
 #include "lldb/Interpreter/CommandObjectMultiword.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Interpreter/OptionValueBoolean.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/ObjectFile.h"
@@ -682,7 +683,7 @@
           if (!arg_str)
             continue;
           Status error;
-          lldb::addr_t arg_addr = Args::StringToAddress(
+          lldb::addr_t arg_addr = OptionArgParser::ToAddress(
               &exe_ctx, arg_str, LLDB_INVALID_ADDRESS, &error);
           if (arg_addr == 0 || arg_addr == LLDB_INVALID_ADDRESS || error.Fail())
             continue;
Index: source/Interpreter/Property.cpp
===================================================================
--- source/Interpreter/Property.cpp
+++ source/Interpreter/Property.cpp
@@ -16,6 +16,7 @@
 #include "lldb/Core/UserSettingsController.h"
 #include "lldb/Host/StringConvert.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Interpreter/OptionValues.h"
 #include "lldb/Target/Language.h"
 
@@ -53,16 +54,17 @@
     // "definition.default_cstr_value" as a string value that represents the
     // default value.
     if (definition.default_cstr_value)
-      m_value_sp.reset(new OptionValueBoolean(Args::StringToBoolean(
+      m_value_sp.reset(new OptionValueBoolean(OptionArgParser::ToBoolean(
           llvm::StringRef(definition.default_cstr_value), false, nullptr)));
     else
       m_value_sp.reset(
           new OptionValueBoolean(definition.default_uint_value != 0));
     break;
 
   case OptionValue::eTypeChar: {
     llvm::StringRef s(definition.default_cstr_value ? definition.default_cstr_value : "");
-    m_value_sp = std::make_shared<OptionValueChar>(Args::StringToChar(s, '\0', nullptr));
+    m_value_sp = std::make_shared<OptionValueChar>(
+        OptionArgParser::ToChar(s, '\0', nullptr));
     break;
   }
   case OptionValue::eTypeDictionary:
@@ -123,8 +125,8 @@
     {
       Format new_format = eFormatInvalid;
       if (definition.default_cstr_value)
-        Args::StringToFormat(definition.default_cstr_value, new_format,
-                             nullptr);
+        OptionArgParser::ToFormat(definition.default_cstr_value, new_format,
+                                  nullptr);
       else
         new_format = (Format)definition.default_uint_value;
       m_value_sp.reset(new OptionValueFormat(new_format));
Index: source/Interpreter/OptionValueFormat.cpp
===================================================================
--- source/Interpreter/OptionValueFormat.cpp
+++ source/Interpreter/OptionValueFormat.cpp
@@ -14,7 +14,7 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/DataFormatters/FormatManager.h"
-#include "lldb/Interpreter/Args.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Utility/Stream.h"
 
 using namespace lldb;
@@ -43,7 +43,7 @@
   case eVarSetOperationReplace:
   case eVarSetOperationAssign: {
     Format new_format;
-    error = Args::StringToFormat(value.str().c_str(), new_format, nullptr);
+    error = OptionArgParser::ToFormat(value.str().c_str(), new_format, nullptr);
     if (error.Success()) {
       m_value_was_set = true;
       m_current_value = new_format;
Index: source/Interpreter/OptionValueChar.cpp
===================================================================
--- source/Interpreter/OptionValueChar.cpp
+++ source/Interpreter/OptionValueChar.cpp
@@ -13,7 +13,7 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
-#include "lldb/Interpreter/Args.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Utility/Stream.h"
 #include "lldb/Utility/StringList.h"
 #include "llvm/ADT/STLExtras.h"
@@ -47,7 +47,7 @@
   case eVarSetOperationReplace:
   case eVarSetOperationAssign: {
     bool success = false;
-    char char_value = Args::StringToChar(value, '\0', &success);
+    char char_value = OptionArgParser::ToChar(value, '\0', &success);
     if (success) {
       m_current_value = char_value;
       m_value_was_set = true;
Index: source/Interpreter/OptionValueBoolean.cpp
===================================================================
--- source/Interpreter/OptionValueBoolean.cpp
+++ source/Interpreter/OptionValueBoolean.cpp
@@ -14,7 +14,7 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Host/PosixApi.h"
-#include "lldb/Interpreter/Args.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Utility/Stream.h"
 #include "lldb/Utility/StringList.h"
 #include "llvm/ADT/STLExtras.h"
@@ -47,7 +47,7 @@
   case eVarSetOperationReplace:
   case eVarSetOperationAssign: {
     bool success = false;
-    bool value = Args::StringToBoolean(value_str, false, &success);
+    bool value = OptionArgParser::ToBoolean(value_str, false, &success);
     if (success) {
       m_value_was_set = true;
       m_current_value = value;
Index: source/Interpreter/OptionGroupWatchpoint.cpp
===================================================================
--- source/Interpreter/OptionGroupWatchpoint.cpp
+++ source/Interpreter/OptionGroupWatchpoint.cpp
@@ -14,7 +14,7 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Host/OptionParser.h"
-#include "lldb/Interpreter/Args.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/lldb-enumerations.h"
 
 using namespace lldb;
@@ -65,16 +65,16 @@
   switch (short_option) {
   case 'w': {
     WatchType tmp_watch_type;
-    tmp_watch_type = (WatchType)Args::StringToOptionEnum(
+    tmp_watch_type = (WatchType)OptionArgParser::ToOptionEnum(
         option_arg, g_option_table[option_idx].enum_values, 0, error);
     if (error.Success()) {
       watch_type = tmp_watch_type;
       watch_type_specified = true;
     }
     break;
   }
   case 's':
-    watch_size = (uint32_t)Args::StringToOptionEnum(
+    watch_size = (uint32_t)OptionArgParser::ToOptionEnum(
         option_arg, g_option_table[option_idx].enum_values, 0, error);
     break;
 
Index: source/Interpreter/OptionGroupValueObjectDisplay.cpp
===================================================================
--- source/Interpreter/OptionGroupValueObjectDisplay.cpp
+++ source/Interpreter/OptionGroupValueObjectDisplay.cpp
@@ -16,6 +16,7 @@
 #include "lldb/DataFormatters/ValueObjectPrinter.h"
 #include "lldb/Host/OptionParser.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Target/Target.h"
 
 #include "llvm/ADT/ArrayRef.h"
@@ -85,8 +86,8 @@
   switch (short_option) {
   case 'd': {
     int32_t result;
-    result =
-        Args::StringToOptionEnum(option_arg, g_dynamic_value_types, 2, error);
+    result = OptionArgParser::ToOptionEnum(option_arg, g_dynamic_value_types, 2,
+                                           error);
     if (error.Success())
       use_dynamic = (lldb::DynamicValueType)result;
   } break;
@@ -144,14 +145,14 @@
     break;
 
   case 'S':
-    use_synth = Args::StringToBoolean(option_arg, true, &success);
+    use_synth = OptionArgParser::ToBoolean(option_arg, true, &success);
     if (!success)
       error.SetErrorStringWithFormat("invalid synthetic-type '%s'",
                                      option_arg.str().c_str());
     break;
 
   case 'V':
-    run_validator = Args::StringToBoolean(option_arg, true, &success);
+    run_validator = OptionArgParser::ToBoolean(option_arg, true, &success);
     if (!success)
       error.SetErrorStringWithFormat("invalid validate '%s'",
                                      option_arg.str().c_str());
Index: source/Interpreter/OptionArgParser.cpp
===================================================================
--- /dev/null
+++ source/Interpreter/OptionArgParser.cpp
@@ -0,0 +1,253 @@
+//===-- OptionArgParser.cpp -------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Interpreter/OptionArgParser.h"
+#include "lldb/DataFormatters/FormatManager.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/Utility/StreamString.h"
+
+using namespace lldb_private;
+using namespace lldb;
+
+bool OptionArgParser::ToBoolean(llvm::StringRef ref, bool fail_value,
+                                bool *success_ptr) {
+  if (success_ptr)
+    *success_ptr = true;
+  ref = ref.trim();
+  if (ref.equals_lower("false") || ref.equals_lower("off") ||
+      ref.equals_lower("no") || ref.equals_lower("0")) {
+    return false;
+  } else if (ref.equals_lower("true") || ref.equals_lower("on") ||
+             ref.equals_lower("yes") || ref.equals_lower("1")) {
+    return true;
+  }
+  if (success_ptr)
+    *success_ptr = false;
+  return fail_value;
+}
+
+char OptionArgParser::ToChar(llvm::StringRef s, char fail_value,
+                             bool *success_ptr) {
+  if (success_ptr)
+    *success_ptr = false;
+  if (s.size() != 1)
+    return fail_value;
+
+  if (success_ptr)
+    *success_ptr = true;
+  return s[0];
+}
+
+int64_t OptionArgParser::ToOptionEnum(llvm::StringRef s,
+                                      OptionEnumValueElement *enum_values,
+                                      int32_t fail_value, Status &error) {
+  error.Clear();
+  if (!enum_values) {
+    error.SetErrorString("invalid enumeration argument");
+    return fail_value;
+  }
+
+  if (s.empty()) {
+    error.SetErrorString("empty enumeration string");
+    return fail_value;
+  }
+
+  for (int i = 0; enum_values[i].string_value != nullptr; i++) {
+    llvm::StringRef this_enum(enum_values[i].string_value);
+    if (this_enum.startswith(s))
+      return enum_values[i].value;
+  }
+
+  StreamString strm;
+  strm.PutCString("invalid enumeration value, valid values are: ");
+  for (int i = 0; enum_values[i].string_value != nullptr; i++) {
+    strm.Printf("%s\"%s\"", i > 0 ? ", " : "", enum_values[i].string_value);
+  }
+  error.SetErrorString(strm.GetString());
+  return fail_value;
+}
+
+Status OptionArgParser::ToFormat(const char *s, lldb::Format &format,
+                                 size_t *byte_size_ptr) {
+  format = eFormatInvalid;
+  Status error;
+
+  if (s && s[0]) {
+    if (byte_size_ptr) {
+      if (isdigit(s[0])) {
+        char *format_char = nullptr;
+        unsigned long byte_size = ::strtoul(s, &format_char, 0);
+        if (byte_size != ULONG_MAX)
+          *byte_size_ptr = byte_size;
+        s = format_char;
+      } else
+        *byte_size_ptr = 0;
+    }
+
+    const bool partial_match_ok = true;
+    if (!FormatManager::GetFormatFromCString(s, partial_match_ok, format)) {
+      StreamString error_strm;
+      error_strm.Printf(
+          "Invalid format character or name '%s'. Valid values are:\n", s);
+      for (Format f = eFormatDefault; f < kNumFormats; f = Format(f + 1)) {
+        char format_char = FormatManager::GetFormatAsFormatChar(f);
+        if (format_char)
+          error_strm.Printf("'%c' or ", format_char);
+
+        error_strm.Printf("\"%s\"", FormatManager::GetFormatAsCString(f));
+        error_strm.EOL();
+      }
+
+      if (byte_size_ptr)
+        error_strm.PutCString(
+            "An optional byte size can precede the format character.\n");
+      error.SetErrorString(error_strm.GetString());
+    }
+
+    if (error.Fail())
+      return error;
+  } else {
+    error.SetErrorStringWithFormat("%s option string", s ? "empty" : "invalid");
+  }
+  return error;
+}
+
+lldb::ScriptLanguage OptionArgParser::ToScriptLanguage(
+    llvm::StringRef s, lldb::ScriptLanguage fail_value, bool *success_ptr) {
+  if (success_ptr)
+    *success_ptr = true;
+
+  if (s.equals_lower("python"))
+    return eScriptLanguagePython;
+  if (s.equals_lower("default"))
+    return eScriptLanguageDefault;
+  if (s.equals_lower("none"))
+    return eScriptLanguageNone;
+
+  if (success_ptr)
+    *success_ptr = false;
+  return fail_value;
+}
+
+lldb::addr_t OptionArgParser::ToAddress(const ExecutionContext *exe_ctx,
+                                        llvm::StringRef s,
+                                        lldb::addr_t fail_value,
+                                        Status *error_ptr) {
+  bool error_set = false;
+  if (s.empty()) {
+    if (error_ptr)
+      error_ptr->SetErrorStringWithFormat("invalid address expression \"%s\"",
+                                          s.str().c_str());
+    return fail_value;
+  }
+
+  llvm::StringRef sref = s;
+
+  lldb::addr_t addr = LLDB_INVALID_ADDRESS;
+  if (!s.getAsInteger(0, addr)) {
+    if (error_ptr)
+      error_ptr->Clear();
+    return addr;
+  }
+
+  // Try base 16 with no prefix...
+  if (!s.getAsInteger(16, addr)) {
+    if (error_ptr)
+      error_ptr->Clear();
+    return addr;
+  }
+
+  Target *target = nullptr;
+  if (!exe_ctx || !(target = exe_ctx->GetTargetPtr())) {
+    if (error_ptr)
+      error_ptr->SetErrorStringWithFormat("invalid address expression \"%s\"",
+                                          s.str().c_str());
+    return fail_value;
+  }
+
+  lldb::ValueObjectSP valobj_sp;
+  EvaluateExpressionOptions options;
+  options.SetCoerceToId(false);
+  options.SetUnwindOnError(true);
+  options.SetKeepInMemory(false);
+  options.SetTryAllThreads(true);
+
+  ExpressionResults expr_result =
+      target->EvaluateExpression(s, exe_ctx->GetFramePtr(), valobj_sp, options);
+
+  bool success = false;
+  if (expr_result == eExpressionCompleted) {
+    if (valobj_sp)
+      valobj_sp = valobj_sp->GetQualifiedRepresentationIfAvailable(
+          valobj_sp->GetDynamicValueType(), true);
+    // Get the address to watch.
+    if (valobj_sp)
+      addr = valobj_sp->GetValueAsUnsigned(fail_value, &success);
+    if (success) {
+      if (error_ptr)
+        error_ptr->Clear();
+      return addr;
+    } else {
+      if (error_ptr) {
+        error_set = true;
+        error_ptr->SetErrorStringWithFormat(
+            "address expression \"%s\" resulted in a value whose type "
+            "can't be converted to an address: %s",
+            s.str().c_str(), valobj_sp->GetTypeName().GetCString());
+      }
+    }
+
+  } else {
+    // Since the compiler can't handle things like "main + 12" we should
+    // try to do this for now. The compiler doesn't like adding offsets
+    // to function pointer types.
+    static RegularExpression g_symbol_plus_offset_regex(
+        "^(.*)([-\\+])[[:space:]]*(0x[0-9A-Fa-f]+|[0-9]+)[[:space:]]*$");
+    RegularExpression::Match regex_match(3);
+    if (g_symbol_plus_offset_regex.Execute(sref, &regex_match)) {
+      uint64_t offset = 0;
+      bool add = true;
+      std::string name;
+      std::string str;
+      if (regex_match.GetMatchAtIndex(s, 1, name)) {
+        if (regex_match.GetMatchAtIndex(s, 2, str)) {
+          add = str[0] == '+';
+
+          if (regex_match.GetMatchAtIndex(s, 3, str)) {
+            if (!llvm::StringRef(str).getAsInteger(0, offset)) {
+              Status error;
+              addr = ToAddress(exe_ctx, name.c_str(), LLDB_INVALID_ADDRESS,
+                               &error);
+              if (addr != LLDB_INVALID_ADDRESS) {
+                if (add)
+                  return addr + offset;
+                else
+                  return addr - offset;
+              }
+            }
+          }
+        }
+      }
+    }
+
+    if (error_ptr) {
+      error_set = true;
+      error_ptr->SetErrorStringWithFormat(
+          "address expression \"%s\" evaluation failed", s.str().c_str());
+    }
+  }
+
+  if (error_ptr) {
+    if (!error_set)
+      error_ptr->SetErrorStringWithFormat("invalid address expression \"%s\"",
+                                          s.str().c_str());
+  }
+  return fail_value;
+}
Index: source/Interpreter/CMakeLists.txt
===================================================================
--- source/Interpreter/CMakeLists.txt
+++ source/Interpreter/CMakeLists.txt
@@ -8,6 +8,7 @@
   CommandObjectScript.cpp
   CommandOptionValidators.cpp
   CommandReturnObject.cpp
+  OptionArgParser.cpp
   OptionGroupArchitecture.cpp
   OptionGroupBoolean.cpp
   OptionGroupFile.cpp
Index: source/Interpreter/Args.cpp
===================================================================
--- source/Interpreter/Args.cpp
+++ source/Interpreter/Args.cpp
@@ -12,11 +12,12 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
-#include "lldb/DataFormatters/FormatManager.h"
 #include "lldb/Interpreter/Args.h"
-#include "lldb/Target/Target.h"
+#include "lldb/Interpreter/Options.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Stream.h"
-#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/StringList.h"
 
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringExtras.h"
@@ -401,121 +402,6 @@
   m_argv.push_back(nullptr);
 }
 
-lldb::addr_t Args::StringToAddress(const ExecutionContext *exe_ctx,
-                                   llvm::StringRef s, lldb::addr_t fail_value,
-                                   Status *error_ptr) {
-  bool error_set = false;
-  if (s.empty()) {
-    if (error_ptr)
-      error_ptr->SetErrorStringWithFormat("invalid address expression \"%s\"",
-                                          s.str().c_str());
-    return fail_value;
-  }
-
-  llvm::StringRef sref = s;
-
-  lldb::addr_t addr = LLDB_INVALID_ADDRESS;
-  if (!s.getAsInteger(0, addr)) {
-    if (error_ptr)
-      error_ptr->Clear();
-    return addr;
-  }
-
-  // Try base 16 with no prefix...
-  if (!s.getAsInteger(16, addr)) {
-    if (error_ptr)
-      error_ptr->Clear();
-    return addr;
-  }
-
-  Target *target = nullptr;
-  if (!exe_ctx || !(target = exe_ctx->GetTargetPtr())) {
-    if (error_ptr)
-      error_ptr->SetErrorStringWithFormat("invalid address expression \"%s\"",
-                                          s.str().c_str());
-    return fail_value;
-  }
-
-  lldb::ValueObjectSP valobj_sp;
-  EvaluateExpressionOptions options;
-  options.SetCoerceToId(false);
-  options.SetUnwindOnError(true);
-  options.SetKeepInMemory(false);
-  options.SetTryAllThreads(true);
-
-  ExpressionResults expr_result =
-      target->EvaluateExpression(s, exe_ctx->GetFramePtr(), valobj_sp, options);
-
-  bool success = false;
-  if (expr_result == eExpressionCompleted) {
-    if (valobj_sp)
-      valobj_sp = valobj_sp->GetQualifiedRepresentationIfAvailable(
-          valobj_sp->GetDynamicValueType(), true);
-    // Get the address to watch.
-    if (valobj_sp)
-      addr = valobj_sp->GetValueAsUnsigned(fail_value, &success);
-    if (success) {
-      if (error_ptr)
-        error_ptr->Clear();
-      return addr;
-    } else {
-      if (error_ptr) {
-        error_set = true;
-        error_ptr->SetErrorStringWithFormat(
-            "address expression \"%s\" resulted in a value whose type "
-            "can't be converted to an address: %s",
-            s.str().c_str(), valobj_sp->GetTypeName().GetCString());
-      }
-    }
-
-  } else {
-    // Since the compiler can't handle things like "main + 12" we should
-    // try to do this for now. The compiler doesn't like adding offsets
-    // to function pointer types.
-    static RegularExpression g_symbol_plus_offset_regex(
-        "^(.*)([-\\+])[[:space:]]*(0x[0-9A-Fa-f]+|[0-9]+)[[:space:]]*$");
-    RegularExpression::Match regex_match(3);
-    if (g_symbol_plus_offset_regex.Execute(sref, &regex_match)) {
-      uint64_t offset = 0;
-      bool add = true;
-      std::string name;
-      std::string str;
-      if (regex_match.GetMatchAtIndex(s, 1, name)) {
-        if (regex_match.GetMatchAtIndex(s, 2, str)) {
-          add = str[0] == '+';
-
-          if (regex_match.GetMatchAtIndex(s, 3, str)) {
-            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) {
-                if (add)
-                  return addr + offset;
-                else
-                  return addr - offset;
-              }
-            }
-          }
-        }
-      }
-    }
-
-    if (error_ptr) {
-      error_set = true;
-      error_ptr->SetErrorStringWithFormat(
-          "address expression \"%s\" evaluation failed", s.str().c_str());
-    }
-  }
-
-  if (error_ptr) {
-    if (!error_set)
-      error_ptr->SetErrorStringWithFormat("invalid address expression \"%s\"",
-                                          s.str().c_str());
-  }
-  return fail_value;
-}
-
 const char *Args::StripSpaces(std::string &s, bool leading, bool trailing,
                               bool return_null_if_empty) {
   static const char *k_white_space = " \t\v";
@@ -539,34 +425,6 @@
   return s.c_str();
 }
 
-bool Args::StringToBoolean(llvm::StringRef ref, bool fail_value,
-                           bool *success_ptr) {
-  if (success_ptr)
-    *success_ptr = true;
-  ref = ref.trim();
-  if (ref.equals_lower("false") || ref.equals_lower("off") ||
-      ref.equals_lower("no") || ref.equals_lower("0")) {
-    return false;
-  } else if (ref.equals_lower("true") || ref.equals_lower("on") ||
-             ref.equals_lower("yes") || ref.equals_lower("1")) {
-    return true;
-  }
-  if (success_ptr)
-    *success_ptr = false;
-  return fail_value;
-}
-
-char Args::StringToChar(llvm::StringRef s, char fail_value, bool *success_ptr) {
-  if (success_ptr)
-    *success_ptr = false;
-  if (s.size() != 1)
-    return fail_value;
-
-  if (success_ptr)
-    *success_ptr = true;
-  return s[0];
-}
-
 bool Args::StringToVersion(llvm::StringRef string, uint32_t &major,
                            uint32_t &minor, uint32_t &update) {
   major = UINT32_MAX;
@@ -628,98 +486,6 @@
   return safe_arg.c_str();
 }
 
-int64_t Args::StringToOptionEnum(llvm::StringRef s,
-                                 OptionEnumValueElement *enum_values,
-                                 int32_t fail_value, Status &error) {
-  error.Clear();
-  if (!enum_values) {
-    error.SetErrorString("invalid enumeration argument");
-    return fail_value;
-  }
-
-  if (s.empty()) {
-    error.SetErrorString("empty enumeration string");
-    return fail_value;
-  }
-
-  for (int i = 0; enum_values[i].string_value != nullptr; i++) {
-    llvm::StringRef this_enum(enum_values[i].string_value);
-    if (this_enum.startswith(s))
-      return enum_values[i].value;
-  }
-
-  StreamString strm;
-  strm.PutCString("invalid enumeration value, valid values are: ");
-  for (int i = 0; enum_values[i].string_value != nullptr; i++) {
-    strm.Printf("%s\"%s\"", i > 0 ? ", " : "", enum_values[i].string_value);
-  }
-  error.SetErrorString(strm.GetString());
-  return fail_value;
-}
-
-lldb::ScriptLanguage
-Args::StringToScriptLanguage(llvm::StringRef s, lldb::ScriptLanguage fail_value,
-                             bool *success_ptr) {
-  if (success_ptr)
-    *success_ptr = true;
-
-  if (s.equals_lower("python"))
-    return eScriptLanguagePython;
-  if (s.equals_lower("default"))
-    return eScriptLanguageDefault;
-  if (s.equals_lower("none"))
-    return eScriptLanguageNone;
-
-  if (success_ptr)
-    *success_ptr = false;
-  return fail_value;
-}
-
-Status Args::StringToFormat(const char *s, lldb::Format &format,
-                            size_t *byte_size_ptr) {
-  format = eFormatInvalid;
-  Status error;
-
-  if (s && s[0]) {
-    if (byte_size_ptr) {
-      if (isdigit(s[0])) {
-        char *format_char = nullptr;
-        unsigned long byte_size = ::strtoul(s, &format_char, 0);
-        if (byte_size != ULONG_MAX)
-          *byte_size_ptr = byte_size;
-        s = format_char;
-      } else
-        *byte_size_ptr = 0;
-    }
-
-    const bool partial_match_ok = true;
-    if (!FormatManager::GetFormatFromCString(s, partial_match_ok, format)) {
-      StreamString error_strm;
-      error_strm.Printf(
-          "Invalid format character or name '%s'. Valid values are:\n", s);
-      for (Format f = eFormatDefault; f < kNumFormats; f = Format(f + 1)) {
-        char format_char = FormatManager::GetFormatAsFormatChar(f);
-        if (format_char)
-          error_strm.Printf("'%c' or ", format_char);
-
-        error_strm.Printf("\"%s\"", FormatManager::GetFormatAsCString(f));
-        error_strm.EOL();
-      }
-
-      if (byte_size_ptr)
-        error_strm.PutCString(
-            "An optional byte size can precede the format character.\n");
-      error.SetErrorString(error_strm.GetString());
-    }
-
-    if (error.Fail())
-      return error;
-  } else {
-    error.SetErrorStringWithFormat("%s option string", s ? "empty" : "invalid");
-  }
-  return error;
-}
-
 lldb::Encoding Args::StringToEncoding(llvm::StringRef s,
                                       lldb::Encoding fail_value) {
   return llvm::StringSwitch<lldb::Encoding>(s)
Index: source/Commands/CommandObjectWatchpointCommand.cpp
===================================================================
--- source/Commands/CommandObjectWatchpointCommand.cpp
+++ source/Commands/CommandObjectWatchpointCommand.cpp
@@ -22,6 +22,7 @@
 #include "lldb/Host/OptionParser.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 
@@ -331,7 +332,7 @@
         break;
 
       case 's':
-        m_script_language = (lldb::ScriptLanguage)Args::StringToOptionEnum(
+        m_script_language = (lldb::ScriptLanguage)OptionArgParser::ToOptionEnum(
             option_arg, GetDefinitions()[option_idx].enum_values,
             eScriptLanguageNone, error);
 
@@ -341,7 +342,8 @@
 
       case 'e': {
         bool success = false;
-        m_stop_on_error = Args::StringToBoolean(option_arg, false, &success);
+        m_stop_on_error =
+            OptionArgParser::ToBoolean(option_arg, false, &success);
         if (!success)
           error.SetErrorStringWithFormat(
               "invalid value for stop-on-error: \"%s\"",
Index: source/Commands/CommandObjectType.cpp
===================================================================
--- source/Commands/CommandObjectType.cpp
+++ source/Commands/CommandObjectType.cpp
@@ -24,6 +24,7 @@
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandObject.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Interpreter/OptionGroupFormat.h"
 #include "lldb/Interpreter/OptionValueBoolean.h"
 #include "lldb/Interpreter/OptionValueLanguage.h"
@@ -329,7 +330,7 @@
 
       switch (short_option) {
       case 'C':
-        m_cascade = Args::StringToBoolean(option_arg, true, &success);
+        m_cascade = OptionArgParser::ToBoolean(option_arg, true, &success);
         if (!success)
           error.SetErrorStringWithFormat("invalid value for cascade: %s",
                                          option_arg.str().c_str());
@@ -571,7 +572,7 @@
 
       switch (short_option) {
       case 'C':
-        m_cascade = Args::StringToBoolean(option_value, true, &success);
+        m_cascade = OptionArgParser::ToBoolean(option_value, true, &success);
         if (!success)
           error.SetErrorStringWithFormat("invalid value for cascade: %s",
                                          option_value.str().c_str());
@@ -1252,7 +1253,7 @@
 
   switch (short_option) {
   case 'C':
-    m_flags.SetCascades(Args::StringToBoolean(option_arg, true, &success));
+    m_flags.SetCascades(OptionArgParser::ToBoolean(option_arg, true, &success));
     if (!success)
       error.SetErrorStringWithFormat("invalid value for cascade: %s",
                                      option_arg.str().c_str());
@@ -2520,7 +2521,7 @@
 
       switch (short_option) {
       case 'C':
-        m_cascade = Args::StringToBoolean(option_arg, true, &success);
+        m_cascade = OptionArgParser::ToBoolean(option_arg, true, &success);
         if (!success)
           error.SetErrorStringWithFormat("invalid value for cascade: %s",
                                          option_arg.str().c_str());
Index: source/Commands/CommandObjectThread.cpp
===================================================================
--- source/Commands/CommandObjectThread.cpp
+++ 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;
Index: source/Commands/CommandObjectTarget.cpp
===================================================================
--- source/Commands/CommandObjectTarget.cpp
+++ source/Commands/CommandObjectTarget.cpp
@@ -24,6 +24,7 @@
 #include "lldb/Interpreter/Args.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Interpreter/OptionGroupArchitecture.h"
 #include "lldb/Interpreter/OptionGroupBoolean.h"
 #include "lldb/Interpreter/OptionGroupFile.h"
@@ -1982,7 +1983,7 @@
 
       switch (short_option) {
       case 's':
-        m_sort_order = (SortOrder)Args::StringToOptionEnum(
+        m_sort_order = (SortOrder)OptionArgParser::ToOptionEnum(
             option_arg, GetDefinitions()[option_idx].enum_values,
             eSortOrderNone, error);
         break;
@@ -2861,8 +2862,8 @@
       if (short_option == 'g') {
         m_use_global_module_list = true;
       } else if (short_option == 'a') {
-        m_module_addr = Args::StringToAddress(execution_context, option_arg,
-                                              LLDB_INVALID_ADDRESS, &error);
+        m_module_addr = OptionArgParser::ToAddress(
+            execution_context, option_arg, LLDB_INVALID_ADDRESS, &error);
       } else {
         unsigned long width = 0;
         option_arg.getAsInteger(0, width);
@@ -3227,8 +3228,8 @@
       case 'a': {
         m_str = option_arg;
         m_type = eLookupTypeAddress;
-        m_addr = Args::StringToAddress(execution_context, option_arg,
-                                       LLDB_INVALID_ADDRESS, &error);
+        m_addr = OptionArgParser::ToAddress(execution_context, option_arg,
+                                            LLDB_INVALID_ADDRESS, &error);
         if (m_addr == LLDB_INVALID_ADDRESS)
           error.SetErrorStringWithFormat("invalid address string '%s'",
                                          option_arg.str().c_str());
@@ -3543,8 +3544,8 @@
       switch (short_option) {
       case 'a': {
         m_type = eLookupTypeAddress;
-        m_addr = Args::StringToAddress(execution_context, option_arg,
-                                       LLDB_INVALID_ADDRESS, &error);
+        m_addr = OptionArgParser::ToAddress(execution_context, option_arg,
+                                            LLDB_INVALID_ADDRESS, &error);
       } break;
 
       case 'o':
Index: source/Commands/CommandObjectSource.cpp
===================================================================
--- source/Commands/CommandObjectSource.cpp
+++ source/Commands/CommandObjectSource.cpp
@@ -22,6 +22,7 @@
 #include "lldb/Interpreter/CommandCompletions.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"
@@ -91,8 +92,8 @@
         break;
 
       case 'a': {
-        address = Args::StringToAddress(execution_context, option_arg,
-                                        LLDB_INVALID_ADDRESS, &error);
+        address = OptionArgParser::ToAddress(execution_context, option_arg,
+                                             LLDB_INVALID_ADDRESS, &error);
       } break;
       case 's':
         modules.push_back(std::string(option_arg));
@@ -709,8 +710,8 @@
         break;
 
       case 'a': {
-        address = Args::StringToAddress(execution_context, option_arg,
-                                        LLDB_INVALID_ADDRESS, &error);
+        address = OptionArgParser::ToAddress(execution_context, option_arg,
+                                             LLDB_INVALID_ADDRESS, &error);
       } break;
       case 's':
         modules.push_back(std::string(option_arg));
Index: source/Commands/CommandObjectProcess.cpp
===================================================================
--- source/Commands/CommandObjectProcess.cpp
+++ source/Commands/CommandObjectProcess.cpp
@@ -24,6 +24,7 @@
 #include "lldb/Interpreter/Args.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Interpreter/Options.h"
 #include "lldb/Target/Platform.h"
 #include "lldb/Target/Process.h"
@@ -756,7 +757,7 @@
       case 's':
         bool tmp_result;
         bool success;
-        tmp_result = Args::StringToBoolean(option_arg, false, &success);
+        tmp_result = OptionArgParser::ToBoolean(option_arg, false, &success);
         if (!success)
           error.SetErrorStringWithFormat("invalid boolean option: \"%s\"",
                                          option_arg.str().c_str());
@@ -1440,7 +1441,7 @@
   bool VerifyCommandOptionValue(const std::string &option, int &real_value) {
     bool okay = true;
     bool success = false;
-    bool tmp_value = Args::StringToBoolean(option, false, &success);
+    bool tmp_value = OptionArgParser::ToBoolean(option, false, &success);
 
     if (success && tmp_value)
       real_value = 1;
Index: source/Commands/CommandObjectMemory.cpp
===================================================================
--- source/Commands/CommandObjectMemory.cpp
+++ 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 @@
     }
 
     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 @@
     }
 
     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 @@
     }
 
     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 @@
     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 @@
         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 @@
     }
 
     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 @@
       } 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(),
Index: source/Commands/CommandObjectLog.cpp
===================================================================
--- source/Commands/CommandObjectLog.cpp
+++ source/Commands/CommandObjectLog.cpp
@@ -19,6 +19,7 @@
 #include "lldb/Interpreter/Args.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Interpreter/Options.h"
 #include "lldb/Symbol/LineTable.h"
 #include "lldb/Symbol/ObjectFile.h"
@@ -345,7 +346,7 @@
         }
       } else if (sub_command.equals_lower("increment")) {
         bool success;
-        bool increment = Args::StringToBoolean(param, false, &success);
+        bool increment = OptionArgParser::ToBoolean(param, false, &success);
         if (success) {
           Timer::SetQuiet(!increment);
           result.SetStatus(eReturnStatusSuccessFinishNoResult);
Index: source/Commands/CommandObjectExpression.cpp
===================================================================
--- source/Commands/CommandObjectExpression.cpp
+++ source/Commands/CommandObjectExpression.cpp
@@ -27,6 +27,7 @@
 #include "lldb/Host/OptionParser.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/Variable.h"
 #include "lldb/Target/Language.h"
@@ -88,7 +89,7 @@
   case 'a': {
     bool success;
     bool result;
-    result = Args::StringToBoolean(option_arg, true, &success);
+    result = OptionArgParser::ToBoolean(option_arg, true, &success);
     if (!success)
       error.SetErrorStringWithFormat(
           "invalid all-threads value setting: \"%s\"",
@@ -99,7 +100,7 @@
 
   case 'i': {
     bool success;
-    bool tmp_value = Args::StringToBoolean(option_arg, true, &success);
+    bool tmp_value = OptionArgParser::ToBoolean(option_arg, true, &success);
     if (success)
       ignore_breakpoints = tmp_value;
     else
@@ -111,7 +112,7 @@
 
   case 'j': {
     bool success;
-    bool tmp_value = Args::StringToBoolean(option_arg, true, &success);
+    bool tmp_value = OptionArgParser::ToBoolean(option_arg, true, &success);
     if (success)
       allow_jit = tmp_value;
     else
@@ -131,7 +132,7 @@
 
   case 'u': {
     bool success;
-    bool tmp_value = Args::StringToBoolean(option_arg, true, &success);
+    bool tmp_value = OptionArgParser::ToBoolean(option_arg, true, &success);
     if (success)
       unwind_on_error = tmp_value;
     else
@@ -146,8 +147,8 @@
       m_verbosity = eLanguageRuntimeDescriptionDisplayVerbosityFull;
       break;
     }
-    m_verbosity =
-        (LanguageRuntimeDescriptionDisplayVerbosity)Args::StringToOptionEnum(
+    m_verbosity = (LanguageRuntimeDescriptionDisplayVerbosity)
+        OptionArgParser::ToOptionEnum(
             option_arg, GetDefinitions()[option_idx].enum_values, 0, error);
     if (!error.Success())
       error.SetErrorStringWithFormat(
@@ -167,7 +168,7 @@
 
   case 'X': {
     bool success;
-    bool tmp_value = Args::StringToBoolean(option_arg, true, &success);
+    bool tmp_value = OptionArgParser::ToBoolean(option_arg, true, &success);
     if (success)
       auto_apply_fixits = tmp_value ? eLazyBoolYes : eLazyBoolNo;
     else
Index: source/Commands/CommandObjectDisassemble.cpp
===================================================================
--- source/Commands/CommandObjectDisassemble.cpp
+++ source/Commands/CommandObjectDisassemble.cpp
@@ -20,6 +20,7 @@
 #include "lldb/Interpreter/CommandCompletions.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Interpreter/Options.h"
 #include "lldb/Symbol/Function.h"
 #include "lldb/Symbol/Symbol.h"
@@ -101,14 +102,14 @@
     break;
 
   case 's': {
-    start_addr = Args::StringToAddress(execution_context, option_arg,
-                                       LLDB_INVALID_ADDRESS, &error);
+    start_addr = OptionArgParser::ToAddress(execution_context, option_arg,
+                                            LLDB_INVALID_ADDRESS, &error);
     if (start_addr != LLDB_INVALID_ADDRESS)
       some_location_specified = true;
   } break;
   case 'e': {
-    end_addr = Args::StringToAddress(execution_context, option_arg,
-                                     LLDB_INVALID_ADDRESS, &error);
+    end_addr = OptionArgParser::ToAddress(execution_context, option_arg,
+                                          LLDB_INVALID_ADDRESS, &error);
     if (end_addr != LLDB_INVALID_ADDRESS)
       some_location_specified = true;
   } break;
@@ -168,7 +169,7 @@
     break;
 
   case 'a': {
-    symbol_containing_addr = Args::StringToAddress(
+    symbol_containing_addr = OptionArgParser::ToAddress(
         execution_context, option_arg, LLDB_INVALID_ADDRESS, &error);
     if (symbol_containing_addr != LLDB_INVALID_ADDRESS) {
       some_location_specified = true;
Index: source/Commands/CommandObjectCommands.cpp
===================================================================
--- source/Commands/CommandObjectCommands.cpp
+++ source/Commands/CommandObjectCommands.cpp
@@ -23,6 +23,7 @@
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandObjectRegexCommand.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Interpreter/OptionValueBoolean.h"
 #include "lldb/Interpreter/OptionValueString.h"
 #include "lldb/Interpreter/OptionValueUInt64.h"
@@ -1639,7 +1640,7 @@
         break;
       case 's':
         m_synchronicity =
-            (ScriptedCommandSynchronicity)Args::StringToOptionEnum(
+            (ScriptedCommandSynchronicity)OptionArgParser::ToOptionEnum(
                 option_arg, GetDefinitions()[option_idx].enum_values, 0, error);
         if (!error.Success())
           error.SetErrorStringWithFormat(
Index: source/Commands/CommandObjectBreakpointCommand.cpp
===================================================================
--- source/Commands/CommandObjectBreakpointCommand.cpp
+++ source/Commands/CommandObjectBreakpointCommand.cpp
@@ -22,6 +22,7 @@
 #include "lldb/Host/OptionParser.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 
@@ -293,7 +294,7 @@
         break;
 
       case 's':
-        m_script_language = (lldb::ScriptLanguage)Args::StringToOptionEnum(
+        m_script_language = (lldb::ScriptLanguage)OptionArgParser::ToOptionEnum(
             option_arg, g_breakpoint_add_options[option_idx].enum_values,
             eScriptLanguageNone, error);
 
@@ -307,7 +308,8 @@
 
       case 'e': {
         bool success = false;
-        m_stop_on_error = Args::StringToBoolean(option_arg, false, &success);
+        m_stop_on_error =
+            OptionArgParser::ToBoolean(option_arg, false, &success);
         if (!success)
           error.SetErrorStringWithFormat(
               "invalid value for stop-on-error: \"%s\"",
Index: source/Commands/CommandObjectBreakpoint.cpp
===================================================================
--- source/Commands/CommandObjectBreakpoint.cpp
+++ source/Commands/CommandObjectBreakpoint.cpp
@@ -22,6 +22,7 @@
 #include "lldb/Interpreter/CommandCompletions.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Interpreter/OptionValueBoolean.h"
 #include "lldb/Interpreter/OptionValueString.h"
 #include "lldb/Interpreter/OptionValueUInt64.h"
@@ -100,7 +101,7 @@
       break;
     case 'G': {
       bool value, success;
-      value = Args::StringToBoolean(option_arg, false, &success);
+      value = OptionArgParser::ToBoolean(option_arg, false, &success);
       if (success) {
         m_bp_opts.SetAutoContinue(value);
       } else
@@ -121,7 +122,7 @@
     break;
     case 'o': {
       bool value, success;
-      value = Args::StringToBoolean(option_arg, false, &success);
+      value = OptionArgParser::ToBoolean(option_arg, false, &success);
       if (success) {
         m_bp_opts.SetOneShot(value);
       } else
@@ -377,8 +378,8 @@
 
       switch (short_option) {
       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 'A':
@@ -442,7 +443,7 @@
         
       case 'h': {
         bool success;
-        m_catch_bp = Args::StringToBoolean(option_arg, true, &success);
+        m_catch_bp = OptionArgParser::ToBoolean(option_arg, true, &success);
         if (!success)
           error.SetErrorStringWithFormat(
               "Invalid boolean value for on-catch option: '%s'",
@@ -456,7 +457,7 @@
       case 'K': {
         bool success;
         bool value;
-        value = Args::StringToBoolean(option_arg, true, &success);
+        value = OptionArgParser::ToBoolean(option_arg, true, &success);
         if (value)
           m_skip_prologue = eLazyBoolYes;
         else
@@ -485,7 +486,7 @@
       case 'm': {
         bool success;
         bool value;
-        value = Args::StringToBoolean(option_arg, true, &success);
+        value = OptionArgParser::ToBoolean(option_arg, true, &success);
         if (value)
           m_move_to_nearest_code = eLazyBoolYes;
         else
@@ -519,8 +520,8 @@
 
       case 'R': {
         lldb::addr_t tmp_offset_addr;
-        tmp_offset_addr =
-            Args::StringToAddress(execution_context, option_arg, 0, &error);
+        tmp_offset_addr = OptionArgParser::ToAddress(execution_context,
+                                                     option_arg, 0, &error);
         if (error.Success())
           m_offset_addr = tmp_offset_addr;
       } break;
@@ -549,7 +550,7 @@
 
       case 'w': {
         bool success;
-        m_throw_bp = Args::StringToBoolean(option_arg, true, &success);
+        m_throw_bp = OptionArgParser::ToBoolean(option_arg, true, &success);
         if (!success)
           error.SetErrorStringWithFormat(
               "Invalid boolean value for on-throw option: '%s'",
@@ -1783,7 +1784,7 @@
     switch (short_option) {
       case 'L': {
         bool value, success;
-        value = Args::StringToBoolean(option_arg, false, &success);
+        value = OptionArgParser::ToBoolean(option_arg, false, &success);
         if (success) {
           m_permissions.SetAllowList(value);
         } else
@@ -1793,7 +1794,7 @@
       } break;
       case 'A': {
         bool value, success;
-        value = Args::StringToBoolean(option_arg, false, &success);
+        value = OptionArgParser::ToBoolean(option_arg, false, &success);
         if (success) {
           m_permissions.SetAllowDisable(value);
         } else
@@ -1803,7 +1804,7 @@
       } break;
       case 'D': {
         bool value, success;
-        value = Args::StringToBoolean(option_arg, false, &success);
+        value = OptionArgParser::ToBoolean(option_arg, false, &success);
         if (success) {
           m_permissions.SetAllowDelete(value);
         } else
Index: source/API/SBDebugger.cpp
===================================================================
--- source/API/SBDebugger.cpp
+++ source/API/SBDebugger.cpp
@@ -47,6 +47,7 @@
 #include "lldb/Initialization/SystemLifetimeManager.h"
 #include "lldb/Interpreter/Args.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/OptionArgParser.h"
 #include "lldb/Interpreter/OptionGroupPlatform.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/TargetList.h"
@@ -480,8 +481,8 @@
 ScriptLanguage
 SBDebugger::GetScriptingLanguage(const char *script_language_name) {
   if (!script_language_name) return eScriptLanguageDefault;
-  return Args::StringToScriptLanguage(llvm::StringRef(script_language_name),
-                                      eScriptLanguageDefault, nullptr);
+  return OptionArgParser::ToScriptLanguage(
+      llvm::StringRef(script_language_name), eScriptLanguageDefault, nullptr);
 }
 
 const char *SBDebugger::GetVersionString() {
Index: include/lldb/Interpreter/Options.h
===================================================================
--- include/lldb/Interpreter/Options.h
+++ include/lldb/Interpreter/Options.h
@@ -18,6 +18,7 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Interpreter/Args.h"
+#include "lldb/Utility/Status.h"
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-private.h"
 
Index: include/lldb/Interpreter/OptionArgParser.h
===================================================================
--- /dev/null
+++ include/lldb/Interpreter/OptionArgParser.h
@@ -0,0 +1,43 @@
+//===-- OptionArgParser.h ---------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_INTERPRETER_OPTIONARGPARSER_H
+#define LLDB_INTERPRETER_OPTIONARGPARSER_H
+
+#include "lldb/lldb-private-types.h"
+
+namespace lldb_private {
+
+struct OptionArgParser {
+  static lldb::addr_t ToAddress(const ExecutionContext *exe_ctx,
+                                llvm::StringRef s, lldb::addr_t fail_value,
+                                Status *error);
+
+  static bool ToBoolean(llvm::StringRef s, bool fail_value, bool *success_ptr);
+
+  static char ToChar(llvm::StringRef s, char fail_value, bool *success_ptr);
+
+  static int64_t ToOptionEnum(llvm::StringRef s,
+                              OptionEnumValueElement *enum_values,
+                              int32_t fail_value, Status &error);
+
+  static lldb::ScriptLanguage ToScriptLanguage(llvm::StringRef s,
+                                               lldb::ScriptLanguage fail_value,
+                                               bool *success_ptr);
+
+  // TODO: Use StringRef
+  static Status ToFormat(const char *s, lldb::Format &format,
+                         size_t *byte_size_ptr); // If non-NULL, then a
+                                                 // byte size can precede
+                                                 // the format character
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_INTERPRETER_OPTIONARGPARSER_H
Index: include/lldb/Interpreter/Args.h
===================================================================
--- include/lldb/Interpreter/Args.h
+++ include/lldb/Interpreter/Args.h
@@ -12,7 +12,6 @@
 
 // C Includes
 // C++ Includes
-#include <list>
 #include <string>
 #include <utility>
 #include <vector>
@@ -22,7 +21,6 @@
 #include "llvm/ADT/StringRef.h"
 // Project includes
 #include "lldb/Utility/Environment.h"
-#include "lldb/Utility/Status.h"
 #include "lldb/lldb-private-types.h"
 #include "lldb/lldb-types.h"
 
@@ -343,30 +341,6 @@
     return min <= sval64 && sval64 <= max;
   }
 
-  static lldb::addr_t StringToAddress(const ExecutionContext *exe_ctx,
-                                      llvm::StringRef s,
-                                      lldb::addr_t fail_value, Status *error);
-
-  static bool StringToBoolean(llvm::StringRef s, bool fail_value,
-                              bool *success_ptr);
-
-  static char StringToChar(llvm::StringRef s, char fail_value,
-                           bool *success_ptr);
-
-  static int64_t StringToOptionEnum(llvm::StringRef s,
-                                    OptionEnumValueElement *enum_values,
-                                    int32_t fail_value, Status &error);
-
-  static lldb::ScriptLanguage
-  StringToScriptLanguage(llvm::StringRef s, lldb::ScriptLanguage fail_value,
-                         bool *success_ptr);
-
-  // TODO: Use StringRef
-  static Status StringToFormat(const char *s, lldb::Format &format,
-                               size_t *byte_size_ptr); // If non-NULL, then a
-                                                       // byte size can precede
-                                                       // the format character
-
   static lldb::Encoding
   StringToEncoding(llvm::StringRef s,
                    lldb::Encoding fail_value = lldb::eEncodingInvalid);
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to