summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities/memory/util.smartptr
Commit message (Collapse)AuthorAgeFilesLines
* [libc++] Remove C++03 variadics in shared_ptrZoe Carver2019-09-242-122/+79
| | | | | | | | | | | | | | Summary: As suggested by @ldionne in D66178, this patch removes C++03 variadics //only//. Following patches will apply more updates. Reviewers: ldionne, EricWF, mclow.lists Subscribers: christof, dexonsmith, libcxx-commits, ldionne Tags: #libc Differential Revision: https://reviews.llvm.org/D67675 llvm-svn: 372780
* libcxx: Rename .hpp files in libcxx/test/support to .hNico Weber2019-08-2110-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | LLVM uses .h as its extension for header files. Files renamed using: for f in libcxx/test/support/*.hpp; do git mv $f ${f%.hpp}.h; done References to the files updated using: for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do a=$(basename $f); echo $a; rg -l $a libcxx | xargs sed -i '' "s/$a/${a%.hpp}.h/"; done HPP include guards updated manually using: for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do echo ${f%.hpp}.h ; done | xargs mvim Differential Revision: https://reviews.llvm.org/D66104 llvm-svn: 369481
* Add include for 'test_macros.h' to all the tests that were missing them. ↵Marshall Clow2019-05-3156-0/+100
| | | | | | Thanks to Zoe for the (big, but simple) patch. NFC intended. llvm-svn: 362252
* [libc++] Enable deprecation warnings by defaultLouis Dionne2019-03-123-0/+5
| | | | | | | | | | | | | | | | | | | Summary: In r342843, I added deprecation warnings to some facilities that were deprectated in C++14 and C++17. However, those deprecation warnings were not enabled by default. After discussing this on IRC, we had finally gotten consensus to enable those warnings by default, and I'm getting around to doing that only now. Reviewers: mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, jdoerfert, libcxx-commits Differential Revision: https://reviews.llvm.org/D58140 llvm-svn: 355961
* Support tests in freestandingJF Bastien2019-02-0489-89/+267
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Freestanding is *weird*. The standard allows it to differ in a bunch of odd manners from regular C++, and the committee would like to improve that situation. I'd like to make libc++ behave better with what freestanding should be, so that it can be a tool we use in improving the standard. To do that we need to try stuff out, both with "freestanding the language mode" and "freestanding the library subset". Let's start with the super basic: run the libc++ tests in freestanding, using clang as the compiler, and see what works. The easiest hack to do this: In utils/libcxx/test/config.py add: self.cxx.compile_flags += ['-ffreestanding'] Run the tests and they all fail. Why? Because in freestanding `main` isn't special. This "not special" property has two effects: main doesn't get mangled, and main isn't allowed to omit its `return` statement. The first means main gets mangled and the linker can't create a valid executable for us to test. The second means we spew out warnings (ew) and the compiler doesn't insert the `return` we omitted, and main just falls of the end and does whatever undefined behavior (if you're luck, ud2 leading to non-zero return code). Let's start my work with the basics. This patch changes all libc++ tests to declare `main` as `int main(int, char**` so it mangles consistently (enabling us to declare another `extern "C"` main for freestanding which calls the mangled one), and adds `return 0;` to all places where it was missing. This touches 6124 files, and I apologize. The former was done with The Magic Of Sed. The later was done with a (not quite correct but decent) clang tool: https://gist.github.com/jfbastien/793819ff360baa845483dde81170feed This works for most tests, though I did have to adjust a few places when e.g. the test runs with `-x c`, macros are used for main (such as for the filesystem tests), etc. Once this is in we can create a freestanding bot which will prevent further regressions. After that, we can start the real work of supporting C++ freestanding fairly well in libc++. <rdar://problem/47754795> Reviewers: ldionne, mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, arphaman, miyuki, libcxx-commits Differential Revision: https://reviews.llvm.org/D57624 llvm-svn: 353086
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1987-348/+261
| | | | | | | | | | | | | | | | | | to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
* Use addressof instead of operator& in make_shared. Fixes PR38729. As a ↵Marshall Clow2018-08-282-0/+17
| | | | | | drive-by, make the same change in raw_storage_iterator (twice). llvm-svn: 340823
* Land D28253 which fixes PR28929 (which we mistakenly marked as fixed before)Marshall Clow2017-12-052-0/+58
| | | | llvm-svn: 319736
* Change (void) casts to TEST_IGNORE_NODISCARD, as requested by Eric. Reviewed ↵Billy Robert O'Neal III2017-11-211-1/+1
| | | | | | as https://reviews.llvm.org/D40065 llvm-svn: 318804
* Tolerate even more [[nodiscard]] in the STL. Reviewed as ↵Billy Robert O'Neal III2017-11-152-6/+6
| | | | | | https://reviews.llvm.org/D39080 llvm-svn: 318277
* Tolerate [[nodiscard]] annotations in the STL. Reviewed as ↵Billy Robert O'Neal III2017-11-151-1/+1
| | | | | | https://reviews.llvm.org/D39033 llvm-svn: 318276
* [libcxx] [test] Fix URLs in comments and make them HTTPS. NFC.Stephan T. Lavavej2017-08-051-1/+1
| | | | llvm-svn: 310156
* Mark LWG 2942 as completeEric Fiselier2017-07-302-4/+2
| | | | llvm-svn: 309528
* [libcxx] [test] Untabify, NFC.Stephan T. Lavavej2017-07-292-11/+11
| | | | llvm-svn: 309464
* [libcxx] [test] Remove an unused local typedef in ↵Stephan T. Lavavej2017-07-271-1/+0
| | | | | | | | enable_shared_from_this.pass.cpp. Trivial change, committed without review. llvm-svn: 309322
* [test] Fix breakage from r303947 =(Casey Carter2017-05-261-2/+4
| | | | llvm-svn: 303951
* [test] make_shared<T()>(...) is, uh, libc++-specificCasey Carter2017-05-261-5/+13
| | | | llvm-svn: 303947
* Add support for shared_ptr<FunctionType>Erik Pilkington2017-05-251-1/+12
| | | | | | | | Fixes PR27566. Differential revision: https://reviews.llvm.org/D30837 llvm-svn: 303874
* Fix enable_shared_from_this test in C++11Eric Fiselier2017-05-101-7/+6
| | | | llvm-svn: 302721
* [libc++] Fix PR32979 - types with a private std::enable_shared_from_this ↵Eric Fiselier2017-05-101-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | base break shared_ptr Summary: This patch fixes bugs.llvm.org/PR32979. [util.smartptr.shared.const] says: > In the constructor definitions below, enables shared_from_this with p, for a pointer p of type Y*, means > that if Y has an unambiguous and accessible base class that is a specialization of enable_shared_from_- > this. This means that libc++ needs to respect the access specifier of the base class, and not attempt to construct and enabled_shared_from_this base if it is private. However access specifiers don't affect overload resolution so our current implementation will attempt to construct the private base. This patch uses SFINAE to correctly detect if the shared_ptr input has an accessible enable_shared_from_this base class. Reviewers: mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33033 llvm-svn: 302709
* Add markup for libc++ dylib availabilityMehdi Amini2017-05-0410-20/+20
| | | | | | | | | | | | | | | Libc++ is used as a system library on macOS and iOS (amongst others). In order for users to be able to compile a binary that is intended to be deployed to an older version of the platform, clang provides the availability attribute <https://clang.llvm.org/docs/AttributeReference.html#availability>_ that can be placed on declarations to describe the lifecycle of a symbol in the library. See docs/DesignDocs/AvailabilityMarkup.rst for more information. Differential Revision: https://reviews.llvm.org/D31739 llvm-svn: 302172
* [libcxx] [test] Strip trailing whitespace. NFC.Stephan T. Lavavej2017-05-041-1/+1
| | | | llvm-svn: 302105
* Allow a standard library to implement conditional noexcept for optional and ↵Billy Robert O'Neal III2017-04-181-2/+6
| | | | | | | | | | unique_ptr hash functions. These tests were unconditionally asserting that optional and unique_ptr declare throwing hashes, but MSVC++ implements conditional noexcept forwarding that of the underlying hash function. As a result we were failing these tests but there's nothing forbidding strengthening noexcept in that way. Changed the ASSERT_NOT_NOEXCEPT asserts to use types which themselves have non-noexcept hash functions. llvm-svn: 300516
* Implement LWG#2873: 'Add noexcept to several shared_ptr related functions' ↵Marshall Clow2017-04-115-15/+35
| | | | | | This issue missed a couple, so I added those as well (see LWG#2942) llvm-svn: 299963
* Revert "Allow a standard library to implement conditional noexcept for ↵Akira Hatanaka2017-04-071-5/+1
| | | | | | | | optional and unique_ptr hash functions." This reverts commit r299734. llvm-svn: 299744
* Add noexcept(false) to more strongly indicate that not being noexcept is ↵Billy Robert O'Neal III2017-04-061-1/+1
| | | | | | important for hash tests. llvm-svn: 299735
* Allow a standard library to implement conditional noexcept for optional and ↵Billy Robert O'Neal III2017-04-061-1/+5
| | | | | | | | | | unique_ptr hash functions. These tests were unconditionally asserting that optional and unique_ptr declare throwing hashes, but MSVC++ implements conditional noexcept forwarding that of the underlying hash function. As a result we were failing these tests but there's nothing forbidding strengthening noexcept in that way. Changed the ASSERT_NOT_NOEXCEPT asserts to use types which themselves have non-noexcept hash functions. llvm-svn: 299734
* Silence a couple of 'unused variable' warnings in c++03 tests. No functional ↵Marshall Clow2017-03-232-0/+2
| | | | | | change llvm-svn: 298582
* Implement P0599: 'noexcept for hash functions'. Fix a couple of hash ↵Marshall Clow2017-03-231-0/+1
| | | | | | functions (optional<T> and unique_ptr<T>) which were mistakenly marked as 'noexcept'. Reviewed as https://reviews.llvm.org/D31234 llvm-svn: 298573
* Add deployment knobs to tests (for Apple platforms)Mehdi Amini2017-03-1510-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tests for libc++ specify -target on the command-line to the compiler, but this is problematic for a few reasons. Firstly, the -target option isn't supported on Apple platforms. Parts of the triple get dropped and ignored. Instead, software should be compiled with a combination of the -arch and -m<name>-version-min options. Secondly, the generic "darwin" target references a kernel version instead of a platform version. Each platform has its own independent versions (with different versions of libc++.1.dylib), independent of the version of the Darwin kernel. This commit adds support to the LIT infrastructure for testing against Apple platforms using -arch and -platform options. If the host is not on OS X, or the compiler type is not clang or apple-clang, then this commit has NFC. If the host is on OS X and --param=target_triple=... is specified, then a warning is emitted to use arch and platform instead. Besides the warning, there's NFC. If the host is on OS X and *no* target-triple is specified, then use the new deployment target logic. This uses two new lit parameters, --param=arch=<arch> and --param=platform=<platform>. <platform> has the form <name>[<version>]. By default, arch is auto-detected from clang -dumpmachine, and platform is "macosx". If the platform doesn't have a version: For "macosx", the version is auto-detected from the host system using sw_vers. This may give a different version than the SDK, since new SDKs can be installed on older hosts. Otherwise, the version is auto-detected from the SDK version using xcrun --show-sdk-path. -arch <arch> -m<name>-version-min=<version> is added to the compiler flags. The target triple is computed as <arch>-apple-<platform>. It is *not* passed to clang, but it is available for XFAIL and UNSUPPORTED (as is with_system_cxx_lib=<target>). For convenience, apple-darwin and <arch>-apple-darwin are added to the set of available features. There were a number of tests marked to XFAIL on x86_64-apple-darwin11 and x86_64-apple-darwin12. I updated these to x86_64-apple-macosx10.7 and x86_64-apple-macosx10.8. llvm-svn: 297798
* Remove more usages of REQUIRES-ANY in the test-suiteEric Fiselier2017-03-022-2/+2
| | | | llvm-svn: 296727
* Update all bug URL's to point to https://bugs.llvm.org/...Eric Fiselier2017-02-172-3/+3
| | | | llvm-svn: 295434
* Remove auto_ptr in C++17. Get it back by defining ↵Marshall Clow2017-01-242-0/+2
| | | | | | _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR llvm-svn: 292986
* Fix recent build errorsEric Fiselier2017-01-211-2/+5
| | | | llvm-svn: 292689
* Implement P0513R0 - "Poisoning the Hash"Eric Fiselier2017-01-213-0/+102
| | | | | | | | | | | | | | | | | | | | | 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
* Refactor unique_ptr/shared_ptr deleter test types into single header.Eric Fiselier2017-01-2012-81/+11
| | | | llvm-svn: 292577
* [libcxx] [test] Fix comment typos, strip trailing whitespace.Stephan T. Lavavej2017-01-181-2/+2
| | | | | | No functional change, no code review. llvm-svn: 292434
* Replace _LIBCPP_HAS_NO_DELETED_FUNCTIONS with _LIBCPP_CXX03_LANGEric Fiselier2017-01-061-1/+3
| | | | llvm-svn: 291278
* Protect smart-pointer tests under no exceptionsRoger Ferrer Ibanez2016-11-142-2/+8
| | | | | | | | Skip tests that expect an exception be thrown under no-exceptions. Differential Revision: https://reviews.llvm.org/D26457 llvm-svn: 286809
* Change from "XFAIL: libcpp-no-exceptions" to "UNSUPPORTED: ↵Roger Ferrer Ibanez2016-10-315-5/+5
| | | | | | | | | | | | | libcpp-no-exceptions" tests that only check exceptions and nothing else This is a follow up of D24562. These tests do not check anything but exceptions, so it makes sense to mark them as UNSUPPORTED under a library built without exceptions. Differential Revision: https://reviews.llvm.org/D26075 llvm-svn: 285550
* Remove all instances of _LIBCPP_HAS_NO_RVALUE_REFERENCES from test/std/utilitiesEric Fiselier2016-10-016-19/+30
| | | | llvm-svn: 283032
* Implement P0163r0. Add shared_ptr::weak_type.Eric Fiselier2016-06-271-0/+6
| | | | | | | | | | This patch adds the weak_type typedef in shared_ptr. It is available in C++17 and newer. This patch also updates the _LIBCPP_STD_VER and TEST_STD_VER macros to have the value of 16, since 2016 is the current year. llvm-svn: 273839
* Fix C++03 failure in enable_shared_from_this testEric Fiselier2016-06-271-1/+2
| | | | llvm-svn: 273836
* Fix PR27115 - enable_shared_from_this does not work as a virtual base class.Eric Fiselier2016-06-261-0/+16
| | | | | | | | | | | | | See https://llvm.org/bugs/show_bug.cgi?id=27115 The problem was that the conversion from 'const enable_shared_from_this<T>*' to 'const T*' didn't work if T inherited enable_shared_from_this as a virtual base class. The fix is to take the original pointer passed to shared_ptr's constructor in the __enable_weak_this method and perform an upcast to 'const T*' instead of performing a downcast from the enable_shared_from_this base. llvm-svn: 273835
* Make shared_ptr constructor tests use count_new.hppEric Fiselier2016-06-225-151/+92
| | | | llvm-svn: 273379
* Replace __cplusplus comparisons and dialect __has_feature checks with ↵Eric Fiselier2016-06-1415-26/+50
| | | | | | | | | TEST_STD_VER. This is a huge cleanup that helps make the libc++ test suite more portable. Patch from STL@microsoft.com. Thanks STL! llvm-svn: 272716
* Fix leak in __enable_weak_this(). Thanks to Arthur O'Dwyer for finding it.Eric Fiselier2016-06-021-1/+33
| | | | llvm-svn: 271487
* Remove enable_shared_from_this test since it leaks the control block and ↵Eric Fiselier2016-06-021-26/+0
| | | | | | fails with ASAN llvm-svn: 271459
* Implement P0033R1 - Re-enabling shared_from_thisEric Fiselier2016-06-021-0/+86
| | | | | | | | | | | | Summary: See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0033r1.html Reviewers: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19254 llvm-svn: 271449
* Remove trailing whitespace in test suite. Approved by Marshall Clow.Eric Fiselier2016-06-014-7/+7
| | | | llvm-svn: 271435
OpenPOWER on IntegriCloud