[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.
git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@338659 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Exchange/JSONExporter.cpp b/lib/Exchange/JSONExporter.cpp
index 423768b..0a74490 100644
--- a/lib/Exchange/JSONExporter.cpp
+++ b/lib/Exchange/JSONExporter.cpp
@@ -723,9 +723,10 @@
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();