[llvm-commits] [llvm] r150197 - in /llvm/trunk: include/llvm/Support/system_error.h lib/Support/DataStream.cpp lib/Support/FileUtilities.cpp lib/Support/MemoryBuffer.cpp lib/Support/PathV2.cpp lib/Support/Unix/PathV2.inc lib/Support/Windows/PathV

Michael Spencer bigcheesegs at gmail.com
Thu Feb 9 15:36:36 PST 2012


On Thu, Feb 9, 2012 at 11:24 AM, David Blaikie <dblaikie at gmail.com> wrote:
> Author: dblaikie
> Date: Thu Feb  9 13:24:12 2012
> New Revision: 150197
>
> URL: http://llvm.org/viewvc/llvm-project?rev=150197&view=rev
> Log:
> Change default error_code ctor to a 'named ctor' so it's more self-documenting.
>
> Unify default construction of error_code uses on this idiom so that users don't
> feel compelled to make static globals for naming convenience. (unfortunately I
> couldn't make the original ctor private as some APIs don't return their result,
> instead using an out parameter (that makes sense to default construct) - which
> is a bit of a pity. I did, however, find/fix some cases of unnecessary default
> construction of error_code before I hit the unfixable cases)

The out parameters are needed for constructors since we can't use
exceptions :P. I like the rest of it. It's sad that the standard
doesn't define an automatic conversion between errc::success and
error_code(0, generic_category()).

- Michael Spencer




More information about the llvm-commits mailing list