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

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Thu May 26 19:52:02 PDT 2016


Hi Rafael,

Oops - I didn't notice that when I copied over Peter's version. I've
corrected the comment in r270956. Thanks for catching that!

- Lang.

On Thu, May 26, 2016 at 7:20 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> > +/// 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160526/8ceca34d/attachment.html>


More information about the llvm-commits mailing list