Commit Graph

682 Commits

Author SHA1 Message Date
Howard Hinnant 8b805c915a The rules for emplace in map, multimap, unordered_map and unordered_multimap changed a while back and I'm just now updating to these new rules. In a nutshell, you've got to know you're emplacing to a pair and use one of pair's constructors. I made one extension: If you want to emplace the key and default construct the mapped_type, you can just emplace(key), as opposed to emplace(piecewise_construct, forward_as_tuple(key), forward_as_tuple()).
llvm-svn: 157503
2012-05-25 22:04:21 +00:00
Howard Hinnant a960edd203 Fix memory corruption bug found and fixed by Andrew C. Morrow.
llvm-svn: 157476
2012-05-25 15:55:46 +00:00
Howard Hinnant 49c3b20737 Add documentation regarding -fno-rtti.
llvm-svn: 157157
2012-05-20 13:03:53 +00:00
Howard Hinnant ed81e910bd Revert fix to http://llvm.org/bugs/show_bug.cgi?id=12867 for the reason now included in the code comment.
llvm-svn: 157128
2012-05-19 20:20:49 +00:00
Douglas Gregor a336f5e645 Revert my _LIBCPP_INLINE_VISIBILITY changes, r157097 and r157107
llvm-svn: 157108
2012-05-19 07:14:17 +00:00
Douglas Gregor a1b6937dba valarray resize should not be _LIBCPP_INLINE_VISIBILITY
llvm-svn: 157107
2012-05-19 07:01:14 +00:00
Douglas Gregor 8f69b1af3d Move _LIBCPP_VISIBLE_INLINE from the out-of-line definitions of member
functions to the original declarations, so that Clang will actually
see them. Part of <rdar://problem/11489333>.

llvm-svn: 157097
2012-05-19 04:41:25 +00:00
Howard Hinnant 9042d623bf Protect __shared_weak_count::__get_deleter declaration with _LIBCPP_NO_RTTI. Fixes http://llvm.org/bugs/show_bug.cgi?id=12867
llvm-svn: 157049
2012-05-18 13:06:21 +00:00
Howard Hinnant 423a8d7733 Fix several bugs in find/count specialized for bits.
llvm-svn: 156546
2012-05-10 14:55:00 +00:00
Howard Hinnant 19d9cbfb39 Add friends __count_bool_true and __count_bool_false to __bit_iterator.
llvm-svn: 156543
2012-05-10 14:01:40 +00:00
Howard Hinnant 0ae9efeb1a SFINAE __bit_iterator such that it will only get instantiated with a container that has the nested type __storage_type. This prevents accidental instantiation such as in http://llvm.org/bugs/show_bug.cgi?id=12755. This fixes http://llvm.org/bugs/show_bug.cgi?id=12755.
llvm-svn: 156308
2012-05-07 16:50:38 +00:00
Howard Hinnant df7aad41fd Constrain __bind functor constructor such that it won't accidentally get used as a copy constructor from a non-const lvalue. Fixes <rdar://problem/11359080>.
llvm-svn: 156182
2012-05-04 17:21:02 +00:00
Howard Hinnant 9acfc3af72 Change std::abs from a template function to three overloads for float, double and long double.
llvm-svn: 156064
2012-05-03 14:58:34 +00:00
Howard Hinnant bff1bfc6be Greatly scale back ambitions of emulating move semantics in C++03 mode. It was causing more problems than it solved. This fixes http://llvm.org/bugs/show_bug.cgi?id=12704.
llvm-svn: 155918
2012-05-01 15:37:54 +00:00
Richard Smith 11ffde3d7e libc++: only #include <cxxabi.h> if it exists. This allows libc++ to build
out of the box on Linux systems. If you're building against libc++abi, you
still need to make sure it can find <cxxabi.h> so it knows not to export
symbols which libc++abi provides.

llvm-svn: 155091
2012-04-19 01:36:12 +00:00
Richard Smith 99f15d6eb7 libc++: Add some missing #includes to atomics tests. libc++ doesn't need these
at the moment, but they allow these tests to be used to test clang against
libstdc++. Add myself to the credits file, as suggested by Howard.

llvm-svn: 155085
2012-04-19 00:50:47 +00:00
Howard Hinnant d01320c200 Apply noexcept and constexpr to <atomic>.
llvm-svn: 154526
2012-04-11 20:14:21 +00:00
Richard Smith 766e8ccbfc Switch libc++ from __atomic_* builtins to __c11_atomic_* builtins.
Per discussion with Howard, we are not interested in maintaining
compatibility with older versions of clang.

All tests pass with ToT clang, except for two which assert due to
a pre-existing, unrelated bug.

llvm-svn: 154521
2012-04-11 18:55:46 +00:00
David Chisnall cd42f9446b Now that clang supports doing the right thing with regard to atomic
initialisation, do the right thing with regard to atomic initialisation.

Note: clang r154507 or later required for <atomic> to work now.
llvm-svn: 154508
2012-04-11 17:26:23 +00:00
David Chisnall 4fa71de024 Fix the remaining atomic tests, all of which were wrong for the case where a
compare-and-exchange failed (it should update the expected value to the current
value, and the tests were checking that it didn't...).

Results of the atomics part of the test suite on FreeBSD with clang trunk and
the atomic.c from compiler-rt (currently kludged into the test, not installed
properly):

****************************************************
Results for /root/libc++/test/atomics:
using clang version 3.1 (trunk 153415)
Target: x86_64-unknown-freebsd10.0
Thread model: posix
with -std=c++0x -stdlib=libc++ -pthread /tmp/atomic.o  
----------------------------------------------------
sections without tests   : 0
sections with failures   : 0
sections without failures: 14
                       +   ----
total number of sections : 14
----------------------------------------------------
number of tests failed   : 0
number of tests passed   : 52
                       +   ----
total number of tests    : 52
****************************************************

Yay!

llvm-svn: 154095
2012-04-05 13:48:16 +00:00
David Chisnall ca917f5342 Fix test cases that were trying to make atomic things that are not trivially copyable.
Now all of the test cases compile.  Some of them even run!

llvm-svn: 154094
2012-04-05 13:23:08 +00:00
David Chisnall c5d5a98815 Fix use of __atomic_is_lock_free() intrinsic.
llvm-svn: 154093
2012-04-05 13:13:24 +00:00
Howard Hinnant 7e5b4c9328 Put std::piecewise_construct_t back into the dylib for ABI stability. When clients are in C++11/constexpr mode this will be safely ignored because piecewise_construct is then declared with internal linkage.
llvm-svn: 153981
2012-04-03 23:45:46 +00:00
Howard Hinnant b2e9f19caf constexpr support for <utility>. Patch contributed by Jonathan Sauer.
llvm-svn: 153968
2012-04-03 21:09:48 +00:00
Howard Hinnant 6e3e78acba Updated documentation contributed by Christopher Jefferson.
llvm-svn: 153955
2012-04-03 15:08:42 +00:00
Howard Hinnant e386b7b360 Update <random> with constexpr support. Patch contributed by Jonathan Sauer.
llvm-svn: 153896
2012-04-02 21:00:45 +00:00
Howard Hinnant 338eb3116c Update <limits> with constexpr support. Patch contributed by Jonathan Sauer.
llvm-svn: 153888
2012-04-02 19:23:15 +00:00
Howard Hinnant e8df82fa1a Fix test for default constructor of discrete_distribution. This partially addresses http://llvm.org/bugs/show_bug.cgi?id=12436.
llvm-svn: 153873
2012-04-02 15:00:14 +00:00
Howard Hinnant 788c9979d9 This is an initial commit of constexpr support as proposed by Richard Smith. This by no means completes constexpr support. Indeed, it hardly scratches the surface. All it does is lay the foundation in <__config> and changes those few places in the library that are already using that foundation.
llvm-svn: 153856
2012-04-02 00:40:41 +00:00
Howard Hinnant 0527c6207a I believe tuple is still under development in the standard. Daniel Krugler is/will be making convincing arguments that a modified form of LWG 2051 (currently NAD Future) is easily acheivable and desirable. He has demonstrated that a tuple<T...> where all of the T are implicitly convertible from U... should have a tuple constructor that is also implicit, instead of explicit. This would support the use cases in LWG 2051 while not undermining T... with explicit conversions from U.... This check-in is an experimental implementation of Daniel's work. I believe this work to be mature enough to warrant inclusion into libc++. If anyone sees real-world problems that this check in causes, please let me know and I will revert it, and provide the feedback to the LWG.
llvm-svn: 153855
2012-04-01 23:10:42 +00:00
Howard Hinnant cb16c68042 It appears that the standard accidentally removed the default constructor for error_category. I'm putting it back in. This fixes http://llvm.org/bugs/show_bug.cgi?id=12321.
llvm-svn: 153194
2012-03-21 16:18:57 +00:00
Howard Hinnant b2f52bb982 Allow libc++ to be built with CMake from within the LLVM tree. The libc++ part is just some renaming as the variable was already in use, conflicting with something else in the LLVM tree. Contributed by Ruben Van Boxem.
llvm-svn: 153036
2012-03-19 15:40:23 +00:00
Howard Hinnant b4c7522790 Alter the terminal streams such that they do not get added to the atexit chain, and thus never get destructed.
llvm-svn: 152926
2012-03-16 15:13:51 +00:00
David Chisnall 1e02029f37 Undo some overzealous #ifdefs for LIBCXXRT.
llvm-svn: 152718
2012-03-14 14:11:13 +00:00
David Chisnall 5f13d66fb4 Make sure [at_]quick_exit is in std::
llvm-svn: 152717
2012-03-14 14:10:37 +00:00
David Chisnall 2f4cb4d79d Don't refer to a function that doesn't exist in the quick_exit test.
llvm-svn: 152716
2012-03-14 14:02:15 +00:00
Jeffrey Yasskin 9c95b19f9e Fix moneypunct_byname algorithm to more accurately represent C locales in C++.
llvm-svn: 152501
2012-03-10 18:31:43 +00:00
Howard Hinnant 8d5df9b9d4 Change some smart_ptr == 0 to smart_ptr == nullptr. Fixes http://llvm.org/bugs/show_bug.cgi?id=12185.
llvm-svn: 152240
2012-03-07 20:37:43 +00:00
David Chisnall 04e5ce2bc1 Define _WCHAR_T in solaris/wchar.h. This fixes a bug where Solaris 10 headers
try to define C++ keywords as typedefs (fixed in Solaris 11).

llvm-svn: 151890
2012-03-02 10:56:04 +00:00
David Chisnall 55661e7305 Fix MSVC / Sun #ifdef ordering. Remove another #if-nothing-#endif.
Sorry for the churn.

llvm-svn: 151731
2012-02-29 16:41:21 +00:00
David Chisnall 40d7a8acff Remove a spurious #ifdef / #endif pair with nothing between them.
llvm-svn: 151729
2012-02-29 16:22:33 +00:00
Howard Hinnant 9e849ad302 Add a warning to ctype<char>::classic_table() if not implemented.
llvm-svn: 151728
2012-02-29 16:08:57 +00:00
Howard Hinnant 27e618efb6 I'm reverting one of the changes made to exception.cpp in r151717. I'm unsure what the change was trying to do, but it didn't do the right thing for __APPLE__. So instead of trying to guess what was intended, I'm just putting it back the way it was.
llvm-svn: 151727
2012-02-29 15:37:30 +00:00
David Chisnall 06af2bbb04 Add support files required for building on Solaris.
llvm-svn: 151721
2012-02-29 13:17:28 +00:00
David Chisnall 14c25b80e9 Solaris port. Currently sees around 200 test failures, mostly related to
Solaris not providing some of the locales that the test suite uses.

Note: This depends on an xlocale (partial) implementation for Solaris and a
couple of fixed standard headers.  These will be committed to a branch later
today.

llvm-svn: 151720
2012-02-29 13:05:08 +00:00
David Chisnall 66d4573786 Make the failure reporting in testit a bit more useful.
llvm-svn: 151719
2012-02-29 13:00:44 +00:00
David Chisnall ca78592c16 Don't define __locale_raii if we are not going to be using it.
llvm-svn: 151718
2012-02-29 13:00:07 +00:00
David Chisnall e1da544e0b Some libcxxrt-compatibility cleanups (avoid defining things twice).
llvm-svn: 151717
2012-02-29 12:59:17 +00:00
Howard Hinnant 9bb1429f20 Reduce the number of move constructions when constructing a std::function. This fixes http://llvm.org/bugs/show_bug.cgi?id=12105.
llvm-svn: 151652
2012-02-28 19:47:38 +00:00
Howard Hinnant 9ffe10106e vector::emplace_back was mistakenly requiring move assignable. Fixed that and did a little drive-by optimization at the same time. This fixes http://llvm.org/bugs/show_bug.cgi?id=12085.
llvm-svn: 151492
2012-02-26 15:30:12 +00:00