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) {
|
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,
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user