Commit Graph

191 Commits

Author SHA1 Message Date
Eric Fiselier
85cde7d2f4 Revert "Fix PR34298 - Allow std::function with an incomplete return type."
This reverts commit r312890 because the test case fails to compile for
older versions of Clang that reject initializing a const object without
a user defined constructor.

Since this patch should go into 5.0.1, I want to keep it an atomic change,
and will re-commit it with a fixed test case.

llvm-svn: 312891
2017-09-10 23:37:47 +00:00
Eric Fiselier
358ca0c04b Fix PR34298 - Allow std::function with an incomplete return type.
This patch fixes llvm.org/PR34298. Previously libc++ incorrectly evaluated
the __invokable trait via the converting constructor `function(Tp)` [with Tp = std::function]
whenever the copy constructor or copy assignment operator
was required. This patch further constrains that constructor to short
circut before evaluating the troublesome SFINAE when `Tp` matches
std::function.

The original patch is from Alex Lorenz.

llvm-svn: 312890
2017-09-10 23:12:33 +00:00
Marshall Clow
8b086e3878 Add some const_casts in places where we were implicitly casting away constness. No functional change, but now they're explicit
llvm-svn: 305410
2017-06-14 20:00:36 +00:00
Eric Fiselier
1f8b73d15c Qualify calls to __invoke, __apply_fuctor, and __mu
llvm-svn: 302082
2017-05-03 21:02:19 +00:00
Eric Fiselier
7e23afcb60 Cleanup remaining usages of _LIBCPP_HAS_NO_<c++11-feature> in the functional library
llvm-svn: 300646
2017-04-19 01:28:47 +00:00
Marshall Clow
7d210c787e Remove the binders from C++17. Reviewed as https://reviews.llvm.org/D31769
llvm-svn: 300232
2017-04-13 18:25:32 +00:00
Shoaib Meenai
c7cd73e8b8 [libc++] Add a key function for bad_function_call
Summary:
bad_function_call is currently an empty class, so any object files using
that class will end up with their own copy of its typeinfo, typeinfo
name and vtable, leading to unnecessary duplication that has to be
resolved by the dynamic linker. Instead, give bad_function_call a key
function and put a definition for that key function in libc++ itself, to
centralize the typeinfo and vtable.

This is consistent with the behavior for other exception classes. The
key functions are defined in libc++ rather than libc++abi since the
class is defined in the libc++ versioning namespace, so ABI
compatibility with libstdc++ is not a concern.

Guard this change behind an ABI macro, since it isn't backwards
compatible (i.e., clients built against the new libc++ headers wouldn't
be able to run against an older libc++ library).

Reviewers: mclow.lists, EricWF

Subscribers: mgorny, cfe-commits

Differential Revision: https://reviews.llvm.org/D27387

llvm-svn: 298937
2017-03-28 19:33:31 +00:00
Marshall Clow
d832316853 Can't test for noexcept on C++03; std::hash<nullptr_t> isn't available until C++17
llvm-svn: 298580
2017-03-23 06:20:18 +00:00
Eric Fiselier
f9127593a9 Implement P0513R0 - "Poisoning the Hash"
Summary:
Exactly what the title says.

This patch also adds a `std::hash<nullptr_t>` specialization in C++17, but it was not added by this paper and I can't find the actual paper that adds it.

See http://wg21.link/P0513R0 for more info.

If there are no comments in the next couple of days I'll commit this

Reviewers: mclow.lists, K-ballo, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D28938

llvm-svn: 292684
2017-01-21 00:02:12 +00:00
Eric Fiselier
e2f2d1edef [NFC] Rename _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VIS
The name _LIBCPP_TYPE_VIS_ONLY is no longer accurate because both
_LIBCPP_TYPE_VIS and _LIBCPP_TYPE_VIS_ONLY expand to
__attribute__((__type_visibility__)) with Clang. The only remaining difference
is that _LIBCPP_TYPE_VIS_ONLY can be applied to templates whereas
_LIBCPP_TYPE_VIS cannot (due to dllimport/dllexport not being allowed on
templates).

This patch renames _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VIS.

llvm-svn: 291035
2017-01-04 23:56:00 +00:00
Eric Fiselier
d566c34526 Fix PR31489 - std::function self-swap segfaults
llvm-svn: 290721
2016-12-29 20:03:55 +00:00
Eric Fiselier
f9980200aa Remove _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
libc++ no longer supports C++11 compilers that don't implement `= default`.
This patch removes all instances of the feature test macro
_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS as well as the potentially dead code it hides.

llvm-svn: 287321
2016-11-18 06:42:17 +00:00
Eric Fiselier
498ee00a3a Add void_t and invoke feature test macros
llvm-svn: 284209
2016-10-14 07:19:52 +00:00
Marshall Clow
6ecac73019 Implement http://wg21.link/p0302r1: Removing Allocator Support in std::function. These functions never worked, and as far as I know, no one ever called them.
llvm-svn: 284164
2016-10-13 21:06:03 +00:00
Marshall Clow
8c7365a9fa Add whitespace to make not_fn_impl more clear. NFC.
llvm-svn: 283757
2016-10-10 14:37:18 +00:00
Marshall Clow
a48055cee3 Add missing _v traits. is_bind_expression_v, is_placeholder_v and uses_allocator_v
llvm-svn: 282126
2016-09-22 00:23:15 +00:00
Marshall Clow
d437fa5c8c Add an _LIBCPP_NORETURN inline function named __throw_XXX for each exception type we define. They either construct and throw the exception, or abort() (if exceptions are disabled). Use these functions everywhere instead of assert()ing when exceptions are disabled. WARNING: This is a behavior change - but only with exceptions disabled. Reviewed as: https://reviews.llvm.org/D23855.
llvm-svn: 279744
2016-08-25 15:09:01 +00:00
Eric Fiselier
45b7b44867 Implement LWG 2148: Make non-enum default hash specialization well-formed
Summary:
This patch removes the static_assert for non-enum types in the primary hash template. Instead non-enum types create a hash<T> specialization that is not constructible nor callable.

See also:
  * http://cplusplus.github.io/LWG/lwg-active.html#2543
  * https://llvm.org/bugs/show_bug.cgi?id=28917

Reviewers: mclow.lists, EricWF

Subscribers: mehdi_amini, cfe-commits

Differential Revision: https://reviews.llvm.org/D23331

llvm-svn: 278300
2016-08-10 22:45:26 +00:00
Eric Fiselier
fd32ab923e Move std::function constructor SFINAE into template parameter list. Fixes PR20002.
Although inheriting constructors have already been fixed in Clang 3.9 I still
choose to fix std::function so users can derive from it with older compilers.

llvm-svn: 276090
2016-07-20 05:21:00 +00:00
Eric Fiselier
9372d8bc61 Implement P0358r1. Fixes for not_fn.
llvm-svn: 273837
2016-06-27 00:40:41 +00:00
Eric Fiselier
555330719a Implement LWG 2488 - Make the placeholders constexpr.
This patch makes the bind placeholders in std::placeholders both (1) const and
(2) constexpr (See below).

This is technically a breaking change for any code using the placeholders
outside of std::bind and depending on them being non-const. However I don't
think this will break any real world code.

(1) Previously the placeholders were non-const extern globals in all
dialects. This patch changes these extern globals to be const in all dialects.
Since the cv-qualifiers don't participate in name mangling for globals this
is an ABI compatible change.

(2) Make the placeholders constexpr in C++11 and beyond. Although LWG 2488 only
applies to C++17 I don't see any reason not to backport this change.

llvm-svn: 273824
2016-06-26 21:01:34 +00:00
Eric Fiselier
5725756791 Add C++17 std::not_fn negator.
Summary:
Exactly what it sounds like.

I plan to commit this in a couple of days assuming no objections.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D20799

llvm-svn: 271464
2016-06-02 01:25:41 +00:00
Eric Fiselier
df691e18f3 Add hash specializations for __int128_t. Fixes LWG issue 2119
llvm-svn: 266587
2016-04-18 02:54:00 +00:00
Evgeniy Stepanov
3e58a6a7b2 Fix invalid casts in <functional>.
static_cast of a pointer to object before the start of the object's
lifetime has undefined behavior.

This code triggers CFI warnings.

This change replaces C-style casts with reinterpret_cast, which is
fine per the standard, add applies an attribute to silence CFI (which
barks on reinterpret_cast, too).

llvm-svn: 260441
2016-02-10 21:53:28 +00:00
Marshall Clow
0aa1ccb0d9 Implement LWG#2385; remove the allocator-aware std::function::assign call. It was useless, and didn't actually *do anything* with the allocator. Now it's gone. On the off chance that someone is mistakenly calling it, it's only gone in C++1z
llvm-svn: 258697
2016-01-25 17:29:55 +00:00
Marshall Clow
3b72a6ef63 Fix LWG#2489: mem_fn() should be noexcept
llvm-svn: 251257
2015-10-25 20:12:16 +00:00
Eric Fiselier
70192a9efb [libcxx] Rewrite C++03 __invoke.
Summary:
This patch rewrites the C++03 `__invoke` and related meta-programming. There are a number of major changes.

`__invoke` in C++03 now has a fallback overload for when the invoke expression is ill-formed (similar to C++11). This means that the `__invoke_return` traits will return `__nat` when `__invoke(...)` is ill formed. This would previously cause a compile error.

Bullets 1-4 of `__invoke` have been rewritten. In the old version `__invoke` had 32 overloads for bullets 1 and 2,
one for each possible cv-qualified function signature with arities 0-3. 64 overloads would be needed to support member functions
with varargs. Currently these overloads were fundamentally broken. An example overload looked like:
```
template <class Rp, class Tp, class T1, class A0>
Rp __invoke(Rp (Tp::*pm)(A0) const, T1&, A0&)
```
Because `A0` appeared in two different deducible contexts it would have to deduce to be an exact match or the overload
would be rejected. This is made even worse because `A0` appears without a reference qualifier in the member function signature
and with a reference qualifier as an `__invoke` parameter. This means that only member functions that took all
of their arguments by value could be matched.

One possible fix would be to make the second occurrence of `A0` appear in a non-deducible context. This way
any type convertible to `A0` could be passed as the first parameter. The benefit of this approach is that the
signature of the member function enforces the arity and types taken by the `__invoke` signature it generates. However
nothing in the `INVOKE` specification requires this behavior.

My solution is to use a `__invoke_enable_if<PM_Type, Tp>`  metafunction to selectively enable the `__invoke` overloads for bullets 1, 2, 3 and 4.  It uses `__member_function_traits` to inspect and extract the return type and class type of the pointer to member. Using `__member_function_traits` to inspect `PM_Type` also allows us to reduce the number of `__invoke` overloads from 32 to 8 and add
varargs support at the same time.

Because `__invoke_enable_if` knows the exact return type of `__invoke` for bullets 1-4 we no longer need to use `decltype(__invoke(...))` to
compute the return type in the `__invoke_return*` traits. This will reduce the problems caused by `#define decltype(X) __typeof__(X)` in C++03.

Tests for this change have already been committed. All tests in `test/std/utilities/function.objects` now pass in C++03, previously there were 20 failures.

Reviewers: K-ballo, howard.hinnant, mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D11553

llvm-svn: 246068
2015-08-26 20:15:02 +00:00
Eric Fiselier
0d28f78401 [libcxx] Fix PR23589: std::function doesn't recognize null pointer to varargs function.
Summary:
This patch fixes __not_null's detection of nullptr by breaking it down into 4 cases.

1. `__not_null(Tp const&)`: Default case. Tp is not null.
2. `__not_null(Tp* __ptr);` Case for pointers to functions.
3. `__not_null(_Ret _Class::* __ptr);` Case for pointers to members.
4. `__not_null(function<Tp> const&);`: Cases for other std::functions.

Reviewers: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D11111

llvm-svn: 245335
2015-08-18 19:41:51 +00:00
Eric Fiselier
e62bda70aa Cleanup C++03 __invoke for Bullets 3 and 4.
The key changes in this patch are:

1. Remove the zero-argument overload in mem_fn. A member function must always
   be invoked with at least one argument, the class instance. The zero-argument
   operator()() in mem_fn would cause mem_fn to fail to compile when because
   the call to '__invoke(pm)' is not well formed.

2. Prevent evaluation of '__apply_cv<Tp, Ret>' when 'Ret' is a function type.
   'Ret' is a function type whenever 'Ret Tp::*' is a pointer to member function.
   Attempting to add cv and ref qualifiers to a function type can cause a hard
   compile error.

3. Remove the dummy overload __invoke(Rp Tp::*). It was present to help work
   around #1. It will be replaced with a different '__invoke' overload that
   represents a bad call to invoke.

After applying this patch the test func.wrap.func.inv/invoke.pass.cpp now
passes.

llvm-svn: 243370
2015-07-28 02:15:53 +00:00
Eric Fiselier
00f512ebdf Merge C++03 and C++11 implementations of mem_fn and __mem_fn.
The implementation of mem_fn doesn't actually require any  C++11 support.
For some reason there were 17 overloads for mem_fn in C++03 when only one
is needed. This patch removes the extra overloads and uses the same implementation
of mem_fn in C++03 and C++11.

__mem_fn does require variadics to implement the call operator. Instead of
having two entirely different implementations of the __mem_fn struct, this patch
uses the same __mem_fn struct but provides different call operators when
variadics are not available.

The only thing left in <__functional_03> is the C++03 implementation of
std::function.

llvm-svn: 242959
2015-07-22 22:43:27 +00:00
Eric Fiselier
e5407178d6 Cleanup <__functional_03>
<__functional_03> provides the C++03 definitions for std::memfun and
std::function. However the interaction between <functional> and <__functional_03>
is ugly and duplicates code needlessly. This patch cleans up how the two
headers work together.

The major changes are:

- Provide placeholders, is_bind_expression and is_placeholder in <functional>
  for both C++03 and C++11.

- Provide bad_function_call, function fwd decl,
  __maybe_derive_from_unary_function and __maybe_derive_from_binary_function
  in <functional> for both C++03 and C++11.

- Move the <__functional_03> include to the bottom of <functional>. This makes
  it easier to see how <__functional_03> interacts with <functional>

- Remove a commented out implementation of bind in C++03. It's never going
  to get implemented.

- Mark almost all std::bind tests as unsupported in C++03. std::is_placeholder
  works in C++03 and C++11. std::is_bind_expression is provided in C++03 but
  always returns false.

llvm-svn: 242870
2015-07-22 04:14:38 +00:00
Eric Fiselier
87a82490fc Enable and fix warnings during the build.
Although CMake adds warning flags, they are ignored in the libc++ headers
because the headers '#pragma system header' themselves.

This patch disables the system header pragma when building libc++ and fixes
the warnings that arose.

The warnings fixed were:
1. <memory> - anonymous structs are a GNU extension
2. <functional> - anonymous structs are a GNU extension.
3. <__hash_table> - Embedded preprocessor directives have undefined behavior.
4. <string> - Definition is missing noexcept from declaration.
5. <__std_stream> - Unused variable.

llvm-svn: 242623
2015-07-18 20:40:46 +00:00
Eric Fiselier
5be45129a4 Implement n4169 - Add invoke function template
llvm-svn: 242195
2015-07-14 20:16:15 +00:00
Eric Fiselier
2d15f15f28 [libcxx] LWG2420 bits for bind<void> - Patch from K-Ballo
Implemented LWG2420 bits for bind<void>

Review: http://reviews.llvm.org/D10997
llvm-svn: 241967
2015-07-10 23:29:18 +00:00
Eric Fiselier
35cb2b28ca Rename internal trait that used non-reserved name.
llvm-svn: 237737
2015-05-19 22:27:18 +00:00
Marshall Clow
1f508014df In many places, there was an #ifdef/#else block that selected one of two implmentations of rebind_alloc based on whether or not we had template aliases. Create a helper struct to encapsulate that bit of logic, and replace all the ifdefs with uses of that struct. No functionality change intented.
llvm-svn: 234296
2015-04-07 05:21:38 +00:00
Eric Fiselier
6d370568c3 [libc++] Fix PR22922 - Allocator support for std::function does not know how to rebind.
Summary:
This patch changes std::function to use allocator_traits to rebind the allocator instead of allocator itself.

It also changes most of the tests to use `bare_allocator` where possible instead of `test_allocator`.

Reviewers: mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D8391

llvm-svn: 232686
2015-03-18 22:56:50 +00:00
Marshall Clow
a64f2fbc09 Add trailing return types (and noexcept specifications) to the 'diamond operators'. Fixes PR#22600.
llvm-svn: 230484
2015-02-25 12:20:52 +00:00
Eric Fiselier
54519a6be9 [libcxx] Fix PR 22468 - std::function<void()> does not accept non-void-returning functions
Summary:
The bug can be found here: http://llvm.org/bugs/show_bug.cgi?id=22468

`__invoke_void_return_wrapper` is needed to properly handle calling a function that returns a value but where the std::function return type is void. Without this '-Wsystem-headers' will cause `function::operator()(...)` to not compile. 

Reviewers: eugenis, K-ballo, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D7444

llvm-svn: 228705
2015-02-10 16:48:45 +00:00
Eric Fiselier
279663c1b4 Prevent ill-formed instantiation of __invoke_of<...> during the evaluation of a bind expression. Fixes PR22003.
The SFINAE on the function __mu(Fn, Args...) that evaluates nested bind
expressions always tries to deduce the return type for Fn(Args...) even when Fn
is not a nested bind expression. This can cause hard compile errors when the
instantation of Fn(Args...) is ill-formed. This patch prevents the instantation
of __invoke_of<Fn, Args...> unless Fn is actually a bind expression.

Bug reportand patch from Michel Morin.

http://llvm.org/bugs/show_bug.cgi?id=22003

llvm-svn: 224753
2014-12-23 05:54:34 +00:00
Marshall Clow
38cae6330b Fix libc++ bug #20039: 'Constructing std::function from empty compatible std::function results in half-empty state' Thanks to Agustin Berge for the report, and for his and Eric Fiselier's work on a fix.
llvm-svn: 212070
2014-06-30 21:27:51 +00:00
Marshall Clow
f9af6140ff Some calls to get<>() were qualified. Some were not. Qualify them all. Fixes bug #20092. Thanks to Agustín Bergé for the bug report and the fix.
llvm-svn: 211563
2014-06-24 00:46:19 +00:00
Marshall Clow
5f7c2db2ce Bug #19473. If you pass an allocator to std::function, we should use that allocator, not construct one from scratch. Add a test to make sure
llvm-svn: 206623
2014-04-18 17:23:36 +00:00
Peter Collingbourne
a5adf489b7 Const qualify __mem_fn call operator
QOI improvement.

Differential Revision: http://llvm-reviews.chandlerc.com/D2059

llvm-svn: 199848
2014-01-22 22:56:52 +00:00
Marshall Clow
3d5134dd52 Implement n3789; constexpr support in named function objects
llvm-svn: 191626
2013-09-28 19:06:12 +00:00
Howard Hinnant
ff29d538ea Apply LWG 2048. It is amazing to me that this actually works, but the existing tests confirm that it does. c++1y status page now showing libc++ is complete for c++1y modulo dynarray issues.
llvm-svn: 191142
2013-09-21 19:25:37 +00:00
Howard Hinnant
b76e6a95a9 Apply LWG 2017. This is a only a documentation change.
llvm-svn: 191140
2013-09-21 17:58:58 +00:00
Marshall Clow
5155a569d1 LWG Issue 2148: Hashing Enums
llvm-svn: 189831
2013-09-03 17:55:32 +00:00
Marshall Clow
25d3402c6a First half of support for N3657; heterogenous lookups for set/multiset
llvm-svn: 188241
2013-08-13 01:11:06 +00:00
Howard Hinnant
f0544c2086 Nico Rieck: this patch series fixes visibility issues on Windows as explained in <http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-August/031214.html>.
llvm-svn: 188192
2013-08-12 18:38:34 +00:00
Marshall Clow
83c08b4497 Implement N3421; comparison predicates<void>
llvm-svn: 187357
2013-07-29 14:21:53 +00:00
Howard Hinnant
9dbbf8dece The bind and function functor constructors and assignment operators were overly general and getting confused with the copy constructor and copy assignment operators. Constrained them. This fixes http://llvm.org/bugs/show_bug.cgi?id=16385
llvm-svn: 185297
2013-07-01 00:01:51 +00:00
Howard Hinnant
9bf42533b7 Fix bind by making _is_valid_bind_return more robust. It should return false instead of give a compile time error, always. The problem was down in ____mu_return, the version that handles nested bind objects. This fixes http://llvm.org/bugs/show_bug.cgi?id=16343
llvm-svn: 185289
2013-06-30 19:48:15 +00:00
Howard Hinnant
6e41256f68 No functionality change at this time. I've split _LIBCPP_VISIBLE up into two flags: _LIBCPP_TYPE_VIS and _LIBCPP_FUNC_VIS. This is in preparation for taking advantage of clang's new __type_visibility__ attribute.
llvm-svn: 176593
2013-03-06 23:30:19 +00:00
Howard Hinnant
c0c9748c11 Constrain bind operator()() to not exist if the call is not valid. Fixes http://llvm.org/bugs/show_bug.cgi?id=15295.
llvm-svn: 175774
2013-02-21 18:16:55 +00:00
Howard Hinnant
aba500d633 Revert accidental check-in. These changes are probably good, but premature at this point.
llvm-svn: 174625
2013-02-07 15:31:44 +00:00
Howard Hinnant
804f9116e5 Michael van der Westhuizen: The attached patch add support for building against libc++abi and libcxxrt to CMake builds of libc++.
Usage (with the appropriate CC and CXX environment variables) is:
$ cmake -DLIBCXX_CXX_ABI=libcxxabi '-DLIBCXX_LIBCXXABI_INCLUDE_PATHS=/home/michael/libcxxabi/include' ../libcxx
and:
$ cmake -DLIBCXX_CXX_ABI=libcxxrt '-DLIBCXX_LIBCXXRT_INCLUDE_PATHS=/home/michael/libcxxrt/src' ../libcxx

llvm-svn: 174623
2013-02-07 15:27:39 +00:00
Howard Hinnant
8d3e797444 Donated anonymously: This enables GCC 4.8.0 to build libc++.
llvm-svn: 173060
2013-01-21 17:26:55 +00:00
Argyrios Kyrtzidis
88db3171dd Don't neglect to "return *this".
llvm-svn: 165860
2012-10-13 02:03:45 +00:00
Howard Hinnant
14c56f6c4a Further tweaks on relaxing complete type checking for function.
llvm-svn: 160562
2012-07-20 18:56:07 +00:00
Howard Hinnant
df7aad41fd Constrain __bind functor constructor such that it won't accidentally get used as a copy constructor from a non-const lvalue. Fixes <rdar://problem/11359080>.
llvm-svn: 156182
2012-05-04 17:21:02 +00:00
Howard Hinnant
9bb1429f20 Reduce the number of move constructions when constructing a std::function. This fixes http://llvm.org/bugs/show_bug.cgi?id=12105.
llvm-svn: 151652
2012-02-28 19:47:38 +00:00
Howard Hinnant
f2f2d8b98d Modernize conversion to bool to the explicit bool conversion operator (library wide). This fixes http://llvm.org/bugs/show_bug.cgi?id=12058.
llvm-svn: 151088
2012-02-21 21:46:43 +00:00
Howard Hinnant
67f3964766 Modernize relational operators for shared_ptr and unique_ptr. This includes adding support for nullptr, and using less<T*>. Fixes http://llvm.org/bugs/show_bug.cgi?id=12056.
llvm-svn: 151084
2012-02-21 21:02:58 +00:00
Howard Hinnant
9b0cd149aa Version #next on the hash functions for scalars. This builds on Dave's work, extends it to T*, and changes the way double and long double are handled (no longer convert to float on 32 bit). I also picked up a minor bug with uninitialized bits on the upper end of size_t when sizeof(size_t) > sizeof(T), e.g. in hash<float>. Most of the functionality has been put in one place: __scalar_hash in <memory>. Unfortunately I could not reuse __scalar_hash for hash<long double> on x86 because of the padding bits which need to be zeroed. I didn't want to add this zeroing step to the more general __scalar_hash when it isn't needed (in the absence of padding bits). I'm not ignoring the hash<string> issue (possibly changing that to a better hash). I just haven't gotten there yet.
llvm-svn: 145778
2011-12-03 21:11:36 +00:00
Howard Hinnant
7f3884d58a I had picked up the wrong version of DaveZ's hash patches. Corrected here.
llvm-svn: 145728
2011-12-02 23:45:22 +00:00
Howard Hinnant
425d482c21 Fixes to hash for long long, unsigned long long, float, double and long double. Credit Dave Zarzycki
llvm-svn: 145721
2011-12-02 22:52:09 +00:00
Howard Hinnant
c206366fd7 Quash a whole bunch of warnings
llvm-svn: 145624
2011-12-01 20:21:04 +00:00
Howard Hinnant
c003db1fca Further macro protection by replacing _[A-Z] with _[A-Z]p
llvm-svn: 145410
2011-11-29 18:15:50 +00:00
Howard Hinnant
073458b1ab Windows support by Ruben Van Boxem.
llvm-svn: 142235
2011-10-17 20:05:10 +00:00
Howard Hinnant
086d0de171 http://llvm.org/bugs/show_bug.cgi?id=10250
llvm-svn: 134325
2011-07-02 18:22:36 +00:00
Howard Hinnant
ce48a1137d _STD -> _VSTD to avoid macro clash on windows
llvm-svn: 134190
2011-06-30 21:18:19 +00:00
Howard Hinnant
542b2507de I've seen this question enough times to know that it should be fixed: http://stackoverflow.com/questions/6193734/implicit-conversions-with-stdfunction
llvm-svn: 132363
2011-05-31 21:45:26 +00:00
Howard Hinnant
af152c8431 minor documentation update
llvm-svn: 132286
2011-05-29 13:53:56 +00:00
Howard Hinnant
6a07d6f06d noexcept for <functional>.
llvm-svn: 132264
2011-05-28 17:59:48 +00:00
Howard Hinnant
2fa07ae9a0 Fix const correctness bug in bind involving reference_wrapper found by Jonathan Sauer
llvm-svn: 131852
2011-05-22 15:07:43 +00:00
Howard Hinnant
2344d6c195 Simplied bind using __invoke. In the process, found and fixed a couple of bugs. C++11 only.
llvm-svn: 131667
2011-05-19 19:41:47 +00:00
Howard Hinnant
651fedb82c Fixed bug in recently introduced bind move constructor
llvm-svn: 131484
2011-05-17 20:27:51 +00:00
Howard Hinnant
07de7bcaa0 Supply missing move ctor in __bind_r, though this one will eventually be defaulted
llvm-svn: 131408
2011-05-16 16:19:01 +00:00
Douglas Gregor
175a104028 Remove an (incorrect) compiler workaround in the __mu function. The
workaround relied on rvalue references binding to non-function
lvalues, while the original formulation (with std::forward) does the
right thing.

llvm-svn: 124241
2011-01-25 23:11:15 +00:00
Howard Hinnant
412dbebe1b license change
llvm-svn: 119395
2010-11-16 22:09:02 +00:00
Howard Hinnant
0f444b3b16 Corrected an inconsistency with recent changes in tuple, and perfect forwarding within bind
llvm-svn: 115930
2010-10-07 18:03:23 +00:00
Howard Hinnant
0af133f941 visibility-decoration.
llvm-svn: 114496
2010-09-21 22:55:27 +00:00
Howard Hinnant
37030a77a0 Fix another const bug in function. Thanks to Daniel Krugler for finding this and the previous bug.
llvm-svn: 113686
2010-09-11 15:33:21 +00:00
Howard Hinnant
b3371f6f49 Fixing whitespace problems
llvm-svn: 111750
2010-08-22 00:02:43 +00:00
Howard Hinnant
9b0b6d45d2 Installed allocator into std::function
llvm-svn: 111672
2010-08-20 19:36:46 +00:00
Howard Hinnant
cbbc430d24 JP 3 & JP 4
llvm-svn: 111547
2010-08-19 19:20:10 +00:00
Howard Hinnant
54b409fdb9 now works with -fno-exceptions and -fno-rtti
llvm-svn: 110828
2010-08-11 17:04:31 +00:00
Howard Hinnant
d1803b6c87 [util.smartptr.hash]
llvm-svn: 105393
2010-06-03 16:42:57 +00:00
Howard Hinnant
5b08a8a432 Wiped out some non-ascii characters that snuck into the copyright.
llvm-svn: 103516
2010-05-11 21:36:01 +00:00
Howard Hinnant
3e519524c1 libcxx initial import
llvm-svn: 103490
2010-05-11 19:42:16 +00:00