[llvm] r326413 - [Support] Fix comments for handleAllErrors: it calls llvm_unreachable if the

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 1 08:45:41 PST 2018


Thanks!

Lang Hames via llvm-commits <llvm-commits at lists.llvm.org> writes:

> Author: lhames
> Date: Wed Feb 28 18:52:17 2018
> New Revision: 326413
>
> URL: http://llvm.org/viewvc/llvm-project?rev=326413&view=rev
> Log:
> [Support] Fix comments for handleAllErrors: it calls llvm_unreachable if the
> contract is violated, not report_fatal_error.
>
>
> Modified:
>     llvm/trunk/include/llvm/Support/Error.h
>
> Modified: llvm/trunk/include/llvm/Support/Error.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Error.h?rev=326413&r1=326412&r2=326413&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/Error.h (original)
> +++ llvm/trunk/include/llvm/Support/Error.h Wed Feb 28 18:52:17 2018
> @@ -882,16 +882,16 @@ Error handleErrors(Error E, HandlerTs &&
>    return handleErrorImpl(std::move(Payload), std::forward<HandlerTs>(Hs)...);
>  }
>  
> -/// Behaves the same as handleErrors, except that it requires that all
> -/// errors be handled by the given handlers. If any unhandled error remains
> -/// after the handlers have run, report_fatal_error() will be called.
> +/// Behaves the same as handleErrors, except that by contract all errors
> +/// *must* be handled by the given handlers (i.e. there must be no remaining
> +/// errors after running the handlers, or llvm_unreachable is called).
>  template <typename... HandlerTs>
>  void handleAllErrors(Error E, HandlerTs &&... Handlers) {
>    cantFail(handleErrors(std::move(E), std::forward<HandlerTs>(Handlers)...));
>  }
>  
>  /// Check that E is a non-error, then drop it.
> -/// If E is an error report_fatal_error will be called.
> +/// If E is an error, llvm_unreachable will be called.
>  inline void handleAllErrors(Error E) {
>    cantFail(std::move(E));
>  }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list