[llvm] r270956 - [Support] Remove a stale comment.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 14:20:15 PDT 2016


Hi Rafael,

During the transition we want to maintain compatibility for people who are
still using std::error_codes to provide error messages.

Going forward, as a matter of style I'd say that StringError should never
appear in a "handleErrors" call, except where you're modifying an error
message to add context (along the lines of 'Msg = "In <context>: " + Msg').
Often, people will start by using StringError for errors, then introduce a
new custom error type for each error that they actually want to make
programmatically handleable.

- Lang.

On Fri, May 27, 2016 at 3:54 AM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> I guess what I mean is, why not always use inconvertibleErrorCode with it?
>
> Cheers,
> Rafael
> On May 27, 2016 6:03 AM, "Rafael EspĂ­ndola" <rafael.espindola at gmail.com>
> wrote:
>
>> This is still a bit confusing. If it is not to be used programmatically,
>> why the error code?
>> On May 26, 2016 10:49 PM, "Lang Hames via llvm-commits" <
>> llvm-commits at lists.llvm.org> wrote:
>>
>>> Author: lhames
>>> Date: Thu May 26 21:43:15 2016
>>> New Revision: 270956
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=270956&view=rev
>>> Log:
>>> [Support] Remove a stale comment.
>>>
>>> This comment was included in Peter Collingbourne's original version of
>>> StringError (see http://reviews.llvm.org/D20550), where it made sense.
>>> It was
>>> accidentally copied over with the rest of the class, but no longer
>>> applies.
>>>
>>>
>>> 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=270956&r1=270955&r2=270956&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/include/llvm/Support/Error.h (original)
>>> +++ llvm/trunk/include/llvm/Support/Error.h Thu May 26 21:43:15 2016
>>> @@ -886,8 +886,7 @@ template <typename T> ErrorOr<T> expecte
>>>  ///
>>>  /// 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.
>>> +/// error message is to be presented to the user).
>>>  class StringError : public ErrorInfo<StringError> {
>>>  public:
>>>    static char ID;
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160527/bd39a6fc/attachment.html>


More information about the llvm-commits mailing list