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

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Jun 11 11:54:47 PDT 2014

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm.patch
Type: text/x-patch
Size: 68130 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140611/227f264c/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang.patch
Type: text/x-patch
Size: 10623 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140611/227f264c/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lld.patch
Type: text/x-patch
Size: 13229 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140611/227f264c/attachment-0002.bin>

More information about the llvm-commits mailing list