cxx/test/utilities
Eric Fiselier 4e7d53664d Add support for "fancy" pointers to shared_ptr. Fixes PR20616
Summary:
This patch add support for "fancy pointers/allocators" as well as fixing support for shared_pointer and "minimal" allocators.

Fancy pointers are class types that meet the NullablePointer requirements. In our case they are created by fancy allocators. `support/min_allocator.h` is an archetype for these types.

There are three types of changes made in this patch:
1. `_Alloc::template rebind<T>::other` -> `__allocator_traits_rebind<_Alloc, T>::type`. This change was made because allocators don't need a rebind template. `__allocator_traits_rebind` is used instead of `allocator_traits::rebind` because use of `allocator_traits::rebind` requires a workaround for when template aliases are unavailable.
2. `a.deallocate(this, 1)` -> `a.deallocate(pointer_traits<self>::pointer_to(*this), 1)`. This change change is made because fancy pointers aren't always constructible from raw pointers. 
3. `p.get()` -> `addressof(*p.get())`. Fancy pointers aren't actually a pointer. When we need a "real" pointer we take the address of dereferencing the fancy pointer. This should give us the actual raw pointer.

Test Plan: Tests were added using `support/min_allocator.h` to each affected shared_ptr overload and creation function. These tests can only be executed in C++11 or greater since min_allocator is only available then. A extra test was added for the non-variadic versions of allocate_shared. 

Reviewers: danalbert, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220469 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-23 04:12:28 +00:00
..
allocator.adaptor Whitespace maintenance. Remove a bunch of tabs that snuck in. No functionality change 2014-10-18 11:03:33 +00:00
date.time license change 2010-11-16 22:09:02 +00:00
function.objects Whitespace maintenance. Remove a bunch of tabs that snuck in. No functionality change 2014-10-18 11:03:33 +00:00
intseq Implement n3658 - Compile-time integer sequences 2013-07-01 16:26:55 +00:00
memory Add support for "fancy" pointers to shared_ptr. Fixes PR20616 2014-10-23 04:12:28 +00:00
meta Whitespace maintenance. Remove a bunch of tabs that snuck in. No functionality change 2014-10-18 11:03:33 +00:00
optional Whitespace maintenance. Remove a bunch of tabs that snuck in. No functionality change 2014-10-18 11:03:33 +00:00
ratio Fix ratio arithmetic with zero 2011-11-01 23:13:37 +00:00
template.bitset Test case was forming the wrong limits when size_t != unsigned long. 2013-03-29 21:22:22 +00:00
time Set -D_LIBCPP_HAS_NO_THREADS and -D_LIBCPP_HAS_NO_MONOTONIC_CLOCK based on available_features 2014-09-05 17:21:57 +00:00
tuple LWG #2212 (not yet adopted) mandates that tuple_size/tuple_element are available if <array> or <utility> are included (not just <tuple>). We already do this. Add some tests to make sure that this remains true. 2014-10-21 15:05:31 +00:00
type.index Fixing up some ABI issues 2011-07-07 21:03:52 +00:00
utilities.general license change 2010-11-16 22:09:02 +00:00
utility D4451: Fix copy/move issues casude by __tuple_leafs's converting constructor 2014-07-24 18:48:34 +00:00
utility.requirements license change 2010-11-16 22:09:02 +00:00
nothing_to_do.pass.cpp license change 2010-11-16 22:09:02 +00:00