[patch] Uses std::error_code instead of llvm::error_code
Michael Spencer
bigcheesegs at gmail.com
Wed Jun 11 12:18:14 PDT 2014
On Wed, Jun 11, 2014 at 11:54 AM, 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
lgtm.
- Michael Spencer
More information about the llvm-commits
mailing list