[JSONExporter] Print instead of ignoring parser error.
Silence the warning
warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
JSONExporter is a developer tool, there is no mechanism for error
handling. Print the parser error and abort with a fatal error.
@@ -723,9 +723,10 @@ static bool importScop(Scop &S, const Dependences &D, const DataLayout &DL,
Expected<json::Value> ParseResult =
json::parse(result.get().get()->getBuffer());
- if (!ParseResult) {
- ParseResult.takeError();
+ if (Error E = ParseResult.takeError()) {
errs() << "JSCoP file could not be parsed\n";
+ errs() << E << "\n";
+ consumeError(std::move(E));
return false;
}
json::Object &jscop = *ParseResult.get().getAsObject();
