summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-10-02 18:02:26 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-10-02 18:02:26 +0000
commit2a5a906753d78357bf627cd6547d3250ca6c8388 (patch)
tree0dab0675ea6a1d35b89ea90be74de7aa8ca27601
parent9beb45671bac3a2ff12e4edba3de2a6c7d2d9ca4 (diff)
downloadbcm5719-llvm-2a5a906753d78357bf627cd6547d3250ca6c8388.tar.gz
bcm5719-llvm-2a5a906753d78357bf627cd6547d3250ca6c8388.zip
[JSON] Use LLVM's library for encoding JSON in GDBRemoteCommunicationClient
This patch replaces the LLDB's JSON implementation with the one from LLVM in GDBRemoteCommunicationClient. Differential revision: https://reviews.llvm.org/D68301 llvm-svn: 373498
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 40a88fb7de7..63d0522da3b 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -23,7 +23,6 @@
#include "lldb/Target/UnixSignals.h"
#include "lldb/Utility/Args.h"
#include "lldb/Utility/DataBufferHeap.h"
-#include "lldb/Utility/JSON.h"
#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/State.h"
@@ -35,14 +34,15 @@
#include "lldb/Utility/StringExtractorGDBRemote.h"
#include "llvm/ADT/StringSwitch.h"
+#include "llvm/Support/JSON.h"
#if defined(HAVE_LIBCOMPRESSION)
#include <compression.h>
#endif
using namespace lldb;
-using namespace lldb_private;
using namespace lldb_private::process_gdb_remote;
+using namespace lldb_private;
using namespace std::chrono;
// GDBRemoteCommunicationClient constructor
@@ -3609,21 +3609,21 @@ ParseModuleSpec(StructuredData::Dictionary *dict) {
llvm::Optional<std::vector<ModuleSpec>>
GDBRemoteCommunicationClient::GetModulesInfo(
llvm::ArrayRef<FileSpec> module_file_specs, const llvm::Triple &triple) {
+ namespace json = llvm::json;
+
if (!m_supports_jModulesInfo)
return llvm::None;
- JSONArray::SP module_array_sp = std::make_shared<JSONArray>();
+ json::Array module_array;
for (const FileSpec &module_file_spec : module_file_specs) {
- JSONObject::SP module_sp = std::make_shared<JSONObject>();
- module_array_sp->AppendObject(module_sp);
- module_sp->SetObject(
- "file", std::make_shared<JSONString>(module_file_spec.GetPath(false)));
- module_sp->SetObject("triple",
- std::make_shared<JSONString>(triple.getTriple()));
+ module_array.push_back(
+ json::Object{{"file", module_file_spec.GetPath(false)},
+ {"triple", triple.getTriple()}});
}
StreamString unescaped_payload;
unescaped_payload.PutCString("jModulesInfo:");
- module_array_sp->Write(unescaped_payload);
+ unescaped_payload.AsRawOstream() << std::move(module_array);
+
StreamGDBRemote payload;
payload.PutEscapedBytes(unescaped_payload.GetString().data(),
unescaped_payload.GetSize());
OpenPOWER on IntegriCloud