Go to file
Eric Fiselier 319be72220 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

llvm-svn: 220469
2014-10-23 04:12:28 +00:00
clang Revert accidentally-committed files in r220460. 2014-10-23 02:02:31 +00:00
clang-tools-extra [clang-tidy] Add support for custom configuration file names/formats. 2014-10-20 12:29:15 +00:00
compiler-rt [tsan] add a stub of another dynamic annotation 2014-10-22 05:02:20 +00:00
debuginfo-tests New round of fixes for "Always compile debuginfo-tests for the host triple" 2014-10-18 23:47:59 +00:00
libclc r600: Fix get_work_dim range metadata 2014-10-22 14:32:53 +00:00
libcxx Add support for "fancy" pointers to shared_ptr. Fixes PR20616 2014-10-23 04:12:28 +00:00
libcxxabi [libcxxabi] Add support for running libc++abi tests with sanitizers 2014-10-23 03:10:43 +00:00
lld [PECOFF] Do not write duplicate directives to .def file. 2014-10-22 00:05:30 +00:00
lldb Reverting r220435. Jim Ingham and I discussed this for a bit, and we came up with a better command model for this feature 2014-10-22 22:33:08 +00:00
llvm Assert that ValueHandleBase::ValueIsRAUWd doesn't change the tracked Value type. 2014-10-23 04:08:42 +00:00
openmp I apologise in advance for the size of this check-in. At Intel we do 2014-10-07 16:25:50 +00:00
polly Fix typo 2014-10-22 23:26:48 +00:00