[polly] r338659 - [JSONExporter] Print instead of ignoring parser error.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 1 17:11:15 PDT 2018


Author: meinersbur
Date: Wed Aug  1 17:11:14 2018
New Revision: 338659

URL: http://llvm.org/viewvc/llvm-project?rev=338659&view=rev
Log:
[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.

Modified:
    polly/trunk/lib/Exchange/JSONExporter.cpp

Modified: polly/trunk/lib/Exchange/JSONExporter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Exchange/JSONExporter.cpp?rev=338659&r1=338658&r2=338659&view=diff
==============================================================================
--- polly/trunk/lib/Exchange/JSONExporter.cpp (original)
+++ polly/trunk/lib/Exchange/JSONExporter.cpp Wed Aug  1 17:11:14 2018
@@ -723,9 +723,10 @@ static bool importScop(Scop &S, const De
   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();




More information about the llvm-commits mailing list