[PATCH] D49950: [Polly][JSONExporter] Replace bundled Jsoncpp with LLVM's JSON.h. NFC.

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


Meinersbur added a comment.

In https://reviews.llvm.org/D49950#1185101, @huihuiz wrote:

>   if (!ParseResult) {
>     ParseResult.takeError();
>     errs() << "JSCoP file could not be parsed\n";
>     return false;
>   }
>   json::Object &jscop = *ParseResult.get().getAsObject();
>   
>   
>
> What are you doing with the result of takeError()?


It exact reason for failure is ignored. We know that an error occurred and a generic message is printed to the user.

> Isn't this causing warn_unused_result build failure?

Fixed in r338659. Also printing the error message.
It is a warning, hence should not have resulted in a build failure.

> How could you tell the difference between success and failure?

Parsing failed iff `!ParseResult` evaluates to true. (`Expected<T>::operator bool()`)

> If ParseResult is null value, how could you call takeError() from it?

`ParseResult` is not a pointer, but an object of type `llvm::Expected<T>`. It cannot be null.


Repository:
  rL LLVM

https://reviews.llvm.org/D49950





More information about the llvm-commits mailing list