Howard Hinnant
8a9ee14803
Apply noexcept to tuple.
...
llvm-svn: 159865
2012-07-06 21:53:48 +00:00
Howard Hinnant
a0f4c45c38
As a conforming extension give tuple a noexcept default constructor conditionalized on its held types.
...
llvm-svn: 159858
2012-07-06 20:50:27 +00:00
Howard Hinnant
a62ebe043e
Give tuple a constexpr default constructor.
...
llvm-svn: 159857
2012-07-06 20:39:45 +00:00
Howard Hinnant
9f06558f86
New Windows libc++ test results provided by Ruben Van Boxem.
...
llvm-svn: 159852
2012-07-06 19:35:31 +00:00
Howard Hinnant
9d6d1c6860
Apply noexcept to those functions implemented in <cstdlib> as a conforming extension.
...
llvm-svn: 159850
2012-07-06 19:16:56 +00:00
Howard Hinnant
9c14b75a37
Apply noexcept to those functions implemented in <cmath> as a conforming extension.
...
llvm-svn: 159849
2012-07-06 19:13:50 +00:00
Howard Hinnant
227001d12e
Add noexcept test for offsetof macro per [support.types]/p4.
...
llvm-svn: 159846
2012-07-06 18:39:01 +00:00
Howard Hinnant
4cb38a82a2
This commit establishes a new bucket_count policy in the unordered containers: The policy now allows a power-of-2 number of buckets to be requested (and that request honored) by the client. And if the number of buckets is set to a power of 2, then the constraint of the hash to the number of buckets uses & instead of %. If the client does not specify a number of buckets, then the policy remains unchanged: a prime number of buckets is selected. The growth policy is that the number of buckets is roughly doubled when needed. While growing, either the prime, or the power-of-2 strategy will be preserved. There is a small run time cost for putting in this switch. For very cheap hash functions, e.g. identity for int, the cost can be as high as 18%. However with more typical use cases, e.g. strings, the cost is in the noise level. I've measured cases with very cheap hash functions (int) that using a power-of-2 number of buckets can make look up about twice as fast. However I've also noted that a power-of-2 number of buckets is more susceptible to accidental catastrophic collisions. Though I've also noted that accidental catastrophic collisions are also possible when using a prime number of buckets (but seems far less likely). In short, this patch adds an extra tuning knob for those clients trying to get the last bit of performance squeezed out of their hash containers. Casual users of the hash containers will not notice the introduction of this tuning knob. Those clients who swear by power-of-2 hash containers can now opt-in to that strategy. Clients who prefer a prime number of buckets can continue as they have.
...
llvm-svn: 159836
2012-07-06 17:31:14 +00:00
Howard Hinnant
6b45660f14
link to Marshall's notes.
...
llvm-svn: 159791
2012-07-06 00:39:38 +00:00
Nuno Lopes
6317bfb26a
mark operator new(std::nothrow) as noalias (aka __attribute__((malloc))
...
llvm-svn: 159359
2012-06-28 16:47:34 +00:00
Howard Hinnant
f08ebab2ea
Fixed a bug regarding result_of reported by Sven Behne. The fix is C++11 only mainly because result_of is a variadic beast and working with variadics is just such a problem in C++03 mode. This should bring result_of up to full conformance with the C++11 spec.
...
llvm-svn: 159211
2012-06-26 17:37:15 +00:00
Nuno Lopes
d8ed7e5b03
fix help with bash
...
llvm-svn: 159177
2012-06-25 23:51:05 +00:00
Howard Hinnant
c418654096
Revert pair constructors back to using is_convertible instead of is_constructible. This should pull things into alignment with the final draft. Fixes http://llvm.org/bugs/show_bug.cgi?id=13063#add_comment .
...
llvm-svn: 158280
2012-06-09 20:01:23 +00:00
Douglas Gregor
07db340438
Fix warning flags for CMake builds, from Andrew C. Morrow!
...
llvm-svn: 158172
2012-06-07 22:26:00 +00:00
Howard Hinnant
0bc272cf9a
Fix a few testsuite bugs involving trailing null (or lack thereof) in strstream.
...
llvm-svn: 157832
2012-06-01 20:02:59 +00:00
Howard Hinnant
4c0de496a0
Fix dangling else clause. Bug found and fixed by Dimitry Andric.
...
llvm-svn: 157779
2012-05-31 23:12:03 +00:00
Howard Hinnant
78b4015c1c
Fix the new _ALIGNAS_TYPE per instructions supplied by Eli Friedman.
...
llvm-svn: 157765
2012-05-31 20:14:00 +00:00
Howard Hinnant
bf33f5b292
Protect use of alignas against older versions of clang
...
llvm-svn: 157764
2012-05-31 19:31:14 +00:00
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