Commit Graph

25 Commits

Author SHA1 Message Date
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
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
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
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
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 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 6e41256f68 No functionality change at this time. I've split _LIBCPP_VISIBLE up into two flags: _LIBCPP_TYPE_VIS and _LIBCPP_FUNC_VIS. This is in preparation for taking advantage of clang's new __type_visibility__ attribute.
llvm-svn: 176593
2013-03-06 23:30:19 +00:00
Howard Hinnant 119703f984 Dimitry Andric: Silence some miscellaneous warnings.
llvm-svn: 167493
2012-11-06 21:55:44 +00:00
Howard Hinnant 42b8bb5033 Fix http://llvm.org/bugs/show_bug.cgi?id=11461. Credit Alberto Ganesh Barbati.
llvm-svn: 146345
2011-12-11 20:31:33 +00:00
Howard Hinnant c003db1fca Further macro protection by replacing _[A-Z] with _[A-Z]p
llvm-svn: 145410
2011-11-29 18:15:50 +00:00
Chandler Carruth 8fd6dc0df3 Revert r136547, r136545, and r136542 by removing slist.
This was checked in without review. It is not clear its reasonable to
include with libc++ at all, and needs discussion at a highlevel before
moving forward.

It's also completely lacking tests, and included several bugs in the
implementation.

llvm-svn: 136577
2011-07-30 21:10:18 +00:00
Alexis Hunt bf78786db0 Add the missing default argument for the allocator and use a cleaner
implementation of previous().

llvm-svn: 136547
2011-07-30 00:47:53 +00:00
Alexis Hunt 241bf43919 Oops. That last commit was from an earlier revision of the file and was
more than just a bit broken. This one should compile and run without
infinite loops.

llvm-svn: 136545
2011-07-30 00:06:52 +00:00
Alexis Hunt 1e846797dd Include an "implementation" if SGI's slist. This was quickly hacked
together to get it working with code, and is neither optimal
(erase(Iterator, Iterator) calculates the previous iterator twice,
rather than calculating the previous iterator of the first one, then
advancing it until the second is found) nor complete (splice() was not
implemented). Most of the implementation is borrowed from forward_list
via using-declarations.

llvm-svn: 136542
2011-07-29 23:42:36 +00:00
Alexis Hunt 8d2ed56644 Add a new hash class in __gnu_ext for the extension containers. There
are two motivations for this.

First, this allows users who are specializing __gnu_ext::hash to
continue doing so without changing their code.

Second, SGI specifies hash overloads for char* and const char* that
perform a hash of the string, not of the pointer.

In order to support this, the hashing code for string is factored out.

llvm-svn: 136539
2011-07-29 23:31:56 +00:00
Alexis Hunt fe473ae277 Add two missing members from the extension hash containers. The first is
the type name 'data_type', which is specified by the SGI spec as being
the correct type name for the mapped type. The second is an overload of
insert found in standard containers, taking an iterator as a 'hint'
(which we ignore in the standard containers as well). libstdc++'s
implementation includes these overloads, and they are needed to make
insert_iterator work (which I suspect is the real motivation for
including them in the standard containers).

The motivation for including these overloads of insert and leaving the
mapped_type typedef is to make it easier for clients to migrate to the
standard containers.

llvm-svn: 136538
2011-07-29 23:31:53 +00:00
Howard Hinnant 1dba445e43 http://llvm.org/bugs/show_bug.cgi?id=10469
llvm-svn: 135897
2011-07-24 23:59:50 +00:00
Howard Hinnant ce48a1137d _STD -> _VSTD to avoid macro clash on windows
llvm-svn: 134190
2011-06-30 21:18:19 +00:00
Howard Hinnant 72c5e14203 Qualify calls to addressof with std::. Bug 9106
llvm-svn: 124726
2011-02-02 17:36:20 +00:00
Howard Hinnant 412dbebe1b license change
llvm-svn: 119395
2010-11-16 22:09:02 +00:00
Howard Hinnant fb100021b7 visibility-decoration.
llvm-svn: 114486
2010-09-21 21:28:23 +00:00
Howard Hinnant 7609c9b665 Changed __config to react to all of clang's currently documented has_feature flags, and renamed _LIBCPP_MOVE to _LIBCPP_HAS_NO_RVALUE_REFERENCES to be more consistent with the rest of the libc++'s flags, and with clang's nomenclature.
llvm-svn: 113086
2010-09-04 23:28:19 +00:00
Howard Hinnant b3371f6f49 Fixing whitespace problems
llvm-svn: 111750
2010-08-22 00:02:43 +00:00
Howard Hinnant 5b08a8a432 Wiped out some non-ascii characters that snuck into the copyright.
llvm-svn: 103516
2010-05-11 21:36:01 +00:00
Howard Hinnant 3e519524c1 libcxx initial import
llvm-svn: 103490
2010-05-11 19:42:16 +00:00