[PATCH] D21128: [pdb] Fix errors with invalid stream numbers

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 08:25:38 PDT 2016


I think it is because the repetition of `if (auto EC = ...) return EC` is a
natural consequence of the introduction of Error class. The class requires
explicit error handling everywhere. (This reminds me of the way how errors
are handled in the Go language. We can use multiple return values in Go, so
an error and a value are returned as separate values, but we actually do
write these repetitions explicitly in Go, and that's recommended.) If it is
repeated too many and if we don't like it, Error class should provide some
way to mitigate it. I think adding a workaround on client side of the class
seems a bit too hacky.

On Wed, Jun 8, 2016 at 8:19 AM, Zachary Turner <zturner at google.com> wrote:

> Is it because there are so many?  Or for a different reason?  There was
> one case where there were like 15 lines of code jsut to get all the values
> out of the functions and do the error checking, I found it really hurt the
> ability to read the code.
>
> I do agree that there are too many though.  I'm not a C++ wizard, but if
> someone can help me figure out how to write them with fewer macros, do you
> think that would be better?
>
> On Wed, Jun 8, 2016 at 8:06 AM Rui Ueyama <ruiu at google.com> wrote:
>
>> ruiu added a comment.
>>
>> I think I honestly don't like these macros. They indeed reduces amount of
>> code but are hard to read. I prefer the current style (explicitly writing
>> control flow in a plain C++) over the magical macros.
>>
>>
>> http://reviews.llvm.org/D21128
>>
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160608/9cd39eeb/attachment.html>


More information about the llvm-commits mailing list