[patch] Uses std::error_code instead of llvm::error_code

Chandler Carruth chandlerc at google.com
Wed Jun 11 11:58:49 PDT 2014


LGTM. I like the end state (just using std::) and this seems like a pretty
reasonable initial step. Thanks!


On Wed, Jun 11, 2014 at 7:54 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> I have patched llvm::error_code to make it look more like what the
> system versions look like, now it is time to see if we want to take
> the next step and actually replace it.
>
> Attached you will find the llvm clang and lld patches. The idea of the
> patches is to turns llvm/Support/system_error.h into a transitional
> header that just brings in the erorr_code api to the llvm namespace.
> If these patches are OK I will finish the job and delete the file
> shortly after.
>
> The cases where the general idea needed some tweaking:
>
> * std::errc is a namespace in msvc, so we cannot use "using
> std::errc". I would add an #ifdef, but there were note that many uses,
> so I just added std:: to them already in this patch.
>
> * Template specialization had to be moved to the std namespace in this
> patch set already.
>
> * The msvc implementation of default_error_condition doesn't seem to
> provide the same transformations as we need. Not too surprising since
> the standard doesn't actually say what "equivalent" means. I fixed the
> problem by keeping our old mapping and using it at error_code
> construction time.
>
> Despite these shortcomings I think this is still a good thing. Some
> reasons:
>
> * The different implementations of system_error might improve over time.
> * It removes 925 lines of code from llvm already.
> * It removes 6313 bytes from the text segment of the clang binary when
> it is built with gcc and 2816 bytes when building with clang and
> libstdc++.
>
> Cheers,
> Rafael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140611/4f35aa80/attachment.html>


More information about the llvm-commits mailing list