Merge "[header-checker] Use new jsoncpp API" am: 1252a2c311

Original change: https://android-review.googlesource.com/c/platform/development/+/1627879

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ica4367fb44cfbf9ad7b32a7f9499792c299a65ca
This commit is contained in:
Haibo Huang
2021-03-11 19:07:44 +00:00
committed by Automerger Merge Worker
2 changed files with 8 additions and 8 deletions

View File

@@ -362,10 +362,9 @@ bool JsonIRDumper::AddElfSymbolMessageIR(const ElfSymbolIR *elf_symbol_ir) {
} }
static std::string DumpJson(const JsonObject &obj) { static std::string DumpJson(const JsonObject &obj) {
std::ostringstream output_stream; Json::StreamWriterBuilder factory;
Json::StyledStreamWriter writer(/* indentation */ " "); factory["indentation"] = " ";
writer.write(output_stream, obj); return Json::writeString(factory, obj);
return output_stream.str();
} }
static void WriteTailTrimmedLinesToFile(const std::string &path, static void WriteTailTrimmedLinesToFile(const std::string &path,

View File

@@ -154,12 +154,13 @@ GetElfSymbolBinding(const JsonObjectRef &elf_symbol) {
bool JsonIRReader::ReadDumpImpl(const std::string &dump_file) { bool JsonIRReader::ReadDumpImpl(const std::string &dump_file) {
Json::Value tu_json; Json::Value tu_json;
Json::Reader reader; Json::CharReaderBuilder builder;
builder["collectComments"] = false;
std::ifstream input(dump_file); std::ifstream input(dump_file);
if (!reader.parse(input, tu_json, /* collectComments */ false)) { std::string errorMessage;
llvm::errs() << "Failed to parse JSON: " if (!Json::parseFromStream(builder, input, &tu_json, &errorMessage)) {
<< reader.getFormattedErrorMessages() << "\n"; llvm::errs() << "Failed to parse JSON: " << errorMessage << "\n";
return false; return false;
} }
bool ok = true; bool ok = true;