[lldb] Convert misc. StringConvert uses

Replace misc. StringConvert uses with llvm::to_integer()
and llvm::to_float(), except for cases where further refactoring is
planned.  The purpose of this change is to eliminate the StringConvert
API that is duplicate to LLVM, and less correct in behavior at the same
time.

Differential Revision: https://reviews.llvm.org/D110447
This commit is contained in:
Michał Górny
2021-09-24 23:36:49 +02:00
parent 2c28e3f008
commit 3a6ba36751
16 changed files with 106 additions and 138 deletions

View File

@@ -17,7 +17,6 @@
#include "lldb/DataFormatters/DumpValueObjectOptions.h"
#include "lldb/Expression/UserExpression.h"
#include "lldb/Host/OptionParser.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandObjectMultiword.h"
#include "lldb/Interpreter/CommandReturnObject.h"
@@ -4566,10 +4565,8 @@ public:
eLanguageTypeExtRenderScript));
const char *id_cstr = command.GetArgumentAtIndex(0);
bool success = false;
const uint32_t id =
StringConvert::ToUInt32(id_cstr, UINT32_MAX, 0, &success);
if (!success) {
uint32_t id;
if (!llvm::to_integer(id_cstr, id)) {
result.AppendErrorWithFormat("invalid allocation id argument '%s'",
id_cstr);
return false;
@@ -4713,10 +4710,8 @@ public:
eLanguageTypeExtRenderScript));
const char *id_cstr = command.GetArgumentAtIndex(0);
bool success = false;
const uint32_t id =
StringConvert::ToUInt32(id_cstr, UINT32_MAX, 0, &success);
if (!success) {
uint32_t id;
if (!llvm::to_integer(id_cstr, id)) {
result.AppendErrorWithFormat("invalid allocation id argument '%s'",
id_cstr);
return false;
@@ -4762,10 +4757,8 @@ public:
eLanguageTypeExtRenderScript));
const char *id_cstr = command.GetArgumentAtIndex(0);
bool success = false;
const uint32_t id =
StringConvert::ToUInt32(id_cstr, UINT32_MAX, 0, &success);
if (!success) {
uint32_t id;
if (!llvm::to_integer(id_cstr, id)) {
result.AppendErrorWithFormat("invalid allocation id argument '%s'",
id_cstr);
return false;