[PATCH 10/11] Check for an empty error log.

Tobias Grosser tobias at grosser.es
Tue Jun 10 00:12:17 PDT 2014


On 09/06/2014 02:42, Andreas Simbuerger wrote:
> Fixes #19976.
>
> The error log does not contain an error, in case we reject a candidate
> without generating a diagnostic message by using invalid<>(...).
> ---
>   lib/Analysis/ScopDetection.cpp | 9 ++++++++-
>   1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/lib/Analysis/ScopDetection.cpp b/lib/Analysis/ScopDetection.cpp
> index a15ca19..2730d81 100644
> --- a/lib/Analysis/ScopDetection.cpp
> +++ b/lib/Analysis/ScopDetection.cpp
> @@ -219,7 +219,14 @@ std::string ScopDetection::regionIsInvalidBecause(const Region *R) const {
>     // Get the first error we found. Even in keep-going mode, this is the first
>     // reason that caused the candidate to be rejected.
>     RejectLog Errors = Logs.at(R);
> -  return (*Errors.begin())->getMessage();
> +
> +  // This can happen when we marked a region invalid, but didn't track
> +  // an error for it.
> +  if (Errors.size() == 0)
> +    return "";

Are there cases where we expect to not track an error?

LGTM. It misses a test case. If you can add one that would be nice. If 
it only triggeres in -viewCFG() and this is hard to test, just give this 
as a reason why you did not provide a test case.

As this is independent, please go ahead and commit it immediately.

Cheers,
Tobias



More information about the llvm-commits mailing list