[PATCH] D134843: [llvm-readobj] Improve JSON output

Paul Kirth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 17:11:48 PDT 2022


paulkirth created this revision.
paulkirth added a reviewer: jhenderson.
Herald added a project: All.
paulkirth requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.

The current implementation outputs JSON in the following way:

[{'<filename>':{'FileSummary':{},...}}]

Using the filename as a key makes processing the JSON data awkward, and
should be avoided. This patch removes that outer key, since the
'FileSummary' data also includes a 'File' field, and so we lose no data.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134843

Files:
  llvm/tools/llvm-readobj/ELFDumper.cpp


Index: llvm/tools/llvm-readobj/ELFDumper.cpp
===================================================================
--- llvm/tools/llvm-readobj/ELFDumper.cpp
+++ llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -7507,7 +7507,7 @@
 void JSONELFDumper<ELFT>::printFileSummary(StringRef FileStr, ObjectFile &Obj,
                                            ArrayRef<std::string> InputFilenames,
                                            const Archive *A) {
-  FileScope = std::make_unique<DictScope>(this->W, FileStr);
+  FileScope = std::make_unique<DictScope>(this->W);
   DictScope D(this->W, "FileSummary");
   this->W.printString("File", FileStr);
   this->W.printString("Format", Obj.getFileFormatName());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134843.463721.patch
Type: text/x-patch
Size: 700 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220929/a164bb88/attachment.bin>


More information about the llvm-commits mailing list