summaryrefslogtreecommitdiffstats
path: root/libcxx/test/utilities/memory
Commit message (Collapse)AuthorAgeFilesLines
* Move test into test/std subdirectory.Eric Fiselier2014-12-20310-17003/+0
| | | | llvm-svn: 224658
* Add a test for LWG issue #2399. We already implement this, but now we have a ↵Marshall Clow2014-11-181-0/+9
| | | | | | test as well. llvm-svn: 222242
* Implement LWG2400 - 'shared_ptr's get_deleter() should use addressof()', and ↵Marshall Clow2014-11-171-0/+8
| | | | | | add tests. Mark LWG2400 and LWG2404 as complete llvm-svn: 222161
* Actually mark the tests an unsupported with MSAN (not just ASAN)Eric Fiselier2014-11-048-8/+8
| | | | llvm-svn: 221240
* Mark tests that replace operator new/delete as UNSUPPORTED with ASAN and MSAN.Eric Fiselier2014-11-048-0/+16
| | | | | | | tests that replace operator new/delete won't link when using ASAN and MSAN because these sanitizers also replace new/delete. llvm-svn: 221236
* Add support for "fancy" pointers to shared_ptr. Fixes PR20616Eric Fiselier2014-10-234-0/+212
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix a couple of failing tests for C++03 by checking for rvalue reference ↵Marshall Clow2014-10-232-3/+4
| | | | | | support first. llvm-svn: 220465
* Whitespace maintenance. Remove a bunch of tabs that snuck in. No ↵Marshall Clow2014-10-181-6/+6
| | | | | | functionality change llvm-svn: 220142
* Allow libc++ to be built on systems without POSIX threadsJonathan Roelofs2014-09-0511-0/+22
| | | | | | | | | | If you're crazy enough to want this sort of thing, then add -D_LIBCPP_HAS_NO_THREADS to your CXXFLAGS and --param=additiona_features=libcpp-has-no-threads to your lit commnad line. http://reviews.llvm.org/D3969 llvm-svn: 217271
* test: Make it possible to opt in to use_clang_verify per testJustin Bogner2014-09-031-0/+2
| | | | | | | | | | | This modifies the use_clang_verify parameter I added in r217009 to only apply to tests that specifically ask for it via // USE_VERIFY. This allows us to incrementally convert tests, but start enjoying the benefits right away. Suggested by Eric Fiselier in code review. llvm-svn: 217017
* test: Allow using clang -verify for failures rather than exit 1Justin Bogner2014-09-031-2/+3
| | | | | | | | | | | | | | | | | Currently, failure tests work by checking that compilation exits 1. This can lead to tests that fail for the wrong reason, so it'd be preferable to convert them to check for specific errors. This adds use_clang_verify parameter that runs failure tests using clang's -verify flag. I'll convert some tests in subsequent commits, and once all of the tests are converted we should key this on whether cxx_under_test is clang. I've also converted one of the unique.ptr tests, since it's the one that motivated the idea of using clang -verify when possible in the review of r216317. llvm-svn: 217009
* Fix assignments that should be comparisons x3Eric Fiselier2014-08-232-2/+2
| | | | llvm-svn: 216318
* Add return statement to a test class's assignment operator. Defect found by ↵Eric Fiselier2014-08-231-1/+1
| | | | | | Coverity Scan. llvm-svn: 216317
* Final bit for LWG #2263; test different allocator pointer types. Note that ↵Marshall Clow2014-03-111-0/+116
| | | | | | libc++ already does the right thing here; I've just added tests to ensure that it stays this way. llvm-svn: 203539
* Update synposis in <memory> to show move semantics for weak_ptr; add tests ↵Marshall Clow2014-03-054-0/+65
| | | | | | for already existing move semantics. Mark LWG issues #2315 (no changes needed), 2316 (move semantics for weak_ptr), 2252 (previous commit) and 2271 (previous commit) as complete. llvm-svn: 202931
* Found six (nmostly) identical files named 'test_allocator.h' in the libcxx ↵Marshall Clow2013-12-037-88/+6
| | | | | | test suite. Moved one to /support, made it a superset, and removed all but one of the others, and iupdated all the includes. Left the odd one (thread/futures/test_allocator.h) for later. llvm-svn: 196174
* LWG Issue 2162: mark allocator_traits::maxsize as noexceptMarshall Clow2013-08-271-1/+7
| | | | llvm-svn: 189399
* Implement n3656 - make_unique. Thanks to Howard for the review and suggestions.Marshall Clow2013-07-016-0/+146
| | | | llvm-svn: 185352
* default_delete needs a static_assert against void types. I had previously ↵Howard Hinnant2013-04-241-0/+24
| | | | | | thought that sizeof(void) would take care of this. I was wrong. llvm-svn: 180213
* addressof misbehaving for type with an implicit conversion operator to ↵Howard Hinnant2013-04-161-0/+18
| | | | | | char&. This fixes http://llvm.org/bugs/show_bug.cgi?id=15754 llvm-svn: 179608
* This is a start at making the libc++ test suite friendlier to the ↵Howard Hinnant2013-03-231-1/+6
| | | | | | -fnoexceptions flag. Although this is not a complete solution, it does reduce the number of test failures on OS X from 467 to 128 on OS X when -fno-exceptions is enabled, and does not impact the number of failures at all when -fno-exceptions is not enabled. The bulk of this code was donated anonymously. llvm-svn: 177824
* [tests] One last batch of XFAILs, for tests using new symbols added to libc++.Daniel Dunbar2013-02-0610-0/+50
| | | | | | | - As of this commit, the test suite should now fully pass on both darwin11 and darwin12 when testing against either a locally built libc++ or the system libc++. llvm-svn: 174478
* Andrew Morrow: There are two tests under test/utilities/memory that heap ↵Howard Hinnant2012-08-022-4/+0
| | | | | | | | | | | | | allocate two integers which remain unused and are subsequently leaked, so the test fail when run under valgrind. Unless I'm overlooking a subtle reason why they are needed I think they can be removed, allowing these tests to pass under valgrind. The attached patch removes the variables. If there is a reason for them to exist, I can change this to just delete them at the end of the test. llvm-svn: 161195
* Implement [util.smartptr.shared.atomic]. This is the last unimplementedHoward Hinnant2012-07-3011-0/+409
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | section in libc++. This requires a recompiled dylib. Failure to rebuild the dylib will result in a link-time error if and only if the functions from [util.smartptr.shared.atomic] are used. The implementation is not lock free. After considerable thought, I know of no way to make the implementation lock free. Ideas welcome along that front. But changing the ABI of shared_ptr is not on the table at this point. The mutex used to lock these function is encapsulated by std::__sp_mut. The only thing the client knows about std::__sp_mut is that it has a void* data member, can't be constructed, and has lock and unlock members. Within the binary __sp_mut is currently implemented as a pointer to a std::mutex. That can change in the future without disturbing the ABI (as long as sizeof(__sp_mut) remains constant. I specifically did not make __sp_mut a spin lock as I have a pathological distrust of spin locks. Testing on OS X reveals that the use of std::mutex in this role is not a large performance penalty as long as the contention for the mutex is low (more likely to get the lock than to have to wait). In the future we can still make __sp_mut a spin lock if that is what is desired (without ABI damage). The dylib contains 16 __sp_mut's to be chosen based on the hash of the address of the shared_ptr. The constant 16 is a ball-park reasonable space/time tradeoff. std::hash<T*> was changed to call __murmur2_or_cityhash, instead of the identity function. I had thought we had already done this, but I was mistaken. All of this is under #if __has_feature(cxx_atomic) even though the implementation is not lock free, because the signatures require access to std::memory_order, which is currently available only under __has_feature(cxx_atomic). llvm-svn: 160940
* Modernize relational operators for shared_ptr and unique_ptr. This includes ↵Howard Hinnant2012-02-212-0/+142
| | | | | | adding support for nullptr, and using less<T*>. Fixes http://llvm.org/bugs/show_bug.cgi?id=12056. llvm-svn: 151084
* Exercise rvalue arguements to make_shared for C++11 mode.Howard Hinnant2012-02-181-0/+11
| | | | llvm-svn: 150887
* Adjust two tests to account for a nasty change in copying behaviorAlexis Hunt2011-07-184-0/+18
| | | | | | | between C++03 and C++0x and its effect on exceptions, and another two to not test move construction when rvalue references are not available. llvm-svn: 135445
* Corrected some bugs in both memory and the tests. Preparing for being able ↵Howard Hinnant2011-05-112-5/+5
| | | | | | to turn on support for alias templates. llvm-svn: 131199
* LWG 1339Howard Hinnant2010-11-181-2/+3
| | | | llvm-svn: 119699
* LWG 1404Howard Hinnant2010-11-182-2/+48
| | | | llvm-svn: 119609
* license changeHoward Hinnant2010-11-16288-576/+576
| | | | llvm-svn: 119395
* sync with N3126Howard Hinnant2010-09-0520-1431/+0
| | | | llvm-svn: 113100
* Changed __config to react to all of clang's currently documented has_feature ↵Howard Hinnant2010-09-0430-122/+122
| | | | | | flags, and renamed _LIBCPP_MOVE to _LIBCPP_HAS_NO_RVALUE_REFERENCES to be more consistent with the rest of the libc++'s flags, and with clang's nomenclature. llvm-svn: 113086
* Fixing whitespace problemsHoward Hinnant2010-08-22304-309/+15523
| | | | llvm-svn: 111767
* US 108, N3109Howard Hinnant2010-08-211-1/+1
| | | | llvm-svn: 111747
* US 107Howard Hinnant2010-08-1919-19/+19
| | | | llvm-svn: 111538
* [util.smartptr.hash]Howard Hinnant2010-06-032-0/+2
| | | | llvm-svn: 105393
* Wiped out some non-ascii characters that snuck into the copyright.Howard Hinnant2010-05-11305-305/+305
| | | | llvm-svn: 103516
* libcxx initial importHoward Hinnant2010-05-11307-0/+1976
llvm-svn: 103490
OpenPOWER on IntegriCloud