884 Commits

Author SHA1 Message Date
Peter Collingbourne
9d3d032c7d 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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@203070 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 04:11:10 +00:00
Marshall Clow
48c74700ec 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202994 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 19:06:20 +00:00
Marshall Clow
24b29a02f1 Mark is_final as a C++14 feature.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202991 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 17:58:48 +00:00
Marshall Clow
0d6dcb5569 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
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202990 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 17:09:51 +00:00
Marshall Clow
ebd6c2b81d 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202934 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 03:39:25 +00:00
Marshall Clow
23ef151614 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202931 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-05 03:12:04 +00:00
Marshall Clow
a93b5e27a8 Implement LWG #2268: Setting a default argument in the declaration of a member function assign of std::basic_string.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202876 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 19:17:19 +00:00
Peter Collingbourne
be8a99ad0f [libc++] Const qualify __gnu_cxx::hash_map<>::const_iterator::pointer type.
Differential Revision: http://llvm-reviews.chandlerc.com/D2811

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202749 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-03 19:50:01 +00:00
Marshall Clow
53c0e72d5c 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202741 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-03 19:20:40 +00:00
Marshall Clow
50fe0c7d61 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202673 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-03 06:18:11 +00:00
Marshall Clow
3fef95b10d 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202672 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-03 06:14:19 +00:00
Marshall Clow
ff137e9145 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202671 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-03 01:24:04 +00:00
Marshall Clow
02ca8af10b LWG issue #2188: Reverse iterator does not fully support targets that overload operator&. Also mark #2272 and #2299 as complete; libc++ already implements them.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202339 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-27 02:11:50 +00:00
Marshall Clow
103af3478e 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202214 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-26 01:56:31 +00:00
Marshall Clow
8e554d93da Implement LWG issue 2301: Mark std::tie as constexpr
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202158 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-25 16:11:46 +00:00
Marshall Clow
4ffb67eca5 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@201938 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-22 15:13:48 +00:00
Juergen Ributzka
db9d0da3b4 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@201892 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-21 21:06:36 +00:00
Marshall Clow
c4a47e14b9 Fix historical #ifdef. Use __cplusplus instead of __GXX_EXPERIMENTAL_CXX0X__ when compiling with clang. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@201864 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-21 18:07:52 +00:00
Yaron Keren
0648cc5316 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!



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@201844 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-21 10:00:31 +00:00
Chandler Carruth
f84f6118b3 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@201843 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-21 08:37:30 +00:00
Marshall Clow
e0f8672e7a Implement LWG Issues #2329 and #2332 - disallow iterators into temporary regexes and regexes into temporary strings
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@201717 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-19 21:21:11 +00:00
Marshall Clow
9dacb2f713 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@201703 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-19 17:53:30 +00:00
Marshall Clow
9d9463a355 Implement LWG2350: min, max, and minmax should be constexpr.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@201697 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-19 16:51:35 +00:00
Marshall Clow
a2df82b98e Implement LWG Issue 2346: integral_constant's member functions should be marked noexcept
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@201534 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-17 22:18:51 +00:00
Marshall Clow
8eb5acc3c7 Remove tabs that crept in during an earlier refactoring. No functionality change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@201472 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-16 01:57:26 +00:00
Yaron Keren
117cbb307b 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!



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@201328 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-13 14:02:28 +00:00
Marshall Clow
71e699dda5 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@201101 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-10 17:40:28 +00:00
Marshall Clow
ebfc50ee89 Fix for PR18735 - self-assignment for map/multimap gives incorrect results in C++03
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@201021 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-08 04:03:14 +00:00
Joerg Sonnenberger
cf7278afd7 Avoid signed vs unsigned compare warnings. From Dimitry Andric.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@200993 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-07 21:14:29 +00:00
Peter Collingbourne
a3dc8f3b8b Support forward_list<Incomplete Type>. Patch by Zhihao Yuan!
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@200814 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-05 01:44:17 +00:00
Logan Chien
e1678a18d9 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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@200523 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-31 09:30:46 +00:00
Marshall Clow
708dd84a4e 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@200010 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-24 15:27:41 +00:00
Peter Collingbourne
a4c0d87a84 Const qualify __mem_fn call operator
QOI improvement.

Differential Revision: http://llvm-reviews.chandlerc.com/D2059

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@199848 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-22 22:56:52 +00:00
Marshall Clow
97f50f6c5e Update __parse_DUP_COUNT and __parse_BACKREF to use the traits class to recognize digits. Fixes PR18514
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@199541 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-18 03:40:03 +00:00
Marshall Clow
98760c18f8 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@199400 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-16 16:58:45 +00:00
Marshall Clow
8896ac3cdd 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@199184 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-14 05:13:45 +00:00
Marshall Clow
72fe0ae7cf Fix a bug in regex_token_iterator's copy constructor. Caught by Bob Wilson.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@199122 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-13 17:47:08 +00:00
Marshall Clow
0efd9dcfa0 Fix PR18404 - 'Bug in regex_token_iterator::operator++(int) implementation'. Enhance the tests for regex_token_iterator and regex_iterator.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@198878 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-09 18:25:57 +00:00
Marshall Clow
908b5d7f92 Back out the <type_traits> changes from r198431; they were breaking when building with glibc. Need to find a better solution for PR18218.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@198623 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-06 18:12:50 +00:00
Marshall Clow
af6cd294aa Removed extra trailing underscore in #ifdef (__GNUC___ --> __GNUC__ )
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@198618 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-06 15:23:02 +00:00
Marshall Clow
0ea7f8cfb3 Rename several internal templates to get rid of ___ (triple underscores) or worse, four. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@198608 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-06 14:00:09 +00:00
Yaron Keren
6c27250223 80 cols fixes.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@198482 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-04 09:27:39 +00:00
Yaron Keren
c8d1bbab02 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.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@198481 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-04 08:56:00 +00:00
Marshall Clow
a71f9562f0 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@198457 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-03 22:55:49 +00:00
Marshall Clow
854a7a02b4 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()
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@198431 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-03 18:21:14 +00:00
Marshall Clow
239bc42b53 Make cv_status a class enum. Fixes PR18314. Thanks to Andersca for the report and the patch.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@197921 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-23 22:14:27 +00:00
Yaron Keren
f1ebe26bdb Empty line between two unrelated #ifdefs.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@197810 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-20 13:19:45 +00:00
Logan Chien
bfd68bf0c7 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.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@197313 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-14 06:44:09 +00:00
Marshall Clow
1c398696b0 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
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@197061 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-11 19:32:32 +00:00
Marshall Clow
73b46a7248 Refactored a bunch of duplicated code in <ostream>. Made a new routine called __put_character_sequence, and made nine places call it.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@196951 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-10 19:25:49 +00:00