[Lldb-commits] [lldb] r373656 - [JSON] Don't wrap json::Array in a value (NFC)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 3 13:10:56 PDT 2019


Author: jdevlieghere
Date: Thu Oct  3 13:10:56 2019
New Revision: 373656

URL: http://llvm.org/viewvc/llvm-project?rev=373656&view=rev
Log:
[JSON] Don't wrap json::Array in a value (NFC)

There's no need to wrap the just-constructed json::Array in a
json::Value, we can just return that and pass ownership to the
raw_ostream.

Modified:
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp?rev=373656&r1=373655&r2=373656&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp Thu Oct  3 13:10:56 2019
@@ -493,7 +493,7 @@ static const char *GetStopReasonString(S
   return nullptr;
 }
 
-static llvm::Expected<json::Value>
+static llvm::Expected<json::Array>
 GetJSONThreadsInfo(NativeProcessProtocol &process, bool abridged) {
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD));
 
@@ -660,12 +660,12 @@ GDBRemoteCommunicationServerLLGS::SendSt
     // thread otherwise this packet has all the info it needs.
     if (thread_index > 1) {
       const bool threads_with_valid_stop_info_only = true;
-      llvm::Expected<json::Value> threads_info = GetJSONThreadsInfo(
+      llvm::Expected<json::Array> threads_info = GetJSONThreadsInfo(
           *m_debugged_process_up, threads_with_valid_stop_info_only);
       if (threads_info) {
         response.PutCString("jstopinfo:");
         StreamString unescaped_response;
-        unescaped_response.AsRawOstream() << *threads_info;
+        unescaped_response.AsRawOstream() << std::move(*threads_info);
         response.PutStringAsRawHex8(unescaped_response.GetData());
         response.PutChar(';');
       } else {




More information about the lldb-commits mailing list