void *m_object;
};
- static ObjectSP ParseJSON(const std::string &json_text);
+ static ObjectSP ParseJSON(llvm::StringRef json_text);
static ObjectSP ParseJSONFromFile(const FileSpec &file, Status &error);
static bool IsRecordType(const ObjectSP object_sp);
};
m_opaque_sp->DumpAllPropertyValues(&exe_ctx, json_strm, /*dump_mask*/ 0,
/*is_json*/ true);
- data.m_impl_up->SetObjectSP(
- StructuredData::ParseJSON(json_strm.GetString().str()));
+ data.m_impl_up->SetObjectSP(StructuredData::ParseJSON(json_strm.GetString()));
return data;
}
LLDB_INSTRUMENT_VA(this, stream);
lldb::SBError error;
- std::string json_str(stream.GetData());
- StructuredData::ObjectSP json_obj = StructuredData::ParseJSON(json_str);
+ StructuredData::ObjectSP json_obj =
+ StructuredData::ParseJSON(stream.GetData());
m_impl_up->SetObjectSP(json_obj);
if (!json_obj || json_obj->GetType() != eStructuredDataTypeDictionary)
response.GetResponseType() != response.eResponse)
return m_remote_signals_sp;
- auto object_sp =
- StructuredData::ParseJSON(std::string(response.GetStringRef()));
+ auto object_sp = StructuredData::ParseJSON(response.GetStringRef());
if (!object_sp || !object_sp->IsValid())
return m_remote_signals_sp;
if (response.IsUnsupportedResponse()) {
m_supports_jThreadsInfo = false;
} else if (!response.Empty()) {
- object_sp =
- StructuredData::ParseJSON(std::string(response.GetStringRef()));
+ object_sp = StructuredData::ParseJSON(response.GetStringRef());
}
}
}
return 0;
StructuredData::ObjectSP data =
- StructuredData::ParseJSON(std::string(response.GetStringRef()));
+ StructuredData::ParseJSON(response.GetStringRef());
if (!data)
return 0;
}
StructuredData::ObjectSP response_object_sp =
- StructuredData::ParseJSON(std::string(response.GetStringRef()));
+ StructuredData::ParseJSON(response.GetStringRef());
if (!response_object_sp)
return std::nullopt;
if (SendPacketAndWaitForResponse("qStructuredDataPlugins", response) ==
PacketResult::Success) {
m_supported_async_json_packets_sp =
- StructuredData::ParseJSON(std::string(response.GetStringRef()));
+ StructuredData::ParseJSON(response.GetStringRef());
if (m_supported_async_json_packets_sp &&
!m_supported_async_json_packets_sp->GetAsArray()) {
// We were returned something other than a JSON array. This is
response.GetResponseType();
if (response_type == StringExtractorGDBRemote::eResponse) {
if (!response.Empty()) {
- object_sp =
- StructuredData::ParseJSON(std::string(response.GetStringRef()));
+ object_sp = StructuredData::ParseJSON(response.GetStringRef());
}
}
}
response.GetResponseType();
if (response_type == StringExtractorGDBRemote::eResponse) {
if (!response.Empty()) {
- object_sp =
- StructuredData::ParseJSON(std::string(response.GetStringRef()));
+ object_sp = StructuredData::ParseJSON(response.GetStringRef());
}
}
}
response.GetResponseType();
if (response_type == StringExtractorGDBRemote::eResponse) {
if (!response.Empty()) {
- object_sp =
- StructuredData::ParseJSON(std::string(response.GetStringRef()));
+ object_sp = StructuredData::ParseJSON(response.GetStringRef());
}
}
}
response.GetResponseType();
if (response_type == StringExtractorGDBRemote::eResponse) {
if (!response.Empty()) {
- object_sp =
- StructuredData::ParseJSON(std::string(response.GetStringRef()));
+ object_sp = StructuredData::ParseJSON(response.GetStringRef());
}
}
}
}
// This is an asynchronous JSON packet, destined for a StructuredDataPlugin.
- StructuredData::ObjectSP json_sp =
- StructuredData::ParseJSON(std::string(packet));
+ StructuredData::ObjectSP json_sp = StructuredData::ParseJSON(packet);
if (log) {
if (json_sp) {
StreamString json_str;
static StructuredData::ObjectSP ParseJSONObject(json::Object *object);
static StructuredData::ObjectSP ParseJSONArray(json::Array *array);
-StructuredData::ObjectSP
-StructuredData::ParseJSON(const std::string &json_text) {
+StructuredData::ObjectSP StructuredData::ParseJSON(llvm::StringRef json_text) {
llvm::Expected<json::Value> value = json::parse(json_text);
if (!value) {
llvm::consumeError(value.takeError());
server_thread.join();
GTEST_LOG_(INFO) << "Formatted output: " << ss.GetData();
- auto object_sp = StructuredData::ParseJSON(std::string(ss.GetString()));
+ auto object_sp = StructuredData::ParseJSON(ss.GetString());
ASSERT_TRUE(bool(object_sp));
auto dict_sp = object_sp->GetAsDictionary();
ASSERT_TRUE(bool(dict_sp));
ArrayRef<RegisterInfo> RegInfos) {
JThreadsInfo jthreads_info;
- StructuredData::ObjectSP json =
- StructuredData::ParseJSON(std::string(Response));
+ StructuredData::ObjectSP json = StructuredData::ParseJSON(Response);
StructuredData::Array *array = json->GetAsArray();
if (!array)
return make_parsing_error("JThreadsInfo: JSON array");