Marshall Clow
f9af6140ff
Some calls to get<>() were qualified. Some were not. Qualify them all. Fixes bug #20092 . Thanks to Agustín Bergé for the bug report and the fix.
...
llvm-svn: 211563
2014-06-24 00:46:19 +00:00
Marshall Clow
2f4bfdecb3
Formatting improvements in the <string_view> synopsis suggested by RSmith. No functionality change.
...
llvm-svn: 211191
2014-06-18 17:44:04 +00:00
Marshall Clow
5aa8fa250d
Implement string_view from the library fundamentals TS (n4023). Also works in C++11 and 03, with reduced functionality (mostly in the area of constexpr)
...
llvm-svn: 210659
2014-06-11 16:44:55 +00:00
Marshall Clow
9b0af34d96
Make the helper routines in string really be constexpr. This required a bit of refacoring in algorithm as well. Give them better names while we're at it. All of these are internal rotines; no visible functionality change.
...
llvm-svn: 210561
2014-06-10 18:51:55 +00:00
Marshall Clow
c369914758
Since we now have a value for __cplusplus for c++14, teach libc++ about it
...
llvm-svn: 210380
2014-06-06 22:31:09 +00:00
Richard Smith
ff0aff3caf
Use __builtin_operator_new/__builtin_operator_delete when available. This
...
allows allocations and deallocations to be optimized out.
llvm-svn: 210211
2014-06-04 19:54:15 +00:00
Nico Weber
1d1b46cdf7
Make locales (and transitively, std::endl) work reliably with gcc.
...
libc++ currently relies on undefined initialization order of global
initializers when using gcc:
1. __start_std_streams in iostream.cpp calls locale:🆔 :_init, which assigns
an id to each locale::facet in an initializer
2. Every facet has a static locale::id id, whose constructor sets the facet's
id to 0
If 2 runs after 1, it clobbers the facet's assigned consecutive id, causing
exceptions to be thrown when e.g. running code like "cout << endl".
To fix this, let _LIBCPP_CONSTEXPR evaluate to "constexpr" instead of nothing
with gcc. locale::id's constructor is marked _LIBCPP_CONSTEXPR, which ensures
that it won't get an initializer that could potentially run after the
iostream.cpp initializer. (This remains broken when building with msvc.)
Also switch constexpr-specific code in bitset to use __SIZEOF_SIZE_T__ instead
of __SIZE_WIDTH__, because gcc doesn't define the latter.
Pair-programmed/debugged with Dana Jansens.
llvm-svn: 210188
2014-06-04 15:46:56 +00:00
Marshall Clow
5f0701f270
Preparation for <string_view>. More helper functions that can be shared between <string> and <string_view>. No functionality change
...
llvm-svn: 210002
2014-06-02 02:22:49 +00:00
Nico Weber
9e3548875a
Add a _LIBCPP_CONSTEXPR that was missed in r170026.
...
(clang doesn't complain about this, but gcc does. This is necessary for a
follow-up patch that will enable _LIBCPP_CONSTEXPR for gcc.)
llvm-svn: 209888
2014-05-30 12:09:47 +00:00
Marshall Clow
2de60eb213
Fix a problem exposed by r208825, which caused bind (and other bits of libc++) to stop working. And tests
...
llvm-svn: 209785
2014-05-29 01:10:28 +00:00
Marshall Clow
9393b5113b
Fix Bug 19678 - libc++ does not correctly handle the regex: '[^\0]*'
...
llvm-svn: 209307
2014-05-21 16:29:50 +00:00
Marshall Clow
ef0e8c391e
Fix bug 19740; round-tripping a pointer through a stream doesn't work
...
llvm-svn: 209305
2014-05-21 16:02:20 +00:00
Richard Smith
80fd10e6e1
[modules] Add initial module map for libc++.
...
llvm-svn: 209265
2014-05-21 00:33:49 +00:00
Nico Weber
218f71e148
Update cstddef after clang r207606.
...
r207606 changed the __need_foo macros to behave like they do with gcc: If they
are set, _only_ the __need_foo stuff gets defined. As a consequence, cstddef
no longer defined "offsetof". It looks like the __need_foo defines aren't
needed anymore, so just remove them.
Fixes PR19723.
llvm-svn: 208942
2014-05-16 01:45:02 +00:00
Alp Toker
f03763a44b
Fix typos
...
llvm-svn: 208869
2014-05-15 11:27:39 +00:00
Marshall Clow
5c520bd985
Add Address Sanitizer support to std::vector
...
llvm-svn: 208319
2014-05-08 14:14:06 +00:00
Marshall Clow
0fc6e981b0
Fix PR 19663. Some calls to find(vector<bool>) were returning iterators that were subtly invalid (didn't compare equal). Thanks to Erik Verbruggen for the report (and diagnosis)
...
llvm-svn: 208096
2014-05-06 15:33:23 +00:00
Joerg Sonnenberger
a1fbf3459f
Exceptions store the message as reference counted string for
...
compatibility to libstdc++. Move the implementation into a header for
easier sharing with libc++abi. Merge a number of improvements from that
version. Provide a POD definition for <stdexcept>'s public use to avoid
cast dances. Discussed with Marshall Clow.
llvm-svn: 207695
2014-04-30 19:54:11 +00:00
Marshall Clow
85d3e7a729
Fix bug #18350 . Add tests for tuples of all the smart pointers (except auto_ptr)
...
llvm-svn: 207307
2014-04-26 05:19:48 +00:00
Marshall Clow
7546a111a9
Default the copy and move constructors for __tuple_leaf. This fixes bugs 18853 and 19118. Add a test case for that.
...
llvm-svn: 206829
2014-04-21 23:48:09 +00:00
Marshall Clow
3d3974b45b
Use compiler intrinsic __is_constructible if available
...
llvm-svn: 206805
2014-04-21 22:30:32 +00:00
Marshall Clow
5f7c2db2ce
Bug #19473 . If you pass an allocator to std::function, we should use that allocator, not construct one from scratch. Add a test to make sure
...
llvm-svn: 206623
2014-04-18 17:23:36 +00:00
Marshall Clow
c303bba184
Remove some unnecessary noexcept conditions. Thanks to Richard Smith for the catch.
...
llvm-svn: 206424
2014-04-16 23:12:55 +00:00
Marshall Clow
91c71ddd8d
Define a new macro in libc++ named '_LIBCPP_HAS_NO_ASAN'. When this is defined,
...
libc++ will not call address_sanitizer to detect addressing errors in the
standard library containers. This is a negative macro to enable users to
disable the libc++ checks even if they are compiling with address sanitizer
enabled by defining this macro.
At the present time, there is no code in libc++ that looks at this macro.
That will come soon. This is just infrastructure.
llvm-svn: 206184
2014-04-14 15:44:57 +00:00
Marshall Clow
ec959d5f46
Remove node from a container before destroying it. Thanks to Alexander Potapenko for pointing this out.
...
llvm-svn: 206024
2014-04-11 08:22:42 +00:00
Marshall Clow
886c6a645f
Fix PR19819
...
llvm-svn: 205709
2014-04-07 13:32:26 +00:00
Tim Northover
caccac10b7
RTTI Uniqueness: remove __name_for_load function.
...
It's identical to name() these days. (At one point it avoided masking
of the RTTI uniqueness bit because ARM64 ignored it architecturally,
but no longer).
llvm-svn: 205518
2014-04-03 09:12:38 +00:00
Tim Northover
4b9a505a5e
Use defined(__APPLE__) rather than __APPLE__
...
llvm-svn: 205150
2014-03-30 14:59:12 +00:00
Tim Northover
0090e657cb
ARM64: compare RTTI names as strings
...
ARM64 generates RTTI with hidden visibility, which means that typeinfo
must be compared char-by-char since it's not guaranteed to be uniqued
across the whole program.
llvm-svn: 205139
2014-03-30 11:34:26 +00:00
Tim Northover
c3a57e91ef
ARM64: use the alternate string layout on Apple platforms.
...
llvm-svn: 205138
2014-03-30 11:34:22 +00:00
Stephan Tolksdorf
e180ecab2c
[libc++] Teach is_integral, is_[un]signed and make_[un]signed about __[u]int128_t
...
This commit also adds tests for std::numeric_limits<__[u]int128_t>.
Reviewed in http://llvm-reviews.chandlerc.com/D2917
llvm-svn: 204849
2014-03-26 19:45:52 +00:00
Marshall Clow
1641a7c1cb
Implement LWG issue #2135 . If something goes wrong in condition_variable::wait, call terminate() rather than throwing an error. Do this indirectly, by marking the call as 'noexcept'. This is better than just calling terminate() directly, because it gives a better error message on the console.
...
llvm-svn: 204778
2014-03-26 02:45:04 +00:00
David Majnemer
7ec93f9b1c
Implement N3891: A proposal to rename shared_mutex to shared_timed_mutex
...
This is as straightforward as it sounds, a renamed from shared_mutex to
shared_timed_mutex.
Note that libcxx .dylib and .so files built with c++14 support need to
be rebuilt.
llvm-svn: 204078
2014-03-17 20:19:44 +00:00
Marshall Clow
b2d74f29f6
THIRD TIME. Richard pointed out (again) that I'd switched the order of the instance variables; and thus failed to repair the ABI break. After this, I'm going to sit down and watch TV for the evening.
...
llvm-svn: 203631
2014-03-12 01:19:36 +00:00
Marshall Clow
3b83496dd4
Fix ABI break I made in r203587; thanks to Richard Smith for the catch.
...
llvm-svn: 203610
2014-03-11 22:05:31 +00:00
Marshall Clow
201fe8cfe7
Fix misguided #elif - it checked the value of _AIX instead of defined(_AIX). Thanks to Johan Bergström for the bug report.
...
llvm-svn: 203589
2014-03-11 17:18:47 +00:00
Marshall Clow
ef3d680093
Implement LWG 2360: 'reverse_iterator::operator*() is unimplementable'. Note that this is a (small) behavior change in the library. Reverse iterators whose base iterators' operator* return references to 'within themselves' have been sacrificed to the greater goal of avoiding data races.
...
llvm-svn: 203587
2014-03-11 17:16:17 +00:00
Marshall Clow
415a24e41f
Fix bug I introduced (enabling implicit conversions from compare function to map) in r202994. Thanks to Sebastian Redl for the catch.
...
llvm-svn: 203443
2014-03-10 04:50:10 +00:00
Marshall Clow
b162b17f05
Implement LWG #2344 : quoted()'s interaction with padding is unclear. I think that anyone using quoted with padding is really confused, but it should work the way the rest of iostreams works.
...
llvm-svn: 203290
2014-03-07 21:45:32 +00:00
Peter Collingbourne
8845dbd798
Do not derive __gnu_cxx::hash<T> from std::hash<T>.
...
Instead, define explicit specializations for the basic types listed in
the SGI documentation. This solves two problems:
1) Helps avoid silent ODR violations caused by the absence of a
user-supplied __gnu_cxx::hash specialization in cases where a std::hash
specialization exists (e.g. for std::string).
2) __gnu_cxx::hash semantics are slightly different to those of
std::hash (for example, the former may dereference a pointer argument)
so it is inappropriate for __gnu_cxx::hash to receive std::hash
specializations by default.
Differential Revision: http://llvm-reviews.chandlerc.com/D2747
llvm-svn: 203070
2014-03-06 04:11:10 +00:00
Marshall Clow
78a87e8a68
Implement LWG 2193. Default constructors for standard library containers are explicit. Note that libc++ already did this for string/deque/forward_list/list/vector and the unordered containers; implement it for set/multiset/map/multimap. Add tests for all the containers. Two drive-by fixes as well: add a missing explicit in <deque>, and remove a tab that snuck into a container test. This issue is also LLVM bug 15724, and resolves it.
...
llvm-svn: 202994
2014-03-05 19:06:20 +00:00
Marshall Clow
28eded3845
Mark is_final as a C++14 feature.
...
llvm-svn: 202991
2014-03-05 17:58:48 +00:00
Marshall Clow
f2c10e1340
Remove definition of std::fmaf from libc++. Fixes bug #18910 . This function should come from the C standard library. As a drive-by fix, update the tests to remove a warning from -Wabsolute-value
...
llvm-svn: 202990
2014-03-05 17:09:51 +00:00
Marshall Clow
39bca1ea99
Implement LWG #2212 : std::is_final. This requires compiler support, which modern versions of clang provide. Also mark LWG #2230 as complete - no code changes needed.
...
llvm-svn: 202934
2014-03-05 03:39:25 +00:00
Marshall Clow
4703f76376
Update synposis in <memory> to show move semantics for weak_ptr; add tests 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
2014-03-05 03:12:04 +00:00
Marshall Clow
53b88dad6f
Implement LWG #2268 : Setting a default argument in the declaration of a member function assign of std::basic_string.
...
llvm-svn: 202876
2014-03-04 19:17:19 +00:00
Peter Collingbourne
99aadbdb7d
[libc++] Const qualify __gnu_cxx::hash_map<>::const_iterator::pointer type.
...
Differential Revision: http://llvm-reviews.chandlerc.com/D2811
llvm-svn: 202749
2014-03-03 19:50:01 +00:00
Marshall Clow
f519be343b
Implement LWG 2324: Insert iterator constructors should use addressof(). Add two new container classes to the test suite that overload operator &, and add test cases to the insert/front_insert/back_insert iterator tests that use these containers.
...
llvm-svn: 202741
2014-03-03 19:20:40 +00:00
Marshall Clow
05c8dad230
Implement LWG Paper n3887: Consistent Metafunction Aliases. This adds std::tuple_element_t<> as an alias for tuple_element<>::type. Clean up the synopsis for tuple_element in <utility> as well.
...
llvm-svn: 202673
2014-03-03 06:18:11 +00:00
Marshall Clow
06965c1fd0
Per N3924, mark random_shuffle as deprecated in the synopsis for <algorithm>. Since we don't actually do anything when a call is deprecated, there is no functionality change. Maybe someday, we'll decide to warn when using a deprecated function.
...
llvm-svn: 202672
2014-03-03 06:14:19 +00:00
Marshall Clow
6a640a18a4
Implement LWG Issue #2285 - make_reverse_iterator. Also mark issues #1450 and #2205 as complete; they are just wording changes in the standard. Mark issues #2359 , #2320 and #2322 as complete - libc++ implements them already.
...
llvm-svn: 202671
2014-03-03 01:24:04 +00:00
Marshall Clow
c204c130fa
LWG issue #2188 : Reverse iterator does not fully support targets that overload operator&. Also mark #2272 and #2299 as complete; libc++ already implements them.
...
llvm-svn: 202339
2014-02-27 02:11:50 +00:00
Marshall Clow
16da324051
Implement LWG issue 2306: match_results::reference should be value_type&, not const value_type&. This is a general move by the LWG to have the reference type of read-only containers be a non-const reference; however, there are no methods that return a non-const reference to a match_result entry, so there's no worries about getting a non-const reference to a constant object.
...
llvm-svn: 202214
2014-02-26 01:56:31 +00:00
Marshall Clow
0d1560e10e
Implement LWG issue 2301: Mark std::tie as constexpr
...
llvm-svn: 202158
2014-02-25 16:11:46 +00:00
Marshall Clow
31be78b27d
Fix historical #ifdef. Use __cplusplus instead of __GXX_EXPERIMENTAL_CXX0X__ when compiling with clang. No functionality change. Noteto self: It is important to run the regression tests on the copy of the code that you've changed.
...
llvm-svn: 201938
2014-02-22 15:13:48 +00:00
Juergen Ributzka
88ec12cd76
Revert "Fix historical #ifdef. Use __cplusplus instead of __GXX_EXPERIMENTAL_CXX0X__ when compiling with clang. No functionality change."
...
This reverts commit r201864, because it breaks our build bots.
llvm-svn: 201892
2014-02-21 21:06:36 +00:00
Marshall Clow
0e23e04f9a
Fix historical #ifdef. Use __cplusplus instead of __GXX_EXPERIMENTAL_CXX0X__ when compiling with clang. No functionality change.
...
llvm-svn: 201864
2014-02-21 18:07:52 +00:00
Yaron Keren
7b89f9958f
Solve the errors
...
Error 1 error C2681: 'add_rvalue_reference<_Tp*>::type' : invalid expression
type for dynamic_cast c:\libcxx\include\type_traits
This is one more step getting libcxx compile under Visual C++. The patch is
#if defined(_LIBCPP_MSVC) so will affect only this build.
When libcxx can be compiled, it will probably require the current version or
maybe even the next Update of Visual C++ 2013.
Patch by G M!
llvm-svn: 201844
2014-02-21 10:00:31 +00:00
Chandler Carruth
265b83a87f
Teach libc++ to use the compiler-provided C-compatible ::max_align_t
...
rather than its own type for std::max_align_t. This is particularly
relevant as the types may not be ABI compatible despite users expecting
them to be.
llvm-svn: 201843
2014-02-21 08:37:30 +00:00
Marshall Clow
7d35711187
Implement LWG Issues #2329 and #2332 - disallow iterators into temporary regexes and regexes into temporary strings
...
llvm-svn: 201717
2014-02-19 21:21:11 +00:00
Marshall Clow
6c3f5ffbb8
Implement LWG Issue: 2280. begin/end for arrays should be constexpr and noexcept, plus a drive-by fix for cbegin/cend suggested by Peter Sommerlad.
...
llvm-svn: 201703
2014-02-19 17:53:30 +00:00
Marshall Clow
9d67c6d5fd
Implement LWG2350: min, max, and minmax should be constexpr.
...
llvm-svn: 201697
2014-02-19 16:51:35 +00:00
Marshall Clow
551365da33
Implement LWG Issue 2346: integral_constant's member functions should be marked noexcept
...
llvm-svn: 201534
2014-02-17 22:18:51 +00:00
Marshall Clow
53d8b20078
Remove tabs that crept in during an earlier refactoring. No functionality change
...
llvm-svn: 201472
2014-02-16 01:57:26 +00:00
Yaron Keren
3ef24c4f9a
This solves warning C4005: '_NOEXCEPT' : macro redefinition when compiling
...
with Visual C++ 2013 by making libcxx definition text-identical to yvals.h.
Persumably this definition is for older Visual C++ versions.
In such cases it will still be defined so no functionality change.
Other platforms should not be affected as this is inside
#elif defined(_LIBCPP_MSVC)
Patch by G M!
llvm-svn: 201328
2014-02-13 14:02:28 +00:00
Marshall Clow
5bd869490b
Fix for PR17606 - result_of (and INVOKE) works incorrectly for member function pointers with ref qualifiers. Also a drive-by fix for common_type in C++03 mode. Thanks to Michel Morin for the bug report and the proposed fix.
...
llvm-svn: 201101
2014-02-10 17:40:28 +00:00
Marshall Clow
74cf6ff5e5
Fix for PR18735 - self-assignment for map/multimap gives incorrect results in C++03
...
llvm-svn: 201021
2014-02-08 04:03:14 +00:00
Joerg Sonnenberger
a0a143690d
Avoid signed vs unsigned compare warnings. From Dimitry Andric.
...
llvm-svn: 200993
2014-02-07 21:14:29 +00:00
Peter Collingbourne
09df4a6675
Support forward_list<Incomplete Type>. Patch by Zhihao Yuan!
...
llvm-svn: 200814
2014-02-05 01:44:17 +00:00
Logan Chien
22747e621e
Remove default function template argument from the header.
...
GCC will treat the default function template arguments as a
compilation error if C++0x is not enabled.
This commit workaround the compilation error by moving the
SFINAE check to function argument instead of the template
argument.
llvm-svn: 200523
2014-01-31 09:30:46 +00:00
Marshall Clow
f246033698
Rename some internal templates to avoid conflict with complier intrinsics. __is_constructible --> __libcpp_is_constructible, __is_nothrow_constructible --> __libcpp_is_nothrow_constructible, and __is_nothrow_assignable --> __libcpp_is_nothrow_assignable. No functionality change.
...
llvm-svn: 200010
2014-01-24 15:27:41 +00:00
Peter Collingbourne
a5adf489b7
Const qualify __mem_fn call operator
...
QOI improvement.
Differential Revision: http://llvm-reviews.chandlerc.com/D2059
llvm-svn: 199848
2014-01-22 22:56:52 +00:00
Marshall Clow
9aafa898f9
Update __parse_DUP_COUNT and __parse_BACKREF to use the traits class to recognize digits. Fixes PR18514
...
llvm-svn: 199541
2014-01-18 03:40:03 +00:00
Marshall Clow
354d39cabc
Add license headers to a bunch of libc++ files that were missing them. No functionality change. Fixes 18291. Thanks to Nico for the bug report and the patch.
...
llvm-svn: 199400
2014-01-16 16:58:45 +00:00
Marshall Clow
ec931c0721
Rename libc++ internal templates __is_void, __is_integral, __is_floating_point, __is_pointer, __is_function_imp, __is_function, __is_member_function_pointer, __is_member_pointer, __is_signed_impl, __is_signed, __is_unsigned_impl, __is_unsigned to __libcpp_is_XXX, because some compilers have decided that __is_XXX are keywords. No functionality change.
...
llvm-svn: 199184
2014-01-14 05:13:45 +00:00
Marshall Clow
54f6bd59f5
Fix a bug in regex_token_iterator's copy constructor. Caught by Bob Wilson.
...
llvm-svn: 199122
2014-01-13 17:47:08 +00:00
Marshall Clow
79b0fee3c6
Fix PR18404 - 'Bug in regex_token_iterator::operator++(int) implementation'. Enhance the tests for regex_token_iterator and regex_iterator.
...
llvm-svn: 198878
2014-01-09 18:25:57 +00:00
Marshall Clow
a429ba738c
Back out the <type_traits> changes from r198431; they were breaking when building with glibc. Need to find a better solution for PR18218.
...
llvm-svn: 198623
2014-01-06 18:12:50 +00:00
Marshall Clow
a889636aa0
Removed extra trailing underscore in #ifdef (__GNUC___ --> __GNUC__ )
...
llvm-svn: 198618
2014-01-06 15:23:02 +00:00
Marshall Clow
a3e6e2b286
Rename several internal templates to get rid of ___ (triple underscores) or worse, four. No functionality change.
...
llvm-svn: 198608
2014-01-06 14:00:09 +00:00
Yaron Keren
acb42aefd7
80 cols fixes.
...
llvm-svn: 198482
2014-01-04 09:27:39 +00:00
Yaron Keren
f8f56755e0
Implement the functions: clz, clzl, clzll, ctz, ctzl, and ctzll
...
for libcxx when compiled with Visual C++ on Win32 and Win64.
clang and gcc (MinGW) compilers provide these implementations themselves.
llvm-svn: 198481
2014-01-04 08:56:00 +00:00
Marshall Clow
0724bf6767
Rename ___make_pair_return to __make_pair_return_impl; ___make_tuple_return to __make_tuple_return_impl; and ____iterator_traits to __iterator_traits_impl. Part of a campaign to remove > 2 underscores from libc++. No functionality change.
...
llvm-svn: 198457
2014-01-03 22:55:49 +00:00
Marshall Clow
d41295da72
Patch by Howard. First part of fix for PR18218; add type traits needed to do the right thing. Fix the problems in PR18218 for isnan and pow - they also need to be applied to the other functions in <cmath>. Also, a drive-by fix for the test - now actually calls test_abs()
...
llvm-svn: 198431
2014-01-03 18:21:14 +00:00
Marshall Clow
ce81aed463
Make cv_status a class enum. Fixes PR18314. Thanks to Andersca for the report and the patch.
...
llvm-svn: 197921
2013-12-23 22:14:27 +00:00
Yaron Keren
21a697b8b1
Empty line between two unrelated #ifdefs.
...
llvm-svn: 197810
2013-12-20 13:19:45 +00:00
Logan Chien
ca83921ddc
GCC does not support strong enum in pre-C++0x mode.
...
GCC does not support strong enum if -std=c++0x is not used.
Without the strong enum, we will see following error:
In file included from libcxx/include/ostream:131:0,
from libcxx/include/sstream:174,
from libcxx/include/complex:247,
from cpp03-headers.cpp:11:
libcxx/include/ios:419:68: error: 'io_errc' is not a class or namespace
libcxx/include/ios:420:66: error: 'io_errc' is not a class or namespace
To workaround this issue, this commit will define
_LIBCPP_HAS_NO_STRONG_ENUMS when we are compiling with
g++ without c++0x.
llvm-svn: 197313
2013-12-14 06:44:09 +00:00
Marshall Clow
c66a611b27
Move std::begin(array) and std::end(array) out from under an #ifdef that was preventing people from building libc++ using gcc. This corrects a mistake that I introduced in r196058
...
llvm-svn: 197061
2013-12-11 19:32:32 +00:00
Marshall Clow
6bc32ebf35
Refactored a bunch of duplicated code in <ostream>. Made a new routine called __put_character_sequence, and made nine places call it.
...
llvm-svn: 196951
2013-12-10 19:25:49 +00:00
Marshall Clow
8283ba3704
Refactor some of the operations in <string> so that they can be reused; no functionality change
...
llvm-svn: 196788
2013-12-09 16:00:28 +00:00
Howard Hinnant
395485efc0
Give all members of exception types default visibility. Lack of this is causing some illegal code relocations rare and hard to reproduce cases.
...
llvm-svn: 196411
2013-12-04 21:03:23 +00:00
Marshall Clow
3772a46ab4
Fix for PRPR17934; based on a fix suggested by Peter Sommerlad
...
llvm-svn: 196058
2013-12-02 03:24:33 +00:00
Howard Hinnant
6ef2bb02f5
Remove _LIBCPP_TRIVIAL_PAIR_COPY_CTOR=0 for __APPLE__, no longer needed.
...
llvm-svn: 195796
2013-11-27 00:53:02 +00:00
Joerg Sonnenberger
c55d97b1f9
Don't use T as template argument, it is part of the application
...
namespace.
llvm-svn: 195693
2013-11-25 22:44:20 +00:00
Yaron Keren
e050d66e12
Compiling libcxx with gcc 4.6.4 (MingW) produces these errors:
...
type_traits:3280:31: error: expected primary-expression before 'decltype'
type_traits:3280:29: error: expected ';' at end of member declaration
memory:2415:49: error: function 'std::__1::default_delete<_Tp>::default_delete()'
defaulted on its first declaration must not have an exception-specification
memory:2435:49: error: function 'std::__1::default_delete<_Tp []>::default_delete()'
defaulted on its first declaration must not have an exception-specification
The attached patch defines _LIBCPP_HAS_NO_ADVANCED_SFINAE and
_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS for gcc version < 4.7, making
the library compile with gcc 4.6.4.
llvm-svn: 195431
2013-11-22 09:22:12 +00:00
Marshall Clow
028875aa7c
Patch by Xing Xue to improve libc++ support for AIX
...
llvm-svn: 195144
2013-11-19 19:16:03 +00:00
Marshall Clow
7e1ea8d288
Patch by Bruce Mitchener. Change all references to EMSCRIPTEN to __EMSCRIPTEN__. If you're not using the PP symbol EMSCRIPTEN, then you should see no functionality change.
...
llvm-svn: 195136
2013-11-19 18:05:03 +00:00
Yaron Keren
fbeb63c0d1
This patch implements snprintf_l function in a way similar to the other
...
functions in src/support/win32/locale_win32.cpp and locale_win32.h,
calling upon vsnprintf for which there is a MingW correct alternative.
Note! __USE_MINGW_ANSI_STDIO is not modified in this patch. In order to
use the __mingw version it must be defined before including the MingW
headers.
llvm-svn: 195044
2013-11-18 21:12:14 +00:00
Yaron Keren
c0299d7f53
Fix-it suggestion for fixing min or max defines on Windows.
...
llvm-svn: 194891
2013-11-15 23:41:01 +00:00
Yaron Keren
6e72b8ba8c
Windows.h is not required.
...
llvm-svn: 194870
2013-11-15 22:54:15 +00:00
Marshall Clow
dfdac03c8f
Move <optional> into include/experimental, and into the std::experimental namespace, since it's not part of C++14, but of an upcoming TS
...
llvm-svn: 194867
2013-11-15 22:42:10 +00:00
Justin Bogner
fd6cfe92d3
Add the CMakeLists.txt that was missed in r194825
...
llvm-svn: 194838
2013-11-15 18:34:43 +00:00
Howard Hinnant
f9fd0d6d11
This is a followup to r194536, which changed the pair copy constructor to be
...
trivial in C++03, thus making it trivial in both C++03 and C++11.
This patch allows one to opt-in/out of this decision with a macro. You can
choose to have the pair copy constructor always be trivial, or always be
non-trivial. The flag controlling this is now _LIBCPP_TRIVIAL_PAIR_COPY_CTOR.
The client can define this flag to 1, and the pair copy constructor will be
trivial (when possible of course), or to 0, and the pair copy constructor will
be nontrivial.
Default settings for this flag are set in <__config> (as usual). With this
commit the default is _LIBCPP_TRIVIAL_PAIR_COPY_CTOR=1 for all platforms
except __APPLE__, which defaults to _LIBCPP_TRIVIAL_PAIR_COPY_CTOR=0.
llvm-svn: 194742
2013-11-14 22:52:25 +00:00
Marshall Clow
513ecaba91
Fixed bug in quoted strings implementation. Added test to be sure. Thanks to Peter Sommerlad for the report (and suggested fix)
...
llvm-svn: 194725
2013-11-14 20:01:38 +00:00
Marshall Clow
21fee96f69
Move <dynarray> into include/experimental, and into the std::experimental namespace, since it's not part of C++14, but of an upcoming TS
...
llvm-svn: 194614
2013-11-13 22:44:48 +00:00
Howard Hinnant
ccad8c32e0
This fixes a very subtle ABI problem concerning the copy constructor of
...
pair, and a couple of pair-like implementation detail types. The
C++98/03 and 11 standards all specify that the copy constructor of
pair<int, int> is trivial. However as libc++ tracked the draft C++11
standard over the years, this copy constructor became non-trivial, and
then just recently was corrected back to trivial for C++11.
Unfortunately (for libc++1) the Itanium ABI specifies different calling
conventions for trivial and non-trivial copy constructors. Therefore
currently the C++03 libc++ copy constructor for pair<int, int> is ABI
incompatible with the C++11 libc++ copy constructor for pair<int, int>.
This is Bad(tm). This patch corrects the situation by making this copy
constructor trivial in C++03 mode as well.
Just in case it is needed for an incomplete C++11 compiler, libc++
retains the ability to support pair with rvalue references, but without
defaulted special members. However the pair needs non-trivial special
members to implement this special case, (as it did when clang was in
this place a couple of years ago).
During this work a bug was also found and fixed in
is_trivially_constructible.
And there is a minor drive-by fix in <__config> regarding
__type_visibility__.
A test is updated to ensure that the copy constructor of pair<int, int>
is trivial in both C++03 and C++11. This test will necessarily fail for
a compiler that implements rvalue references but not defaulted special
members.
llvm-svn: 194536
2013-11-13 00:39:22 +00:00
Howard Hinnant
88960d151e
Tell libc++abi whether or not libc++ has declared bad_array_length.
...
llvm-svn: 194207
2013-11-07 17:15:51 +00:00
Marshall Clow
57b8f44c87
More duplicate code removal in <locale>. Hoist common parsing code into two templates: num_get::__do_get_signed and num_get::__do_get_unsigned, and make the do_get routines call them. No functionality change.
...
llvm-svn: 194185
2013-11-07 01:00:50 +00:00
Howard Hinnant
4478b25ade
Fix several tuple bugs that were exposed by clang's implementation of CWG 1402. This fixes http://llvm.org/bugs/show_bug.cgi?id=17798 .
...
llvm-svn: 194154
2013-11-06 17:45:43 +00:00
Marshall Clow
e427322327
Fix an off-by-one error in basic_string::__grow_by, where it would incorrectly throw length_error (instead of bad_alloc) when attempting to resize the string to 'max_size()'. Add tests for resizing to max_size +/-1
...
llvm-svn: 194151
2013-11-06 14:24:38 +00:00
Marshall Clow
9d66b72aa9
Refactor floating point code for num_get::do_get into a template. No functionality change
...
llvm-svn: 194080
2013-11-05 14:28:52 +00:00
Marshall Clow
99c096472d
Better inline marking for __does_policy_contain. Thanks to Chongyu Zhu for the catch
...
llvm-svn: 193963
2013-11-03 22:06:53 +00:00
Marshall Clow
222d1c7f13
Mark __does_policy_contain as 'inline'. Thanks to Chongyu Zhu for the catch
...
llvm-svn: 193962
2013-11-03 20:07:47 +00:00
Marshall Clow
b1915875d0
Fix LWG Issue 2078. Make std::async(policy,...) try multiple policies until one succeeds.
...
llvm-svn: 193960
2013-11-03 15:43:35 +00:00
Marshall Clow
e1bedf4e93
LWG issue 2341; Make the two variants of basic_ostream::seekp and basic_istream::seekg behave consistently; update tests to make sure
...
llvm-svn: 193814
2013-10-31 22:20:45 +00:00
Marshall Clow
f5fa53882f
Fixes PR17148
...
llvm-svn: 193772
2013-10-31 17:23:08 +00:00
Marshall Clow
07c28fe026
Mark seed_seq default constructor and size() as noexcept. This is implied, but not required by LWG issue 2180
...
llvm-svn: 193227
2013-10-23 05:56:47 +00:00
Marshall Clow
e604469e5c
Patch by GM: apparently '__value' (two underscores) is a special name in Visual Studio, so rename the private method in <regex> with that name. GM's patch used '___value' (three underscores), but I changed that to '__regex_traits_value' because I've been burned in the past by identifiers that appear identical but are not.
...
llvm-svn: 193087
2013-10-21 15:43:25 +00:00
Marshall Clow
5b40666c6c
Patch by GM: Making implicit conversion to bool explicit in <ios> and <__locale>
...
llvm-svn: 193085
2013-10-21 14:41:05 +00:00
Marshall Clow
d8cfc7dce9
Patch by GM: Adding MSVC support to __bit_reference
...
llvm-svn: 193084
2013-10-21 14:29:37 +00:00
Marshall Clow
9f21325ac7
Patch from GM to make more implicit bools explicit since we can't stop MSVC warning about this in headers and to warn is the MSVC default. No functionality change.
...
llvm-svn: 192548
2013-10-13 01:02:45 +00:00
Marshall Clow
c3776b1ce0
LWG Issue 2087: iostream_category() and noexcept
...
llvm-svn: 192545
2013-10-12 22:49:56 +00:00
Marshall Clow
d58daf9433
LWG Issue 2097: packaged_task constructors should be constrained
...
llvm-svn: 192544
2013-10-12 22:49:17 +00:00
Marshall Clow
f28fd284f8
LWG issue 2143: ios_base::xalloc should be thread-safe
...
llvm-svn: 192539
2013-10-12 19:13:52 +00:00
Marshall Clow
8de32cb3dc
Implement national body comment GB9: remove std::gets
...
llvm-svn: 192538
2013-10-12 19:09:47 +00:00
Marshall Clow
0354b92992
patch by Yaron: Uses rand_s() from stdlib.h (when building for Windows)
...
llvm-svn: 192325
2013-10-09 21:49:03 +00:00
Marshall Clow
db78c7049e
Fix LWG Issue 2141: common_type trait produces reference types
...
llvm-svn: 192142
2013-10-07 23:43:33 +00:00
Howard Hinnant
04c63bdb36
G M: Rename local variable from __except to avoid MSVC keyword clash.
...
llvm-svn: 192072
2013-10-06 21:00:29 +00:00
Howard Hinnant
32f9a776fb
Use _LIBCPP_NEW_DELETE_VIS instead of LIBCPP_FUNC_VIS in src/new.cpp.
...
llvm-svn: 192071
2013-10-06 20:53:24 +00:00
Howard Hinnant
f66a81ad56
Yaron Keren: Add missing comment.
...
llvm-svn: 192068
2013-10-06 19:48:40 +00:00
Marshall Clow
dbd2ebb07e
LWG Issue 2247: Implement type trait 'is_null_pointer'
...
llvm-svn: 192049
2013-10-05 21:21:17 +00:00
Marshall Clow
ea7c7cc521
Implement literal suffixes for compled
...
llvm-svn: 192048
2013-10-05 21:19:49 +00:00
Marshall Clow
3ceafc7f01
Mark namespaces for user defined literals as 'inline'
...
llvm-svn: 192047
2013-10-05 21:18:32 +00:00
Marshall Clow
de9320aa2b
Implement LWG issue 2275 'forward_as_tuple should be constexpr'
...
llvm-svn: 192038
2013-10-05 18:46:37 +00:00
Howard Hinnant
a942f2ffd7
G M: The attached patch is for libcxx's new.cpp and __config files. The patch's intent is to make new.cpp compile using MS's cl.exe compiler without changing the meaning of anything for any other compiler.
...
The issue this patch seeks to address is that MS's compiler (cl.exe) doesn't support the __attribute__((__weak__)) or __atribute__((__visibility__("default")) syntax; so a solution must be found where cl.exe doesn't see this syntax.
This patch seeks to solve this problem by changing code patterned like this:
__attribute__((__weak__, __visibility__("default")))
void* operator new(size_t size, const std::nothrow_t&) _NOEXCEPT { /*snip*/; return p; }
to code like this:
_LIBCPP_WEAK
void* operator new(size_t size, const std::nothrow_t&) _NOEXCEPT { return p; }
Howard: Thanks for all the comments regarding the default visibility
tag on the definition. I agree it isn't needed, and that there are lots
of other places where it is missing. That being said, I'm not wanting
to rock the boat on that issue right now. So I've added it back to the
definition via _LIBCPP_FUNC_VIS. A later pass dedicated just to this
issue can bring things in to a consistent state one way or the other.
Note that we do not want to have the exact same attributes on the
declaration and defintion in this case. The declaration should not be
marked weak, whereas the definition should (which is what G M's patch
did). I've fully tested on OS X to ensure that the resultant attribute
syntax actually works.
llvm-svn: 192007
2013-10-04 23:56:37 +00:00
Howard Hinnant
3af48ef76e
G M: Changes all references to "x inline" to "inline x" where x = _libcpp_always_inline or _libcpp_inline_visibility macros.
...
The patch touches these files:
locale
array
deque
new
string
utility
vector
__bit_reference
__split_buffer
locale_win32.h
There is no intended functionality change and it is expected that reversing the position of the inline keyword with regard to the other keywords does not change the meaning of anything, least not for apple/Linux etc.
It is intended to make libcxx more consistent with itself and to prevent the 1000 or so
"inline.cpp(3) : warning C4141: 'inline' : used more than once" warnings that MS's cl.exe compiler emits without this patch, i.e. if inline is not the first keyword before a function name etc.
Prefer "inline [other inline related keyword]" over "[other related keyword] inline".
After this patch, libcxx should be consistent to this pattern.
llvm-svn: 191987
2013-10-04 22:09:00 +00:00
Howard Hinnant
f7a8c4f347
G M: Fix libcxx's detection of rtti disablement for g++.exe and cl.exe. When RTTI is NOT enabled, _LIBCPP_NO_RTTI is defined.
...
llvm-svn: 191981
2013-10-04 21:24:21 +00:00
Howard Hinnant
80b84d4c26
G M: Provides the _LIBCPP_WARNING macro, to be used for MSVC only, since that compiler doesn't support #warning.
...
llvm-svn: 191980
2013-10-04 21:14:44 +00:00
Marshall Clow
ad864049d6
Remove non-printable chars that snuck in back in July; thanks to Yaron Keren for the catch
...
llvm-svn: 191756
2013-10-01 13:28:20 +00:00
Marshall Clow
45b983c4d0
Part 8 of LWG Issue 2210' unordered_set and unordered multiset; this got missed when I went on vacation
...
llvm-svn: 191705
2013-09-30 21:33:51 +00:00
Howard Hinnant
9fd9f84f48
SCARY/N2913 iterator support between the multi and non-multi versions of the associative and unordered containers. I beleive lack of support for this was accidentally recently introduced (by me) and this is fixing a regression. This time tests are put in to prevent such a regression in the future.
...
llvm-svn: 191692
2013-09-30 19:08:22 +00:00
Marshall Clow
3d5134dd52
Implement n3789; constexpr support in named function objects
...
llvm-svn: 191626
2013-09-28 19:06:12 +00:00
Marshall Clow
8392ab209e
Add a set of macros for using the new '[[[deprecated]]' attribute. No code changes (yet)
...
llvm-svn: 191625
2013-09-28 18:35:31 +00:00
Howard Hinnant
7a828034c6
Peter Collingbourne: If a pointer is passed as the third argument of the (iterator,
...
iterator, allocator) constructor with the intention of it being
implicitly converted to the allocator type, it is possible for overload
resolution to favour the (iterator, iterator, enable_if) constructor.
Eliminate this possibility by moving the enable_if to one of the
existing arguments and removing the third argument.
llvm-svn: 191145
2013-09-21 21:13:54 +00:00
Howard Hinnant
ff29d538ea
Apply LWG 2048. It is amazing to me that this actually works, but the existing tests confirm that it does. c++1y status page now showing libc++ is complete for c++1y modulo dynarray issues.
...
llvm-svn: 191142
2013-09-21 19:25:37 +00:00
Howard Hinnant
f13cf89df2
Apply LWG 2021. This is only a documentation change. Also bringing c++1y status page up to date.
...
llvm-svn: 191141
2013-09-21 18:17:23 +00:00
Howard Hinnant
b76e6a95a9
Apply LWG 2017. This is a only a documentation change.
...
llvm-svn: 191140
2013-09-21 17:58:58 +00:00
Howard Hinnant
ead6f1699d
N3659: Shared locking in C++ Revision 2, c++1y only
...
llvm-svn: 191127
2013-09-21 01:49:28 +00:00
Howard Hinnant
b1c82cd090
David Chisnall: macro protect 'test' in __has_pointer_type_imp.
...
llvm-svn: 191126
2013-09-21 01:45:05 +00:00
Howard Hinnant
5f878d4bd2
G M: Restore the ability for libcxx to compile again on mingw 64.
...
llvm-svn: 190837
2013-09-17 01:34:47 +00:00
Howard Hinnant
3b2d7ee18c
Marshall Clow: LWG Issue 2056: future_errc enums start with value 0 (invalid value for broken_promise).
...
llvm-svn: 190756
2013-09-14 18:20:10 +00:00
Marshall Clow
a369cb6280
LWG Issue 2210 (Part #7 ): vector and vector<bool>
...
llvm-svn: 190736
2013-09-14 00:47:59 +00:00
Howard Hinnant
84f996fb2e
G M: Make shared_ptr a little more gentle for some compilers. No impact on clang.
...
llvm-svn: 190732
2013-09-13 23:56:00 +00:00
Howard Hinnant
f35fc7ad74
G M: Make valarray a little more forgiving to compilers not quite so gifted. This has no impact on clang.
...
llvm-svn: 190731
2013-09-13 23:27:42 +00:00
Marshall Clow
ef6f1151b0
Initial implementation of <dynarray>. No allocator support pending resolution of LWG #2235 ; no stack allocation pending compiler support
...
llvm-svn: 190697
2013-09-13 15:22:55 +00:00
Marshall Clow
3cd37e6456
LWG Issue 2210 (Part #6 ): unordered_map and unordered_multimap
...
llvm-svn: 190576
2013-09-12 03:00:31 +00:00
Marshall Clow
50c003b577
Implement uses-allocator construction
...
llvm-svn: 190571
2013-09-12 02:11:16 +00:00
Howard Hinnant
872ac4b5f0
A collection of minor type-o fixes. The first two aren't testable, but all tests pass with them. I stumbled across them while experimenting with a std::move that checks its argument for non-const. The third corrects a test that is currently failing.
...
llvm-svn: 190563
2013-09-12 00:10:44 +00:00
Marshall Clow
6e8ebb2ce9
Adding bad_array_length to libc++
...
llvm-svn: 190478
2013-09-11 01:38:42 +00:00
Marshall Clow
fbc317d480
LWG Issue #2210 Part 5 - map/multimap; no, really - the last one was set/multiset. THIS is map/multimap
...
llvm-svn: 190474
2013-09-11 01:15:47 +00:00
Marshall Clow
0a55d17bcd
LWG Issue #2210 Part 4 - map/multimap
...
llvm-svn: 190454
2013-09-11 00:06:45 +00:00
Marshall Clow
f1b6d1b538
Update synopsis for list/forward_list/deque to match the allocator style of existing comment. No code change
...
llvm-svn: 190320
2013-09-09 18:19:45 +00:00
Marshall Clow
fb8297668f
LWG Issue 2210 (Part #2 & #3 ): list and forward_list
...
llvm-svn: 190279
2013-09-08 19:11:51 +00:00
Marshall Clow
630c5e535c
LWG Issue 2210 (Part #1 ): deque
...
llvm-svn: 190251
2013-09-07 16:16:19 +00:00
Marshall Clow
ef44edfde4
N3545: Quoted strings
...
llvm-svn: 190032
2013-09-05 04:48:45 +00:00
Marshall Clow
5155a569d1
LWG Issue 2148: Hashing Enums
...
llvm-svn: 189831
2013-09-03 17:55:32 +00:00
Marshall Clow
710a902cac
Updated the synopsis for weak_ptr<T>::owner_before to match the code. No code changes.
...
llvm-svn: 189812
2013-09-03 14:37:50 +00:00
Howard Hinnant
e7d746d8b9
Implement N3672, optional<T>.
...
llvm-svn: 189772
2013-09-02 20:30:37 +00:00
Howard Hinnant
69bc206547
SFINAE out duration converting constructor if the constructor would otherwise cause a ratio compile-time overflow. This fixes LWG 2094.
...
llvm-svn: 189722
2013-08-31 16:51:56 +00:00
Howard Hinnant
525dc284b4
is_destructible for function types was mistakenly returning true instead of false. This is true in both C++11 and C++1y, but has been clarified by the post C++11 LWG issue 2049.
...
llvm-svn: 189687
2013-08-30 19:12:42 +00:00
Howard Hinnant
d0a4d73623
Xing Xue: Fix type-o. Thanks to C. Bergström for spotting it.
...
llvm-svn: 189674
2013-08-30 14:42:39 +00:00
Marshall Clow
1e548c72e7
LWG Issue 2128: Implement global cbegin/rbegin/cend/rbegin
...
llvm-svn: 189634
2013-08-30 01:17:07 +00:00
Howard Hinnant
b81766ca23
Glen: Remove unneeded _LIBCPP_ALWAYS_INLINE.
...
llvm-svn: 189626
2013-08-29 23:50:48 +00:00
Howard Hinnant
9762413621
Xing Xue: Some minor changes for IBM XLC++/AIX.
...
llvm-svn: 189623
2013-08-29 23:37:50 +00:00
Howard Hinnant
393068bb04
Turn off extern templates for most uses. It is causing more problems than it is worth. The extern templates will still be built into the dylib, mainly for ABI stability purposes. And the client can still turn these back on with a #define if desire. This fixes http://llvm.org/bugs/show_bug.cgi?id=17027 . However there's no associated test for the test suite because http://llvm.org/bugs/show_bug.cgi?id=17027 needs mismatched dylib and headers to fire.
...
llvm-svn: 189610
2013-08-29 20:56:53 +00:00
Marshall Clow
06fbed03fc
LWG Issue 2162: mark allocator_traits::maxsize as noexcept
...
llvm-svn: 189399
2013-08-27 20:22:15 +00:00
Marshall Clow
7988106b21
LWG issues 2174/5/6 - mark wstring_convert::converted as noexcept, and make (some of) the constructors for wstring_convert and wbuffer_convert as explicit. Add configuration macro _LIBCPP_EXPLICIT_AFTER_CXX11
...
llvm-svn: 189398
2013-08-27 20:18:59 +00:00
Marshall Clow
5320c2b563
Update synopsis in <locale> to match LWG Issue 2229. No code change
...
llvm-svn: 189352
2013-08-27 14:22:13 +00:00
Marshall Clow
54c83368a5
Implement LWG issue 2061
...
llvm-svn: 189345
2013-08-27 13:03:03 +00:00
Howard Hinnant
93288117a5
Apply constexpr to initializer_list for c++1y.
...
llvm-svn: 189271
2013-08-26 20:11:32 +00:00
Howard Hinnant
c9d3ae43d2
G M: Improve support for compilers not supporting defaulted functions.
...
llvm-svn: 189184
2013-08-24 21:31:37 +00:00
Howard Hinnant
145afa17ca
Rename _LIBCPP_DEBUG2 to _LIBCPP_DEBUG.
...
llvm-svn: 189140
2013-08-23 20:10:18 +00:00
Howard Hinnant
2f57df2aa9
Remove _LIBCPP_DEBUG. This was my first attempt at debug mode for libc++, and is now obsoleted by _LIBCPP_DEBUG2 (which isn't finished).
...
llvm-svn: 189135
2013-08-23 19:03:36 +00:00
Howard Hinnant
fc88dbd298
Debug mode for string. This commit also marks the first time libc++ debug-mode has found a bug (found one in regex). Had to play with extern templates a bit to get this to work since string is heavily used within libc++.dylib.
...
llvm-svn: 189114
2013-08-23 17:37:05 +00:00
Howard Hinnant
104024cb59
Glen: replace obsolete _LIBCPP_CANTTHROW with _NOEXCEPT.
...
llvm-svn: 189046
2013-08-22 19:39:03 +00:00
Howard Hinnant
179b1f8cf2
Zhihao Yuan noted that there were a few unneeded statements. Eliminated the unnecessary ones, and commented the ones that are there for non-obvious reasons such as to help things limp along in C++03 language mode.
...
llvm-svn: 189039
2013-08-22 18:29:50 +00:00
Howard Hinnant
9ff3203fcc
Zhihao Yuan noted that a move assignment operation was missing from std::adjacent_difference. Fixed.
...
llvm-svn: 189036
2013-08-22 18:02:34 +00:00
Howard Hinnant
d8bf850359
David Blaikie suggested this test for detecting constexpr on the error_category default constructor. Additionally I decided to make this constructor trivial as well, as I could not come up with a rationale for not doing so. Fully tested with both current Apple clang and tip-of-trunk clang.
...
llvm-svn: 189034
2013-08-22 17:41:48 +00:00
Marshall Clow
a86d516213
LWG 2145 - mark constructor for std::error_category as inline and constexpr. Leave the (existing, out-of-line, non-constexpr) in the dylib for compatibility with existing programs)
...
llvm-svn: 188858
2013-08-21 02:57:19 +00:00
Howard Hinnant
113f13d2a5
Relax complete-type check for functions and function pointers to allow void return type. This bug was exposed by Eli Friedman's commit to clang r188324. Anywhere this version of clang ships, this libc++ fix must follow. However this fix is compatible with previous clangs, and so this libc++ doesn't need to wait for this clang.
...
llvm-svn: 188413
2013-08-14 21:28:31 +00:00
Howard Hinnant
5d1a701d6d
Xing Xue: port to IBM XLC++/AIX.
...
llvm-svn: 188396
2013-08-14 18:00:20 +00:00
Marshall Clow
ede1aa2d31
Add a deleted assignment operator for basic_ostream; LWG Issue #2067
...
llvm-svn: 188375
2013-08-14 15:15:28 +00:00
Marshall Clow
2d6e2834a8
Implement LWG Issue #2187 (emplace_back and emplace for vector<bool>)
...
llvm-svn: 188333
2013-08-13 23:54:12 +00:00
Marshall Clow
2585835c3b
Second half (map/multimap) of N3657
...
llvm-svn: 188320
2013-08-13 22:18:47 +00:00
Marshall Clow
25d3402c6a
First half of support for N3657; heterogenous lookups for set/multiset
...
llvm-svn: 188241
2013-08-13 01:11:06 +00:00
Howard Hinnant
f0544c2086
Nico Rieck: this patch series fixes visibility issues on Windows as explained in < http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-August/031214.html >.
...
llvm-svn: 188192
2013-08-12 18:38:34 +00:00
Howard Hinnant
6afbc442d6
Add a check for arrays of unknown bounds to is_destructible. This fixes http://llvm.org/bugs/show_bug.cgi?id=16839
...
llvm-svn: 188080
2013-08-09 16:53:45 +00:00
Howard Hinnant
d7cda0680a
Partial implementation of N3665. This paper was not voted into the C++1y draft. However I was looking at it and with some experimentation realized that I could partially implement it, and at the same time offer a performance optimization to cout. I simply added an xsputn override to the cout filebuf. The override does nothing special at all if there is a non-trivial codecvt installed. However if the codecvt returns true for always_noconv(), then this function can dump an entire string to fwrite, instead of doing it a character at a time under overflow(). This just makes sense. I stopped short of a full implementation of N3665 because in order to do so, xsputn would have to allocate a buffer when always_noconv() returned false, and I don't want to go to that expense.
...
llvm-svn: 188077
2013-08-09 16:25:43 +00:00
Marshall Clow
2472b928d2
N3644 tests for map/multimap/set/multiset. Drive-by NOEXCEPT for __tree_const_iterator constructor. Fix comment typos in other tests
...
llvm-svn: 188019
2013-08-08 21:52:50 +00:00
Howard Hinnant
8c9742051d
My previous reorganization of addressof broke -std=c++03. Thanks much to Arnold Schwaighofer for catching this. This patch also catches a few more missing addressof in <future>, thanks go to Zhihao Yuan for catching these.
...
llvm-svn: 187997
2013-08-08 18:38:55 +00:00
Arnold Schwaighofer
5331e3a481
Revert r187927.
...
Zhihao Yuan: Replace operator& with addressof in reference_wrapper constructor.
It breaks a clang bootstrap.
llvm-svn: 187959
2013-08-08 03:06:24 +00:00
Howard Hinnant
9027f5e3de
Zhihao Yuan: Replace operator& with addressof in reference_wrapper constructor.
...
llvm-svn: 187927
2013-08-07 23:02:42 +00:00
Marshall Clow
2c1a894061
N3644 support for <unordered_set> and <unordered_map>
...
llvm-svn: 187915
2013-08-07 21:30:44 +00:00
Marshall Clow
36b2a3b0e5
N3644 support for vector<bool>
...
llvm-svn: 187911
2013-08-07 20:53:44 +00:00
Marshall Clow
07186a7d2d
N3644 support for <string> and <vector>
...
llvm-svn: 187909
2013-08-07 20:48:48 +00:00
Howard Hinnant
303e27d8ce
Correct logic bug in find optimization for vector<bool>. This fixes http://llvm.org/bugs/show_bug.cgi?id=16816
...
llvm-svn: 187908
2013-08-07 20:42:16 +00:00
Howard Hinnant
d098713aaf
War on tabs
...
llvm-svn: 187906
2013-08-07 19:39:48 +00:00
Marshall Clow
8fe0a3722c
Implement NULL iterators for <forward_list> and <deque> re: N3644
...
llvm-svn: 187805
2013-08-06 16:14:36 +00:00
Marshall Clow
0c37cfd8b8
Implement NULL iterators for <list> re: N3644
...
llvm-svn: 187740
2013-08-05 21:23:28 +00:00
Howard Hinnant
2f51de568f
debug mode for unordered_map. Also picked up a missing check and test in unordered_multimap. This wraps up debug mode for the unordered containers.
...
llvm-svn: 187659
2013-08-02 17:50:49 +00:00
Howard Hinnant
42a3046eef
Ok, 3 major changes for debug mode in one commit:
...
1. I had been detecting and trapping iterator == and \!= among iterators
in different containers as an error. But the trapping itself is actually
an error.
Consider:
#include <iostream>
#include <vector>
#include <algorithm>
template <class C>
void
display(const C& c)
{
std::cout << "{";
bool first = true;
for (const auto& x : c)
{
if (\!first)
std::cout << ", ";
first = false;
std::cout << x;
}
std::cout << "}\n";
}
int
main()
{
typedef std::vector<int> V;
V v1 = {1, 3, 5};
V v2 = {2, 4, 6};
display(v1);
display(v2);
V::iterator i = std::find(v1.begin(), v1.end(), 1);
V::iterator j = std::find(v2.begin(), v2.end(), 2);
if (*i == *j)
i = j; // perfectly legal
// ...
if (i \!= j) // the only way to check
v2.push_back(*i);
display(v1);
display(v2);
}
It is legal to assign an iterator from one container to another of the
same type. This is required to work. One might want to test whether or
not such an assignment had been made. The way one performs such a check
is using the iterator's ==, \!= operator. This is a logical and necessary
function and does not constitute an error.
2. I had a header circular dependence bug when _LIBCPP_DEBUG2 is defined.
This caused a problem in several of the libc++ tests.
Fixed.
3. There is a serious problem when _LIBCPP_DEBUG2=1 at the moment in that
std::basic_string is inoperable. std::basic_string uses __wrap_iterator
to implement its iterators. __wrap_iterator has been rigged up in debug
mode to support vector. But string hasn't been rigged up yet. This means
that one gets false positives when using std::string in debug mode. I've
upped std::string's priority in www/debug_mode.html.
llvm-svn: 187636
2013-08-02 00:26:35 +00:00
Howard Hinnant
0be8f64c44
Nico Rieck: Currently _MSC_VER and _WIN32 are used to guard code which is
...
MSVC-specific, MSVCRT-specific, or Windows-specific. Because Clang can
also define _MSC_VER, and MSVCRT is not necessarily the only C runtime,
these macros should not be used interchangeably.
This patch divides all Windows-related bits into the aforementioned
categories. Two new macros are introduced:
- _LIBCPP_MSVC: Defined when compiling with MSVC. Detected using
_MSC_VER, excluding Clang.
- _LIBCPP_MSVCRT: Defined when using the Microsoft CRT. This is the default
when _WIN32 is defined.
This leaves _WIN32 for code using the Windows API.
This also corrects the spelling of _LIBCP_HAS_IS_BASE_OF to _LIBCPP_HAS_IS_BASE_OF.
Nico, please prepare a patch for CREDITS.TXT, thanks.
llvm-svn: 187593
2013-08-01 18:17:34 +00:00
Howard Hinnant
0f242bea10
Taking another swing at correctly optimizing fill_n.
...
llvm-svn: 187587
2013-08-01 17:29:28 +00:00
Howard Hinnant
ce075cf1aa
Constrain fill_n -> memset operations to include implicit convertibility to unsigned char. This fixes http://llvm.org/bugs/show_bug.cgi?id=16764 . Also a drive-by fix on a chrono test suite bug.
...
llvm-svn: 187552
2013-08-01 00:41:55 +00:00
Marshall Clow
a1cd191624
Implement constexpr (n3302) and fix operator *= and /=
...
llvm-svn: 187529
2013-07-31 21:02:34 +00:00
Marshall Clow
df67172d59
Backwards!
...
llvm-svn: 187518
2013-07-31 19:39:37 +00:00
Marshall Clow
a1d0d376c8
Implement n3469 - constexpr for chrono
...
llvm-svn: 187517
2013-07-31 19:32:19 +00:00
Howard Hinnant
4c80bfbd53
Debug mode for unordered_multimap. Some mods were done for unordered_map as well to keep all the tests passing. However unordered_map is at the very least still missing tests, if not functionality (if it isn't tested, it probably isn't working).
...
llvm-svn: 187446
2013-07-30 21:04:42 +00:00
Howard Hinnant
e5c13decbe
Debug mode for unordered_multiset. The exercise spotted a few places I had missed on unordered_set, so I picked those up as well.
...
There are actually two debug modes:
1. -D_LIBCPP_DEBUG2 or -D_LIBCPP_DEBUG2=1
This is a relatively expensive debug mode, but very thorough. This is normally what you want to debug with, but may turn O(1) operations into O(N) operations.
2. -D_LIBCPP_DEBUG2=0
This is "debug lite." Only preconditions that can be checked with O(1) expense are checked. For example range checking on an indexing operation. But not iterator validity.
llvm-svn: 187369
2013-07-29 19:05:47 +00:00
Marshall Clow
83c08b4497
Implement N3421; comparison predicates<void>
...
llvm-svn: 187357
2013-07-29 14:21:53 +00:00
Marshall Clow
7aa54577d1
literal suffixes for std::chrono
...
llvm-svn: 187078
2013-07-24 21:18:14 +00:00
Howard Hinnant
b24c802489
Debug mode for unordered_set. I believe this to be fairly complete for
...
unordered_set, however it is not complete yet for unordered_multiset,
unordered_map or unordered_multimap. There has been a lot of work done
for these other three containers, however that work was done just to
keep all of the tests passing.
You can try this out with -D_LIBCPP_DEBUG2. You will have to link to a
libc++.dylib that has been compiled with src/debug.cpp. So far, vector
(but not vector<bool>), list, and unordered_set are treated. I hope to
get the other three unordered containers up fairly quickly now that
unordered_set is done.
The flag _LIBCPP_DEBUG2 will eventually be changed to _LIBCPP_DEBUG, but
not today. This is my second effort at getting debug mode going for
libc++, and I'm not quite yet ready to throw all of the work under the
first attempt away.
The basic design is that all of the debug information is kept in a
central database, instead of in the containers. This has been done as
an attempt to have debug mode and non-debug mode be ABI compatible with
each other. There are some circumstances where if you construct a
container in an environment without debug mode and pass it into debug
mode, the checking will get confused and let you know with a readable
error message. Passing containers the other way: from debug mode out to
a non-debugging mode container should be 100% safe (at least that is the
goal).
llvm-svn: 186991
2013-07-23 22:01:58 +00:00
Marshall Clow
ca0be23b39
Implement string suffixes from N3642
...
llvm-svn: 186956
2013-07-23 17:05:24 +00:00
Howard Hinnant
7491a16031
Bill Fisher: This patch fixes a bug where std::regex in ECMAScript mode was ignoring capture groups inside lookahead assertions.
...
For example, matching /(?=(a))(a)/ to "a" should yield two captures: \1 = "a", \2 = "a"
llvm-svn: 186954
2013-07-23 16:18:04 +00:00
Richard Smith
79c06417d1
Add some missing cv-qualifiers.
...
llvm-svn: 186909
2013-07-23 01:24:30 +00:00
Anders Carlsson
8bb1dbbf75
Fix a bug in std::fill_n where memset would end up being called in cases when it shouldn’t.
...
Reviewed by Howard.
llvm-svn: 186875
2013-07-22 21:08:00 +00:00
Marshall Clow
75eff74803
Make tuple's constructor and std::get<>(tuple) constexpr. Final stage of fixing bug #16599 . Thanks to Howard for the review and updates.
...
llvm-svn: 186834
2013-07-22 16:02:19 +00:00
Marshall Clow
8bf1f08a2c
Make std::get constexpr
...
llvm-svn: 186525
2013-07-17 18:25:36 +00:00
Marshall Clow
18191ceb54
Bug 16599 part 2: Make std::pair's constructors and comparison operators (and make_pair) constexpr.
...
llvm-svn: 186430
2013-07-16 17:45:44 +00:00
Marshall Clow
1c682f0f0c
Make std::forward and std::move (and std::move_if_noexcept) constexpr in C++14
...
llvm-svn: 186344
2013-07-15 20:46:11 +00:00
Howard Hinnant
22161401df
Bill Fisher: This patch fixes an ill-formed comparison when parsing control escapes, e.g. "\cA\ca". The code will now throw an error_escape exception for invalid control sequences like "\c:" or "\c".
...
I've added the test cases to bad_escape.pass.cpp.
llvm-svn: 186335
2013-07-15 18:21:11 +00:00
Marshall Clow
f20d2672e2
Add macro _LIBCPP_CONSTEXPR_AFTER_CXX11 for functions that have been marked constexpr post C++11
...
llvm-svn: 186323
2013-07-15 14:57:19 +00:00
Marshall Clow
e99520c72e
Implement n3584 - Addressing Tuples by Type
...
llvm-svn: 186237
2013-07-13 02:54:05 +00:00
Howard Hinnant
c815a4e297
Bill Fisher: This patch fixes a less likely case where '\b' can back up into invalid memory, when driven by a regex_iterator (for case 1, see r185273 or http://llvm.org/bugs/show_bug.cgi?id=16240 )
...
The attached test program also supplies a test for the case 1 fix in r185273.
llvm-svn: 186089
2013-07-11 15:32:55 +00:00
Marshall Clow
8e1cb5adb3
move __save_flags from <random> to <ios> in preparation for reuse; no functionality change
...
llvm-svn: 185968
2013-07-09 20:34:14 +00:00
Howard Hinnant
dbdeb153d8
Bill Fisher: This patch fixes a bug where regex_iterator doesn't indicate when it's restarting in the middle of a string. This bug causes /^a/ to match in the middle of the string "aaaaaaa", during iteration.
...
My patch uses to communicate when is false.
llvm-svn: 185950
2013-07-09 17:29:09 +00:00
Howard Hinnant
e0fe3d2e96
War on tabs.
...
llvm-svn: 185865
2013-07-08 21:06:38 +00:00
Marshall Clow
a7b0e5ddf8
Implement n3668 - std::exchange
...
llvm-svn: 185863
2013-07-08 20:54:40 +00:00
Marshall Clow
f331327c6a
Implement n3545 for c++14
...
llvm-svn: 185856
2013-07-08 20:05:31 +00:00
Howard Hinnant
abb160e689
Remove implicit conversion from __value_type to value_type in [unordered_][multi]map. This fixes http://llvm.org/bugs/show_bug.cgi?id=16549
...
llvm-svn: 185711
2013-07-05 18:06:00 +00:00
Howard Hinnant
4a95f9eb7e
Removed extension in [unordered_][multi]map which allowed one to emplace using just an argument for the key, as opposed to using piecewise_construct. However a bug report exposed that this created an unfortunate ambiguity. People who are currently using the extension will be notified the next time they compile, and will have to change to using piecewise_construct. There are no ABI issues with the removal of this extension. This fixes http://llvm.org/bugs/show_bug.cgi?id=16542
...
llvm-svn: 185666
2013-07-04 20:59:16 +00:00
Howard Hinnant
bbdf669bde
Simplify comparators of [unordered_][multi]map. This fixes http://llvm.org/bugs/show_bug.cgi?id=16538
...
llvm-svn: 185665
2013-07-04 19:46:35 +00:00
Marshall Clow
5b2ef2b1a6
Patch for N3655 (Transformation type traits) with Howard's additions
...
llvm-svn: 185597
2013-07-04 00:10:01 +00:00
Marshall Clow
60df5996a4
Commit patch for integer sequences. Suggested by Richard, reworked by Howard, and annotated by me
...
llvm-svn: 185569
2013-07-03 19:20:30 +00:00
Howard Hinnant
84b569d5cf
Matthew Dempsky: Attached patch replaces the type punning with memcpy(), which on
...
x86/x86-64 clang optimizes to direct word accesses anyway. This fixes an unaligned word access in murmurhash/cityhash.
llvm-svn: 185558
2013-07-03 17:39:28 +00:00
Marshall Clow
95ddb53049
Adorn make_unique with visibility and inline attributes
...
llvm-svn: 185468
2013-07-02 20:06:09 +00:00
Howard Hinnant
9cfcdcb9e2
Matthew Dempsky: In libc++'s <locale>, there's already dependence on an snprintf_l
...
implementation and all of the char buffers readily have their
allocated size available, so we can easily use snprintf_l instead of
sprintf_l.
This avoids OpenBSD's linker warnings against using sprintf and
vsprintf.
Howard: Please consider a patch for CREDITS.TXT
llvm-svn: 185457
2013-07-02 18:42:28 +00:00
Howard Hinnant
3fc9ef22b3
Constrain launch ~ operator to defined bits.
...
llvm-svn: 185452
2013-07-02 18:01:41 +00:00
Howard Hinnant
43bbdd29de
Bill Fisher: This patch fixes a bug where the regex parser doesn't advance the pointer after reading the third character of an octal escape (in awk mode).
...
That is, regex{"\141", awk} results in the regular expression /a1/ instead of just /a/.
llvm-svn: 185449
2013-07-02 17:43:31 +00:00
Marshall Clow
28d8ba5f79
Implement n3656 - make_unique. Thanks to Howard for the review and suggestions.
...
llvm-svn: 185352
2013-07-01 18:16:03 +00:00