[Lldb-commits] [lldb] r373361 - [JSON] Use LLVM's library for argdumper
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 1 10:41:55 PDT 2019
Author: jdevlieghere
Date: Tue Oct 1 10:41:55 2019
New Revision: 373361
URL: http://llvm.org/viewvc/llvm-project?rev=373361&view=rev
Log:
[JSON] Use LLVM's library for argdumper
This patch replaces the LLDB's JSON implementation with the one from
LLVM in argdumper.
Differential revision: https://reviews.llvm.org/D68279
Modified:
lldb/trunk/tools/argdumper/CMakeLists.txt
lldb/trunk/tools/argdumper/argdumper.cpp
Modified: lldb/trunk/tools/argdumper/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/argdumper/CMakeLists.txt?rev=373361&r1=373360&r2=373361&view=diff
==============================================================================
--- lldb/trunk/tools/argdumper/CMakeLists.txt (original)
+++ lldb/trunk/tools/argdumper/CMakeLists.txt Tue Oct 1 10:41:55 2019
@@ -1,6 +1,6 @@
add_lldb_tool(lldb-argdumper ADD_TO_FRAMEWORK
argdumper.cpp
- LINK_LIBS
- lldbUtility
+ LINK_COMPONENTS
+ Support
)
Modified: lldb/trunk/tools/argdumper/argdumper.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/argdumper/argdumper.cpp?rev=373361&r1=373360&r2=373361&view=diff
==============================================================================
--- lldb/trunk/tools/argdumper/argdumper.cpp (original)
+++ lldb/trunk/tools/argdumper/argdumper.cpp Tue Oct 1 10:41:55 2019
@@ -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;
}
More information about the lldb-commits
mailing list