diff --git a/lldb/include/lldb/module.modulemap b/lldb/include/lldb/module.modulemap --- a/lldb/include/lldb/module.modulemap +++ b/lldb/include/lldb/module.modulemap @@ -48,7 +48,6 @@ module SafeMachO { header "Host/SafeMachO.h" export * } module SocketAddress { header "Host/SocketAddress.h" export * } module Socket { header "Host/Socket.h" export * } - module StringConvert { textual header "Host/StringConvert.h" export * } module Terminal { header "Host/Terminal.h" export * } module ThreadLauncher { header "Host/ThreadLauncher.h" export * } module Time { header "Host/Time.h" export * } diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt --- a/lldb/source/Host/CMakeLists.txt +++ b/lldb/source/Host/CMakeLists.txt @@ -37,7 +37,6 @@ common/PseudoTerminal.cpp common/SocketAddress.cpp common/Socket.cpp - common/StringConvert.cpp common/TCPSocket.cpp common/Terminal.cpp common/ThreadLauncher.cpp diff --git a/lldb/tools/debugserver/source/CMakeLists.txt b/lldb/tools/debugserver/source/CMakeLists.txt --- a/lldb/tools/debugserver/source/CMakeLists.txt +++ b/lldb/tools/debugserver/source/CMakeLists.txt @@ -206,8 +206,8 @@ DNBThreadResumeActions.cpp JSON.cpp StdStringExtractor.cpp + StringConvert.cpp # JSON reader depends on the following LLDB-common files - ${LLDB_SOURCE_DIR}/source/Host/common/StringConvert.cpp ${LLDB_SOURCE_DIR}/source/Host/common/SocketAddress.cpp # end JSON reader dependencies libdebugserver.cpp diff --git a/lldb/tools/debugserver/source/JSON.cpp b/lldb/tools/debugserver/source/JSON.cpp --- a/lldb/tools/debugserver/source/JSON.cpp +++ b/lldb/tools/debugserver/source/JSON.cpp @@ -13,12 +13,10 @@ #include // C++ includes -#include "lldb/Host/StringConvert.h" +#include "StringConvert.h" #include #include -using namespace lldb_private; - std::string JSONString::json_string_quote_metachars(const std::string &s) { if (s.find('"') == std::string::npos) return s; diff --git a/lldb/include/lldb/Host/StringConvert.h b/lldb/tools/debugserver/source/StringConvert.h rename from lldb/include/lldb/Host/StringConvert.h rename to lldb/tools/debugserver/source/StringConvert.h --- a/lldb/include/lldb/Host/StringConvert.h +++ b/lldb/tools/debugserver/source/StringConvert.h @@ -6,24 +6,13 @@ // //===----------------------------------------------------------------------===// -#ifndef LLDB_HOST_STRINGCONVERT_H -#define LLDB_HOST_STRINGCONVERT_H +#ifndef LLDB_TOOLS_DEBUGSERVER_SOURCE_STRINGCONVERT_H +#define LLDB_TOOLS_DEBUGSERVER_SOURCE_STRINGCONVERT_H #include -namespace lldb_private { - namespace StringConvert { -/// \namespace StringConvert StringConvert.h "lldb/Host/StringConvert.h" -/// Utility classes for converting strings into Integers - -int32_t ToSInt32(const char *s, int32_t fail_value = 0, int base = 0, - bool *success_ptr = nullptr); - -uint32_t ToUInt32(const char *s, uint32_t fail_value = 0, int base = 0, - bool *success_ptr = nullptr); - int64_t ToSInt64(const char *s, int64_t fail_value = 0, int base = 0, bool *success_ptr = nullptr); @@ -32,7 +21,7 @@ double ToDouble(const char *s, double fail_value = 0.0, bool *success_ptr = nullptr); + } // namespace StringConvert -} // namespace lldb_private #endif diff --git a/lldb/source/Host/common/StringConvert.cpp b/lldb/tools/debugserver/source/StringConvert.cpp rename from lldb/source/Host/common/StringConvert.cpp rename to lldb/tools/debugserver/source/StringConvert.cpp --- a/lldb/source/Host/common/StringConvert.cpp +++ b/lldb/tools/debugserver/source/StringConvert.cpp @@ -8,43 +8,10 @@ #include -#include "lldb/Host/StringConvert.h" +#include "StringConvert.h" -namespace lldb_private { namespace StringConvert { -int32_t ToSInt32(const char *s, int32_t fail_value, int base, - bool *success_ptr) { - if (s && s[0]) { - char *end = nullptr; - const long sval = ::strtol(s, &end, base); - if (*end == '\0') { - if (success_ptr) - *success_ptr = ((sval <= INT32_MAX) && (sval >= INT32_MIN)); - return (int32_t)sval; // All characters were used, return the result - } - } - if (success_ptr) - *success_ptr = false; - return fail_value; -} - -uint32_t ToUInt32(const char *s, uint32_t fail_value, int base, - bool *success_ptr) { - if (s && s[0]) { - char *end = nullptr; - const unsigned long uval = ::strtoul(s, &end, base); - if (*end == '\0') { - if (success_ptr) - *success_ptr = (uval <= UINT32_MAX); - return (uint32_t)uval; // All characters were used, return the result - } - } - if (success_ptr) - *success_ptr = false; - return fail_value; -} - int64_t ToSInt64(const char *s, int64_t fail_value, int base, bool *success_ptr) { if (s && s[0]) { @@ -91,5 +58,5 @@ *success_ptr = false; return fail_value; } -} -} + +} // namespace StringConvert