Skip to content

Commit 6f9cc12

Browse files
Kevin Freikevinfrei
authored andcommitted
Fixed JSON output to be...JSON.
1 parent 91b1af6 commit 6f9cc12

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

llvm/tools/llvm-gsymutil/llvm-gsymutil.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -527,20 +527,23 @@ int llvm_gsymutil_main(int argc, char **argv, const llvm::ToolContext &) {
527527
});
528528
if (!AggregateJsonFile.empty()) {
529529
std::error_code EC;
530-
raw_fd_ostream JsonStream(AggregateJsonFile, EC,
531-
sys::fs::OF_Text | sys::fs::OF_None);
530+
raw_fd_ostream JsonStream(AggregateJsonFile, EC, sys::fs::OF_Text);
532531
if (EC) {
533532
OS << "error opening aggregate error json file '" << AggregateJsonFile
534533
<< "' for writing: " << EC.message() << '\n';
535534
return 1;
536535
}
537536
JsonStream << "{\"errors\":[\n";
537+
bool prev = false;
538538
Aggregation.EnumerateResults([&](StringRef category, unsigned count) {
539-
JsonStream << "\"category\":\"";
539+
if (prev)
540+
JsonStream << ",\n";
541+
JsonStream << "{\"category\":\"";
540542
llvm::printEscapedString(category, JsonStream);
541-
JsonStream << "\",\"count\":" << count;
543+
JsonStream << "\",\"count\":" << count << "}";
544+
prev = true;
542545
});
543-
JsonStream << "]}\n";
546+
JsonStream << "\n]}\n";
544547
}
545548
return 0;
546549
}

0 commit comments

Comments
 (0)