Merge "[header-checker] Use new jsoncpp API"
This commit is contained in:
@@ -362,10 +362,9 @@ bool JsonIRDumper::AddElfSymbolMessageIR(const ElfSymbolIR *elf_symbol_ir) {
|
||||
}
|
||||
|
||||
static std::string DumpJson(const JsonObject &obj) {
|
||||
std::ostringstream output_stream;
|
||||
Json::StyledStreamWriter writer(/* indentation */ " ");
|
||||
writer.write(output_stream, obj);
|
||||
return output_stream.str();
|
||||
Json::StreamWriterBuilder factory;
|
||||
factory["indentation"] = " ";
|
||||
return Json::writeString(factory, obj);
|
||||
}
|
||||
|
||||
static void WriteTailTrimmedLinesToFile(const std::string &path,
|
||||
|
||||
@@ -154,12 +154,13 @@ GetElfSymbolBinding(const JsonObjectRef &elf_symbol) {
|
||||
|
||||
bool JsonIRReader::ReadDumpImpl(const std::string &dump_file) {
|
||||
Json::Value tu_json;
|
||||
Json::Reader reader;
|
||||
Json::CharReaderBuilder builder;
|
||||
builder["collectComments"] = false;
|
||||
std::ifstream input(dump_file);
|
||||
|
||||
if (!reader.parse(input, tu_json, /* collectComments */ false)) {
|
||||
llvm::errs() << "Failed to parse JSON: "
|
||||
<< reader.getFormattedErrorMessages() << "\n";
|
||||
std::string errorMessage;
|
||||
if (!Json::parseFromStream(builder, input, &tu_json, &errorMessage)) {
|
||||
llvm::errs() << "Failed to parse JSON: " << errorMessage << "\n";
|
||||
return false;
|
||||
}
|
||||
bool ok = true;
|
||||
|
||||
Reference in New Issue
Block a user