summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-02-14 19:07:01 +0000
committerZachary Turner <zturner@google.com>2017-02-14 19:07:01 +0000
commit70049b7cabd6d3ed49c5fc593681646f457b56bd (patch)
tree833f155df526cde2f36d9a0b37ca4833976613a7
parent4074b6b6864e2bef4206374400031c7d0c17cf4f (diff)
downloadbcm5719-llvm-70049b7cabd6d3ed49c5fc593681646f457b56bd.tar.gz
bcm5719-llvm-70049b7cabd6d3ed49c5fc593681646f457b56bd.zip
Use StringRef and APFloat instead of lldb/StringConvert.h
llvm-svn: 295091
-rw-r--r--lldb/source/Utility/JSON.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/lldb/source/Utility/JSON.cpp b/lldb/source/Utility/JSON.cpp
index dcfb9d4b08f..ffcd72de113 100644
--- a/lldb/source/Utility/JSON.cpp
+++ b/lldb/source/Utility/JSON.cpp
@@ -9,7 +9,9 @@
#include "lldb/Utility/JSON.h"
-#include "lldb/Host/StringConvert.h"
+#include "llvm/ADT/APFloat.h"
+#include "llvm/ADT/StringRef.h"
+
#include "lldb/Utility/StreamString.h"
#include "llvm/Support/ErrorHandling.h"
#include <limits.h>
@@ -512,23 +514,20 @@ JSONValue::SP JSONParser::ParseJSONValue() {
case JSONParser::Token::Integer: {
if (value.front() == '-') {
- bool success = false;
- int64_t sval = StringConvert::ToSInt64(value.c_str(), 0, 0, &success);
- if (success)
+ int64_t sval = 0;
+ if (!llvm::StringRef(value).getAsInteger(0, sval))
return JSONValue::SP(new JSONNumber(sval));
} else {
- bool success = false;
- uint64_t uval = StringConvert::ToUInt64(value.c_str(), 0, 0, &success);
- if (success)
+ uint64_t uval = 0;
+ if (!llvm::StringRef(value).getAsInteger(0, uval))
return JSONValue::SP(new JSONNumber(uval));
}
} break;
case JSONParser::Token::Float: {
- bool success = false;
- double val = StringConvert::ToDouble(value.c_str(), 0.0, &success);
- if (success)
- return JSONValue::SP(new JSONNumber(val));
+ double D;
+ if (!llvm::StringRef(value).getAsDouble(D))
+ return JSONValue::SP(new JSONNumber(D));
} break;
case JSONParser::Token::String:
OpenPOWER on IntegriCloud