teemperor created this revision.
teemperor added a reviewer: LLDB.
Herald added subscribers: JDevlieghere, abidh.
teemperor edited the summary of this revision.
This replaces most uses of LLDB's own String to int/float conversion
implementation with
LLVM's to_integer. The only remaining code in LLDB that now still uses
StringConvert is
debugserver which can't use LLVM code, so I'll leave that part for a future
commit.
Unlike the other StringConvert patch this doesn't try to add any missing error
handling
but just does a NFC refactoring to `to_integer`.
Repository:
rLLDB LLDB
https://reviews.llvm.org/D82382
Files:
lldb/source/Host/common/Socket.cpp
lldb/source/Host/common/XML.cpp
lldb/source/Interpreter/OptionValueArray.cpp
lldb/source/Interpreter/OptionValueFileSpecList.cpp
lldb/source/Interpreter/OptionValuePathMappings.cpp
lldb/source/Interpreter/OptionValueSInt64.cpp
lldb/source/Interpreter/OptionValueUInt64.cpp
lldb/source/Interpreter/Property.cpp
lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp
lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Symbol/SymbolContext.cpp
lldb/source/Target/UnixSignals.cpp
lldb/unittests/debugserver/RNBSocketTest.cpp
Index: lldb/unittests/debugserver/RNBSocketTest.cpp
===
--- lldb/unittests/debugserver/RNBSocketTest.cpp
+++ lldb/unittests/debugserver/RNBSocketTest.cpp
@@ -15,7 +15,6 @@
#include "RNBDefs.h"
#include "RNBSocket.h"
#include "lldb/Host/Socket.h"
-#include "lldb/Host/StringConvert.h"
#include "lldb/Host/common/TCPSocket.h"
#include "llvm/Testing/Support/Error.h"
Index: lldb/source/Target/UnixSignals.cpp
===
--- lldb/source/Target/UnixSignals.cpp
+++ lldb/source/Target/UnixSignals.cpp
@@ -12,7 +12,6 @@
#include "Plugins/Process/Utility/MipsLinuxSignals.h"
#include "Plugins/Process/Utility/NetBSDSignals.h"
#include "lldb/Host/HostInfo.h"
-#include "lldb/Host/StringConvert.h"
#include "lldb/Utility/ArchSpec.h"
using namespace lldb_private;
@@ -162,9 +161,8 @@
return pos->first;
}
- const int32_t signo =
- StringConvert::ToSInt32(name, LLDB_INVALID_SIGNAL_NUMBER, 0);
- if (signo != LLDB_INVALID_SIGNAL_NUMBER)
+ int32_t signo;
+ if (llvm::to_integer(name, signo))
return signo;
return LLDB_INVALID_SIGNAL_NUMBER;
}
Index: lldb/source/Symbol/SymbolContext.cpp
===
--- lldb/source/Symbol/SymbolContext.cpp
+++ lldb/source/Symbol/SymbolContext.cpp
@@ -11,7 +11,6 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Host/Host.h"
-#include "lldb/Host/StringConvert.h"
#include "lldb/Symbol/Block.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/ObjectFile.h"
@@ -972,12 +971,12 @@
m_type |= eFileSpecified;
break;
case eLineStartSpecified:
-m_start_line = StringConvert::ToSInt32(spec_string, 0, 0, _value);
+return_value = llvm::to_integer(spec_string, m_start_line);
if (return_value)
m_type |= eLineStartSpecified;
break;
case eLineEndSpecified:
-m_end_line = StringConvert::ToSInt32(spec_string, 0, 0, _value);
+return_value = llvm::to_integer(spec_string, m_end_line);
if (return_value)
m_type |= eLineEndSpecified;
break;
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -9,7 +9,6 @@
#include "DWARFUnit.h"
#include "lldb/Core/Module.h"
-#include "lldb/Host/StringConvert.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/StreamString.h"
@@ -616,12 +615,12 @@
llvm::SmallVector matches;
if (g_clang_version_regex.Execute(llvm::StringRef(producer_cstr),
)) {
- m_producer_version_major =
- StringConvert::ToUInt32(matches[1].str().c_str(), UINT32_MAX, 10);
- m_producer_version_minor =
- StringConvert::ToUInt32(matches[2].str().c_str(), UINT32_MAX, 10);
- m_producer_version_update =
- StringConvert::ToUInt32(matches[3].str().c_str(), UINT32_MAX, 10);
+ if (!llvm::to_integer(matches[1], m_producer_version_major))
+m_producer_version_major = UINT32_MAX;
+ if (!llvm::to_integer(matches[2], m_producer_version_minor))
+m_producer_version_minor = UINT32_MAX;
+ if (!llvm::to_integer(matches[3],