[Lldb-commits] [PATCH] D68279: [JSON] Use LLVM's library for argdumper
Jonas Devlieghere via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 1 09:33:43 PDT 2019
JDevlieghere created this revision.
JDevlieghere added reviewers: vsk, labath, aprantl.
Herald added a subscriber: mgorny.
Herald added a project: LLDB.
This patch replaces the LLDB's JSON implementation with the one from LLVM in argdumper.
Repository:
rLLDB LLDB
https://reviews.llvm.org/D68279
Files:
lldb/tools/argdumper/CMakeLists.txt
lldb/tools/argdumper/argdumper.cpp
Index: lldb/tools/argdumper/argdumper.cpp
===================================================================
--- lldb/tools/argdumper/argdumper.cpp
+++ lldb/tools/argdumper/argdumper.cpp
@@ -6,27 +6,15 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/Utility/JSON.h"
-#include "lldb/Utility/StreamString.h"
+#include "llvm/Support/JSON.h"
-#include <iostream>
-
-using namespace lldb_private;
+using namespace llvm;
int main(int argc, char *argv[]) {
- JSONArray::SP arguments(new JSONArray());
+ json::Array Arguments;
for (int i = 1; i < argc; i++) {
- arguments->AppendObject(JSONString::SP(new JSONString(argv[i])));
+ Arguments.push_back(argv[i]);
}
-
- JSONObject::SP object(new JSONObject());
- object->SetObject("arguments", arguments);
-
- StreamString ss;
-
- object->Write(ss);
-
- std::cout << ss.GetData() << std::endl;
-
+ llvm::outs() << json::Object({{"arguments", std::move(Arguments)}});
return 0;
}
Index: lldb/tools/argdumper/CMakeLists.txt
===================================================================
--- lldb/tools/argdumper/CMakeLists.txt
+++ lldb/tools/argdumper/CMakeLists.txt
@@ -1,6 +1,6 @@
add_lldb_tool(lldb-argdumper ADD_TO_FRAMEWORK
argdumper.cpp
- LINK_LIBS
- lldbUtility
+ LINK_COMPONENTS
+ Support
)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68279.222639.patch
Type: text/x-patch
Size: 1344 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191001/8f5b40de/attachment.bin>
More information about the lldb-commits
mailing list