Commit Graph

508 Commits

Author SHA1 Message Date
Howard Hinnant b929de3c3d Changed constraints on pair and tuple constructors from is_convertible to is_constructible.
llvm-svn: 134252
2011-07-01 20:12:51 +00:00
Howard Hinnant 5a33687da0 Correct for new rules regarding implicitly deleted special members. http://llvm.org/bugs/show_bug.cgi?id=10191
llvm-svn: 134248
2011-07-01 19:24: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 15434707e4 Patch by Petteri Räty, http://llvm.org/bugs/show_bug.cgi?id=8992
llvm-svn: 134155
2011-06-30 14:21:55 +00:00
Howard Hinnant 878e035ea1 test for pair piecewise construction
llvm-svn: 133667
2011-06-22 23:51:19 +00:00
Douglas Gregor 64ec101eb6 Teach libc++ about the addressof() overloads it needs to work with
Objective-C Automatic Reference Counting, where Objective-C object
pointers can have several different qualifiers (__strong, __weak,
__autoreleasing, __unsafe_unretained). These addressof() overloads are
only provided in ARC mode, and the __weak variant is conditionalized
on having weak-reference support in the ARC runtime.

For historical reasons, Clang provides these definitions itself, and
defines the macro _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF to note when
it as done so. The code belongs here, and this redundancy will be
eliminated in the future.

Addresses <rdar://problem/9658274>.

llvm-svn: 133656
2011-06-22 22:17:44 +00:00
Howard Hinnant 8298b9c2fd Add instructions for -U__STRICT_ANSI__ for Mac OS 10.6
llvm-svn: 133616
2011-06-22 12:13:55 +00:00
Howard Hinnant a945a32981 More fixes: One of my fixes to type_traits earlier today was incorrect, so that is reverted. Recently clang appears to have tightened up its definition of is_convertible and that has caused some failures in [unordered_][multi]map. I've switched to using is_constructible to restablish the desired functionality in [unordered_][multi]map. Specifically, inserting rvalues of move-only types for the keys.
llvm-svn: 133402
2011-06-19 21:45:00 +00:00
Howard Hinnant 2d62821f98 Miscellaneous minor fixes in <type_traits>
llvm-svn: 133401
2011-06-19 19:12:59 +00:00
Howard Hinnant ce53420e37 Provide names for template and function parameters in forward declarations. The purpose is to aid automated documentation tools.
llvm-svn: 133008
2011-06-14 19:58:17 +00:00
Nick Kledzik 50aab549c0 more Apple build system tweaks
llvm-svn: 132819
2011-06-09 23:31:35 +00:00
Howard Hinnant 30b7d2767c Update CREDITS.TXT
llvm-svn: 132780
2011-06-09 16:53:33 +00:00
Howard Hinnant 32208bde75 Move nullptr_t to unversioned namespace: Sean Hunt
llvm-svn: 132665
2011-06-05 13:00:46 +00:00
Howard Hinnant bd0c160078 noexcept for <stack>. This completes noexcept for Chapter 23 [containers].
llvm-svn: 132652
2011-06-04 22:09:19 +00:00
Howard Hinnant 6971d82668 noexcept for <queue>.
llvm-svn: 132650
2011-06-04 21:32:33 +00:00
Howard Hinnant 557da866a3 noexcept for <unordered_set>.
llvm-svn: 132647
2011-06-04 20:18:37 +00:00
Howard Hinnant 3714107ed6 noexcept for <unordered_map>.
llvm-svn: 132646
2011-06-04 18:54:24 +00:00
Howard Hinnant e691351098 Made more implementation details of [multi]map/set noexcept.
llvm-svn: 132642
2011-06-04 17:10:24 +00:00
Howard Hinnant 0e9f71c13f noexcept for <set>. Plus a few fixes to noexcept for <map>.
llvm-svn: 132640
2011-06-04 15:22:34 +00:00
Howard Hinnant 1052ee39cb noexcept for <map>.
llvm-svn: 132639
2011-06-04 14:31:57 +00:00
Howard Hinnant 3297ed7065 noexcept for <vector>. This also includes installing move_if_noexcept() into vector.
llvm-svn: 132577
2011-06-03 19:40:40 +00:00
Howard Hinnant 2d45a18c24 Bring noexcept for <string> inline with other containers.
llvm-svn: 132573
2011-06-03 18:40:47 +00:00
Howard Hinnant 4590010473 noexcept for <list>.
llvm-svn: 132562
2011-06-03 17:30:28 +00:00
Howard Hinnant 91a4750733 noexcept for <forward_list>.
llvm-svn: 132553
2011-06-03 16:20:53 +00:00
Howard Hinnant 801291139c After sleeping on it I've decided that all special members that can be noexcept, should be declared so. The client has the traits to detect and branch on this information, and it is often an important optimization. Give deque() a noexcept. Add test for deque default constructor and deque destructor.
llvm-svn: 132549
2011-06-03 15:16:49 +00:00
Howard Hinnant 60954bbbbc Add noexcept tests for deque.
llvm-svn: 132523
2011-06-03 01:46:22 +00:00
Howard Hinnant b58f59cdb3 Second try at getting noexcept on move and swap for deque. I changed std::alloctor to propagate_on_container_move_assignment so as to make deque<T> move assignment noexcept. What we really need is a compile-time switch that says an allocator always compares equal.
llvm-svn: 132490
2011-06-02 21:38:57 +00:00
Howard Hinnant 9eebe11dd5 I've become quite disatsified with the lack of noexcept specifications on container move construction, move assignment operator and swap. Without proper decoration on at least move construction, vectors of containers will have unacceptable performance. Here's the fix for deque.
llvm-svn: 132480
2011-06-02 20:00:14 +00:00
Howard Hinnant f9dc28313f noexcept for forward_list.
llvm-svn: 132461
2011-06-02 16:44:28 +00:00
Howard Hinnant a87e836083 noexcept for deque.
llvm-svn: 132459
2011-06-02 16:10:22 +00:00
Howard Hinnant bc95cf0d5f Experimental support for a meaningful __is_swappable<T>::value. This does not appear to be strictly needed for correct functioning of the library. If it causes any problems, I'd rather pull it sooner rather than later.
llvm-svn: 132421
2011-06-01 19:59:32 +00:00
Howard Hinnant e88f577da1 Turning on cxx_nullptr exposed a latent bug in is_function, causing nullptr to wrongly classify as a function. Fixed.
llvm-svn: 132406
2011-06-01 17:25:11 +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 8f0cd597f1 noexcept for <array>.
llvm-svn: 132359
2011-05-31 21:06:33 +00:00
Howard Hinnant e3c6708439 Upgrade <ratio> to use template aliases when available.
llvm-svn: 132342
2011-05-31 16:55:36 +00:00
Howard Hinnant b5d866d4a3 noexcept for Chapter 22 [localization].
llvm-svn: 132337
2011-05-31 15:34:58 +00:00
Howard Hinnant f5c91471a4 Add _ATTRIBUTE macro for gcc: Justin Hibbits
llvm-svn: 132334
2011-05-31 13:13:49 +00:00
Howard Hinnant 76c7cd0e15 noexcept for Chapter 21 [strings].
llvm-svn: 132296
2011-05-29 19:57:12 +00:00
Howard Hinnant 28d55e0745 http://llvm.org/bugs/show_bug.cgi?id=10045 . Please review, I have not tested this on linux.
llvm-svn: 132287
2011-05-29 13:57:49 +00:00
Howard Hinnant af152c8431 minor documentation update
llvm-svn: 132286
2011-05-29 13:53:56 +00:00
Howard Hinnant 9e5c99f61f noexcept for <typeindex>. This completes Chapter 20 [utilities].
llvm-svn: 132267
2011-05-28 18:57:24 +00:00
Howard Hinnant cfd52789dc noexcept for <scoped_allocator>.
llvm-svn: 132266
2011-05-28 18:51:12 +00:00
Howard Hinnant d53d81522d noexcept for <chrono>.
llvm-svn: 132265
2011-05-28 18:34:36 +00:00
Howard Hinnant 6a07d6f06d noexcept for <functional>.
llvm-svn: 132264
2011-05-28 17:59:48 +00:00
Howard Hinnant 3739fe79e5 noexcept for <memory>. I've added a few extension noexcept to: allocator_traits<A>::deallocate, allocaate<T>::deallocate, return_temporary_buffer, and default_delete<T>::operator()(T*) const. My rationale was: If a std-dicated noexcept function needs to call another std-defined function, that called function must be noexcept. We're all a little new to noexcept, so things like this are to be expected. Also included fix for broken __is_swappable trait pointed out by Marc Glisse, thanks Marc|. And fixed a test case for is_nothrow_destructible. Destructors are now noexcept by default|
llvm-svn: 132261
2011-05-28 14:41:13 +00:00
Howard Hinnant d368a84c91 noexcept for <bitset>.
llvm-svn: 132216
2011-05-27 20:52:28 +00:00
Howard Hinnant 27d0a2a75d noexcept for <tuple>. And in the process learned that I had done it wrong for pair's swap. I needed to create an __is_nothrow_swappable<T>::value trait that was smart enought to answer false when __is_swappable<T>::value is false. Otherwise one gets compile-time errors when using pair or tuple of non-swappable types, even if you never try to swap the pair or tuple.
llvm-svn: 132204
2011-05-27 19:08:18 +00:00
Howard Hinnant a676f7d36a noexcept for <utility>. This included a little repair on pair, and some noexcept workarounds.
llvm-svn: 132186
2011-05-27 15:04:19 +00:00
Howard Hinnant a62f28994c Applied noexcept to everything in [diagnostics] (Chapter 19)
llvm-svn: 132137
2011-05-26 19:48:01 +00:00
Howard Hinnant 411d1bcc3b Turn on cxx_alias_templates support
llvm-svn: 132134
2011-05-26 19:07:54 +00:00
Howard Hinnant fafca58c58 Applied noexcept to everything in [language.support] (Chapter 18)
llvm-svn: 132129
2011-05-26 18:23:59 +00:00
Howard Hinnant 400b244339 Added [[noreturn]] attribute everywhere it should be
llvm-svn: 132125
2011-05-26 17:07:32 +00:00
Nick Kledzik bc6191fba9 support another Apple build environment
llvm-svn: 131996
2011-05-24 20:27:31 +00:00
Nick Kledzik 664c0da5d8 on Darwin re-export C++0x type infos
llvm-svn: 131995
2011-05-24 20:26:04 +00:00
Howard Hinnant cf76200bd3 http://llvm.org/bugs/show_bug.cgi?id=9399 fixed by Ryuta Suzuki
llvm-svn: 131961
2011-05-24 12:54:00 +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 5eb6bdfa1d __invokable and __invoke_of now check for incomplete types and issue a compile-time diagnostic if they are used with incomplete types for anything except a return type. Note that both arguments *and* parameters are checked for completeness.
llvm-svn: 131818
2011-05-22 00:09:02 +00:00
Howard Hinnant 6282a4a1d3 This is a simplified (and superior) implementation of __invoke, __invokable and __invoke_of. It is superior in that __invoke now handles reference qualified member functions whereas the previous implementation did not. And it simply has less infrastructure in its implementation. I'm still learning how to program in C++11 (and probably will be for a long time). This change does not impact the behavior we're seeing in http://llvm.org/bugs/show_bug.cgi?id=9975
llvm-svn: 131761
2011-05-20 22:02:53 +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 ec0810e1c8 I had a giant misunderstanding of what 'synchronizes with' meant in [futures.async]/p5. This invalidated the current design of async in <future>. This is a new design, based on my new understanding, which has been confirmed on the lwg mailing list. The summary is that ~future() (and ~shared_future()) will block when they are created from within async, and the thread hasn't finished yet. As part of this work I created two new type traits: __invokable<F, Args...>::value and __invoke_of<F, Args...>::type. These are what result_of<F(Args...)> wanted to be when it grew up, but never will be. __invoke_of is carefully crafted so that it can serve as its own enable_if (type doesn't exist if the signature isn't invokable). All of this work is C++11 only.
llvm-svn: 131639
2011-05-19 15:05:04 +00:00
Howard Hinnant c2bf9e1851 This commit was accidental. Reverting.
llvm-svn: 131514
2011-05-18 00:47:00 +00:00
Howard Hinnant 781afe1934 A bunch of future tests got invalidated with the latest updates to thread. Fixed the tests.
llvm-svn: 131509
2011-05-17 23:32:48 +00:00
Howard Hinnant dcaa2e9294 Fix ambiguity in operator== of scoped_allocator_adaptor.
llvm-svn: 131485
2011-05-17 20:41:18 +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 5fdeee5b3a Fix and beef up test bug for move_if_noexcept
llvm-svn: 131483
2011-05-17 20:10:42 +00:00
Howard Hinnant fe7e3eeddc Clean up a bunch of warnings in the tests, 3 of which actually turned out to be test bugs.
llvm-svn: 131479
2011-05-17 19:12:55 +00:00
Howard Hinnant 872a91167e Brought call_once variadic call up to current spec, which allows move-only functors and move-only arguments, but disallows functors with non-const lvalue reference parameters.
llvm-svn: 131414
2011-05-16 19:05:11 +00:00
Howard Hinnant 8df61ea84d Brought thread variadic constructor up to current spec, which allows move-only functors and move-only arguments, but disallows functors with non-const lvalue reference parameters.
llvm-svn: 131413
2011-05-16 18:40:35 +00:00
Howard Hinnant 7735ccaf86 Supply missing std::qualifier to call.
llvm-svn: 131410
2011-05-16 16:20:59 +00:00
Howard Hinnant 23fdcd70c6 Spit 5th bullet __invoke into function pointers and everything else because result_of doesn't deal with function pointers.
llvm-svn: 131409
2011-05-16 16:20:21 +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
Howard Hinnant 15c34d48ba Redesign of result_of to handle reference-qualified member functions
llvm-svn: 131407
2011-05-16 16:17:21 +00:00
Howard Hinnant b12c37b302 Fix type-o found by Justin Hibbits
llvm-svn: 131348
2011-05-14 18:20:45 +00:00
Howard Hinnant 6db38ae05c Fix type-o found by Justin Hibbits
llvm-svn: 131346
2011-05-14 17:24:22 +00:00
Howard Hinnant af6c26b366 Warning suppression in test.
llvm-svn: 131344
2011-05-14 15:38:08 +00:00
Howard Hinnant 3962348edf Warning suppression in test.
llvm-svn: 131343
2011-05-14 15:36:25 +00:00
Howard Hinnant 6c4c6a8047 Warning suppression in test.
llvm-svn: 131341
2011-05-14 14:53:12 +00:00
Howard Hinnant c6b9ff1169 Correction to hexfloat hack.
llvm-svn: 131340
2011-05-14 14:33:56 +00:00
Howard Hinnant e0d67710e9 Fix test bug.
llvm-svn: 131328
2011-05-14 00:07:53 +00:00
Howard Hinnant fe7cffaf57 Suppress some warings in the tests.
llvm-svn: 131327
2011-05-14 00:04:05 +00:00
Howard Hinnant a7fa0710cb Suppress some warings in the tests.
llvm-svn: 131326
2011-05-13 23:59:50 +00:00
Howard Hinnant fb7f07e3bd http://llvm.org/bugs/show_bug.cgi?id=9854. Also created an emulated hexfloat literal for use in some of the tests. <sigh> And cleaned up some harmless but irritating warnings in the tests.
llvm-svn: 131318
2011-05-13 21:52:40 +00:00
Howard Hinnant 3e71464d50 http://llvm.org/bugs/show_bug.cgi?id=9118
llvm-svn: 131296
2011-05-13 17:16:06 +00:00
Howard Hinnant 467fc38320 A much improved type_traits for C++0x. Not yet done: is_trivially_constructible, is_trivially_assignable and underlying_type.
llvm-svn: 131291
2011-05-13 14:08:16 +00:00
Howard Hinnant 5dbf45dfe0 CWG 1170 has been fixed for destructors
llvm-svn: 131290
2011-05-13 13:39:08 +00:00
Alexis Hunt 662d91f1cd __is_trivially_copyable now supplied by clang
llvm-svn: 131271
2011-05-13 00:32:09 +00:00
Howard Hinnant f208605bd4 Corrected misspelling
llvm-svn: 131265
2011-05-13 00:03:08 +00:00
Howard Hinnant b24491b73e Updated to reflect updated use of existing clang support
llvm-svn: 131264
2011-05-13 00:01:01 +00:00
Howard Hinnant f738497500 Corrected some bugs in both memory and the tests. Preparing for being able to turn on support for alias templates.
llvm-svn: 131199
2011-05-11 20:21:19 +00:00
Howard Hinnant 08ad63b580 Redid nothrow traits in terms of non-nothrow traits when noexcept is available
llvm-svn: 131198
2011-05-11 20:19:40 +00:00
Howard Hinnant 0cfdb9517e Updated type_traits and the type_traits design doc with recent work done in clang.
llvm-svn: 131090
2011-05-09 19:21:17 +00:00
Nick Kledzik f9ad245c90 change RC_BUILDIT to RC_XBS for detecting Apple build environment
llvm-svn: 130970
2011-05-06 01:13:20 +00:00
Nick Kledzik 7db91cefb2 add support for setjmp/longjmp based exceptions
llvm-svn: 130938
2011-05-05 18:45:41 +00:00
Nick Kledzik de214e29df <rdar://problem/9014045> more support for Apple internal build environments
llvm-svn: 130872
2011-05-04 21:50:46 +00:00
Howard Hinnant 575d41ee92 Correction to set of overloaded pair constructors for C++0x
llvm-svn: 130521
2011-04-29 18:10:55 +00:00
Douglas Gregor 6c38001ec5 Qualify calls to std::next(), to avoid conflicts with
libraries/applications that define their own 'next' template.

llvm-svn: 130511
2011-04-29 16:20:26 +00:00
Howard Hinnant 9d06c8c326 http://llvm.org/bugs/show_bug.cgi?id=9765
llvm-svn: 129910
2011-04-21 14:29:59 +00:00
Howard Hinnant 866d73c7b4 Think-o in poisson_distribution at mean == 10
llvm-svn: 129520
2011-04-14 15:59:22 +00:00
Howard Hinnant a23551cad4 Fix bug in Sseq constraints found by Seth Cantrell
llvm-svn: 129285
2011-04-11 18:22:12 +00:00
Howard Hinnant 40dab2ce86 http://llvm.org/bugs/show_bug.cgi?id=9672
llvm-svn: 129266
2011-04-11 02:18:41 +00:00