[llvm] r270948 - [Support] Add a StringError convenience class to Error.h

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Thu May 26 19:20:08 PDT 2016


> +/// StringError is useful in cases where the client is not expected to be able
> +/// to consume the specific error message programmatically (for example, if the
> +/// error message is to be presented to the user). It cannot be converted to a
> +/// std::error_code.
> +class StringError : public ErrorInfo<StringError> {
> +public:
> +  static char ID;
> +  StringError(const Twine &S, std::error_code EC);
> +  void log(raw_ostream &OS) const override;
> +  std::error_code convertToErrorCode() const override;
> +private:
> +  std::string Msg;
> +  std::error_code EC;
> +};

If it cannot be converted to error_code, why does it take an
error_code and stores it?

Cheers,
Rafael


More information about the llvm-commits mailing list