Re: [libcxx] r260431 - Recommit r260012 - Cleanup node-type handling in the unordered containers.

2016-02-17 Thread Evgenii Stepanov via cfe-commits
Thank you!

On Wed, Feb 17, 2016 at 9:23 PM, Eric Fiselier  wrote:
> Hopefully fixed in r261180.
>
> On Sat, Feb 13, 2016 at 2:08 PM, Evgenii Stepanov
>  wrote:
>>
>> Hi,
>>
>> this is my error message:
>>
>> In file included from z.cc:1:
>> /code/build-llvm/bin/../include/c++/v1/ext/hash_map:213:5: warning:
>> Use of the header  is deprecated. Migrate to
>>  [-W#warnings]
>> #   warning Use of the header  is deprecated.  Migrate
>> to 
>> ^
>> /code/build-llvm/bin/../include/c++/v1/ext/hash_map:432:57: error:
>> '__non_const_iterator' is a private member of
>>
>> 'std::__1::__hash_const_iterator> int>, void *> *>'
>> __hash_map_iterator> _HashIterator::__non_const_iterator> __i)
>> ^
>> /code/build-llvm/bin/../include/c++/v1/ext/hash_map:659:16: note: in
>> instantiation of template class
>>
>> '__gnu_cxx::__hash_map_const_iterator> int>, void *> *> >' requested here
>> insert(__u.begin(), __u.end());
>>^
>> z.cc:4:16: note: in instantiation of member function
>> '__gnu_cxx::hash_map> std::__1::equal_to, std::__1::allocator   int, int> > >::hash_map' requested here
>> template class hash_map;
>>^
>> /code/build-llvm/bin/../include/c++/v1/__hash_table:383:39: note:
>> implicitly declared private here
>> typedef __hash_iterator<_NodePtr> __non_const_iterator;
>>   ^
>> 1 warning and 1 error generated.
>>
>>
>> and this is my test case:
>>
>> #include 
>>
>> namespace __gnu_cxx {
>> template class hash_map;
>> }
>>
>>
>> On Sat, Feb 13, 2016 at 12:17 AM, Eric Fiselier  wrote:
>> >> The "hash_map" part of the name means they belong to "",
>> >> and the actual type is defined in that header.
>> >
>> > Woops, Sorry I guess the name is used in both "std::__1::" in
>> > unordered_map
>> > and "__gnu_cxx::" in . My intention in the changes was to
>> > forward declare "std::__1::__hash_map_iterator".
>> >
>> > On Sat, Feb 13, 2016 at 1:11 AM, Eric Fiselier  wrote:
>> >>
>> >> > hash_map still looks broken to me.
>> >>
>> >> Uh oh, Sorry :-S. The original breakage was caused by the removal of a
>> >> typedef "hash_map" used, but I'm sure I fixed that.
>> >>
>> >> > should not they be prefixed with __gnu_cxx:: ?
>> >>
>> >> No, they are in the correct namespace. The "hash_map" part of the name
>> >> means they belong to "", and the actual type is defined
>> >> in
>> >> that header.
>> >>
>> >> Could you give me more information about the breakage your seeing? The
>> >> actual compiler diagnostics if possible? I also committed other sizable
>> >> changes to <__hash_table> in r260513 so that may be related.
>> >>
>> >> Let me know if you need this reverted. If possible I would like to hold
>> >> off, at least until more is known.
>> >>
>> >> /Eric
>> >>
>> >> On Fri, Feb 12, 2016 at 1:31 PM, Evgenii Stepanov
>> >>  wrote:
>> >>>
>> >>> Hi,
>> >>>
>> >>> hash_map still looks broken to me.
>> >>> I don't have a simple reproducer, but these declarations in
>> >>> __hash_table:
>> >>>
>> >>> template  class _LIBCPP_TYPE_VIS_ONLY
>> >>> __hash_map_iterator;
>> >>>  template  class _LIBCPP_TYPE_VIS_ONLY
>> >>> __hash_map_const_iterator;
>> >>>
>> >>> should not they be prefixed with __gnu_cxx:: ?
>> >>>
>> >>> Clang says that std::__1::__hash_const_iterator and
>> >>> __gnu_cxx::__hash_map_const_iterator are not friends and
>> >>> __non_const_iterator at ext/hash_map:432 is private.
>> >>>
>> >>>
>> >>> On Wed, Feb 10, 2016 at 12:46 PM, Eric Fiselier via cfe-commits
>> >>>  wrote:
>> >>> > Author: ericwf
>> >>> > Date: Wed Feb 10 14:46:23 2016
>> >>> > New Revision: 260431
>> >>> >
>> >>> > URL: http://llvm.org/viewvc/llvm-project?rev=260431=rev
>> >>> > Log:
>> >>> > Recommit r260012 - Cleanup node-type handling in the unordered
>> >>> > containers.
>> >>> >
>> >>> > This time I kept  working!
>> >>> >
>> >>> > This patch is the first in a series of patches that's meant to
>> >>> > better
>> >>> > support unordered_map. unordered_map has a special "value_type" that
>> >>> > differs from pair. In order to meet the
>> >>> > EmplaceConstructible
>> >>> > and CopyInsertable requirements we need to teach __hash_table about
>> >>> > this
>> >>> > special value_type.
>> >>> >
>> >>> > This patch creates a "__hash_node_types" traits class that contains
>> >>> > all of the typedefs needed by the unordered containers and it's
>> >>> > iterators.
>> >>> > These typedefs include ones for each node type and  node pointer
>> >>> > type,
>> >>> > as well as special typedefs for "unordered_map"'s value type.
>> >>> >
>> >>> > As a result of this change all of the unordered containers 

Re: [libcxx] r260431 - Recommit r260012 - Cleanup node-type handling in the unordered containers.

2016-02-17 Thread Eric Fiselier via cfe-commits
Hopefully fixed in r261180.

On Sat, Feb 13, 2016 at 2:08 PM, Evgenii Stepanov  wrote:

> Hi,
>
> this is my error message:
>
> In file included from z.cc:1:
> /code/build-llvm/bin/../include/c++/v1/ext/hash_map:213:5: warning:
> Use of the header  is deprecated. Migrate to
>  [-W#warnings]
> #   warning Use of the header  is deprecated.  Migrate
> to 
> ^
> /code/build-llvm/bin/../include/c++/v1/ext/hash_map:432:57: error:
> '__non_const_iterator' is a private member of
>
> 'std::__1::__hash_const_iterator int>, void *> *>'
> __hash_map_iterator _HashIterator::__non_const_iterator> __i)
> ^
> /code/build-llvm/bin/../include/c++/v1/ext/hash_map:659:16: note: in
> instantiation of template class
>
> '__gnu_cxx::__hash_map_const_iterator int>, void *> *> >' requested here
> insert(__u.begin(), __u.end());
>^
> z.cc:4:16: note: in instantiation of member function
> '__gnu_cxx::hash_map std::__1::equal_to, std::__1::allocator > >::hash_map' requested here
> template class hash_map;
>^
> /code/build-llvm/bin/../include/c++/v1/__hash_table:383:39: note:
> implicitly declared private here
> typedef __hash_iterator<_NodePtr> __non_const_iterator;
>   ^
> 1 warning and 1 error generated.
>
>
> and this is my test case:
>
> #include 
>
> namespace __gnu_cxx {
> template class hash_map;
> }
>
>
> On Sat, Feb 13, 2016 at 12:17 AM, Eric Fiselier  wrote:
> >> The "hash_map" part of the name means they belong to "",
> >> and the actual type is defined in that header.
> >
> > Woops, Sorry I guess the name is used in both "std::__1::" in
> unordered_map
> > and "__gnu_cxx::" in . My intention in the changes was to
> > forward declare "std::__1::__hash_map_iterator".
> >
> > On Sat, Feb 13, 2016 at 1:11 AM, Eric Fiselier  wrote:
> >>
> >> > hash_map still looks broken to me.
> >>
> >> Uh oh, Sorry :-S. The original breakage was caused by the removal of a
> >> typedef "hash_map" used, but I'm sure I fixed that.
> >>
> >> > should not they be prefixed with __gnu_cxx:: ?
> >>
> >> No, they are in the correct namespace. The "hash_map" part of the name
> >> means they belong to "", and the actual type is defined
> in
> >> that header.
> >>
> >> Could you give me more information about the breakage your seeing? The
> >> actual compiler diagnostics if possible? I also committed other sizable
> >> changes to <__hash_table> in r260513 so that may be related.
> >>
> >> Let me know if you need this reverted. If possible I would like to hold
> >> off, at least until more is known.
> >>
> >> /Eric
> >>
> >> On Fri, Feb 12, 2016 at 1:31 PM, Evgenii Stepanov
> >>  wrote:
> >>>
> >>> Hi,
> >>>
> >>> hash_map still looks broken to me.
> >>> I don't have a simple reproducer, but these declarations in
> __hash_table:
> >>>
> >>> template  class _LIBCPP_TYPE_VIS_ONLY
> >>> __hash_map_iterator;
> >>>  template  class _LIBCPP_TYPE_VIS_ONLY
> >>> __hash_map_const_iterator;
> >>>
> >>> should not they be prefixed with __gnu_cxx:: ?
> >>>
> >>> Clang says that std::__1::__hash_const_iterator and
> >>> __gnu_cxx::__hash_map_const_iterator are not friends and
> >>> __non_const_iterator at ext/hash_map:432 is private.
> >>>
> >>>
> >>> On Wed, Feb 10, 2016 at 12:46 PM, Eric Fiselier via cfe-commits
> >>>  wrote:
> >>> > Author: ericwf
> >>> > Date: Wed Feb 10 14:46:23 2016
> >>> > New Revision: 260431
> >>> >
> >>> > URL: http://llvm.org/viewvc/llvm-project?rev=260431=rev
> >>> > Log:
> >>> > Recommit r260012 - Cleanup node-type handling in the unordered
> >>> > containers.
> >>> >
> >>> > This time I kept  working!
> >>> >
> >>> > This patch is the first in a series of patches that's meant to better
> >>> > support unordered_map. unordered_map has a special "value_type" that
> >>> > differs from pair. In order to meet the
> >>> > EmplaceConstructible
> >>> > and CopyInsertable requirements we need to teach __hash_table about
> >>> > this
> >>> > special value_type.
> >>> >
> >>> > This patch creates a "__hash_node_types" traits class that contains
> >>> > all of the typedefs needed by the unordered containers and it's
> >>> > iterators.
> >>> > These typedefs include ones for each node type and  node pointer
> type,
> >>> > as well as special typedefs for "unordered_map"'s value type.
> >>> >
> >>> > As a result of this change all of the unordered containers now all
> >>> > support
> >>> > incomplete types.
> >>> >
> >>> > As a drive-by fix I changed the difference_type in __hash_table to
> >>> > always
> >>> > be ptrdiff_t. There is a corresponding change to size_type but it
> >>> > cannot
> >>> > 

Re: [libcxx] r260431 - Recommit r260012 - Cleanup node-type handling in the unordered containers.

2016-02-13 Thread Eric Fiselier via cfe-commits
> The "hash_map" part of the name means they belong to "",
and the actual type is defined in that header.

Woops, Sorry I guess the name is used in both "std::__1::" in unordered_map
and "__gnu_cxx::" in . My intention in the changes was to
forward declare "std::__1::__hash_map_iterator".

On Sat, Feb 13, 2016 at 1:11 AM, Eric Fiselier  wrote:

> > hash_map still looks broken to me.
>
> Uh oh, Sorry :-S. The original breakage was caused by the removal of a
> typedef "hash_map" used, but I'm sure I fixed that.
>
> > should not they be prefixed with __gnu_cxx:: ?
>
> No, they are in the correct namespace. The "hash_map" part of the name
> means they belong to "", and the actual type is defined in
> that header.
>
> Could you give me more information about the breakage your seeing? The
> actual compiler diagnostics if possible? I also committed other sizable
> changes to <__hash_table> in r260513 so that may be related.
>
> Let me know if you need this reverted. If possible I would like to hold
> off, at least until more is known.
>
> /Eric
>
> On Fri, Feb 12, 2016 at 1:31 PM, Evgenii Stepanov <
> eugeni.stepa...@gmail.com> wrote:
>
>> Hi,
>>
>> hash_map still looks broken to me.
>> I don't have a simple reproducer, but these declarations in __hash_table:
>>
>> template  class _LIBCPP_TYPE_VIS_ONLY
>> __hash_map_iterator;
>>  template  class _LIBCPP_TYPE_VIS_ONLY
>> __hash_map_const_iterator;
>>
>> should not they be prefixed with __gnu_cxx:: ?
>>
>> Clang says that std::__1::__hash_const_iterator and
>> __gnu_cxx::__hash_map_const_iterator are not friends and
>> __non_const_iterator at ext/hash_map:432 is private.
>>
>>
>> On Wed, Feb 10, 2016 at 12:46 PM, Eric Fiselier via cfe-commits
>>  wrote:
>> > Author: ericwf
>> > Date: Wed Feb 10 14:46:23 2016
>> > New Revision: 260431
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=260431=rev
>> > Log:
>> > Recommit r260012 - Cleanup node-type handling in the unordered
>> containers.
>> >
>> > This time I kept  working!
>> >
>> > This patch is the first in a series of patches that's meant to better
>> > support unordered_map. unordered_map has a special "value_type" that
>> > differs from pair. In order to meet the
>> EmplaceConstructible
>> > and CopyInsertable requirements we need to teach __hash_table about this
>> > special value_type.
>> >
>> > This patch creates a "__hash_node_types" traits class that contains
>> > all of the typedefs needed by the unordered containers and it's
>> iterators.
>> > These typedefs include ones for each node type and  node pointer type,
>> > as well as special typedefs for "unordered_map"'s value type.
>> >
>> > As a result of this change all of the unordered containers now all
>> support
>> > incomplete types.
>> >
>> > As a drive-by fix I changed the difference_type in __hash_table to
>> always
>> > be ptrdiff_t. There is a corresponding change to size_type but it cannot
>> > take affect until an ABI break.
>> >
>> > This patch will be followed up shortly with fixes for various
>> unordered_map
>> > bugs and problems.
>> >
>> > Added:
>> > libcxx/trunk/test/libcxx/containers/unord/key_value_traits.pass.cpp
>> >
>>  libcxx/trunk/test/std/containers/unord/iterator_difference_type.pass.cpp
>> >
>>  libcxx/trunk/test/std/containers/unord/unord.map/incomplete_type.pass.cpp
>> >
>>  libcxx/trunk/test/std/containers/unord/unord.multimap/incomplete.pass.cpp
>> >
>>  libcxx/trunk/test/std/containers/unord/unord.multiset/incomplete.pass.cpp
>> > libcxx/trunk/test/std/containers/unord/unord.set/incomplete.pass.cpp
>> > Modified:
>> > libcxx/trunk/include/__config
>> > libcxx/trunk/include/__hash_table
>> > libcxx/trunk/include/ext/hash_map
>> > libcxx/trunk/include/unordered_map
>> >
>> > Modified: libcxx/trunk/include/__config
>> > URL:
>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=260431=260430=260431=diff
>> >
>> ==
>> > --- libcxx/trunk/include/__config (original)
>> > +++ libcxx/trunk/include/__config Wed Feb 10 14:46:23 2016
>> > @@ -42,6 +42,7 @@
>> >  // Fix undefined behavior in how std::list stores it's linked nodes.
>> >  #define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB
>> >  #define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
>> > +#define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
>> >  #endif
>> >
>> >  #define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
>> >
>> > Modified: libcxx/trunk/include/__hash_table
>> > URL:
>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__hash_table?rev=260431=260430=260431=diff
>> >
>> ==
>> > --- libcxx/trunk/include/__hash_table (original)
>> > +++ libcxx/trunk/include/__hash_table Wed Feb 10 14:46:23 2016
>> > @@ -17,6 +17,7 @@
>> >  #include 
>> >  #include 
>> >  #include 
>> > +#include 
>> >
>> >  #include 

Re: [libcxx] r260431 - Recommit r260012 - Cleanup node-type handling in the unordered containers.

2016-02-13 Thread Eric Fiselier via cfe-commits
> hash_map still looks broken to me.

Uh oh, Sorry :-S. The original breakage was caused by the removal of a
typedef "hash_map" used, but I'm sure I fixed that.

> should not they be prefixed with __gnu_cxx:: ?

No, they are in the correct namespace. The "hash_map" part of the name
means they belong to "", and the actual type is defined in
that header.

Could you give me more information about the breakage your seeing? The
actual compiler diagnostics if possible? I also committed other sizable
changes to <__hash_table> in r260513 so that may be related.

Let me know if you need this reverted. If possible I would like to hold
off, at least until more is known.

/Eric

On Fri, Feb 12, 2016 at 1:31 PM, Evgenii Stepanov  wrote:

> Hi,
>
> hash_map still looks broken to me.
> I don't have a simple reproducer, but these declarations in __hash_table:
>
> template  class _LIBCPP_TYPE_VIS_ONLY
> __hash_map_iterator;
>  template  class _LIBCPP_TYPE_VIS_ONLY
> __hash_map_const_iterator;
>
> should not they be prefixed with __gnu_cxx:: ?
>
> Clang says that std::__1::__hash_const_iterator and
> __gnu_cxx::__hash_map_const_iterator are not friends and
> __non_const_iterator at ext/hash_map:432 is private.
>
>
> On Wed, Feb 10, 2016 at 12:46 PM, Eric Fiselier via cfe-commits
>  wrote:
> > Author: ericwf
> > Date: Wed Feb 10 14:46:23 2016
> > New Revision: 260431
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=260431=rev
> > Log:
> > Recommit r260012 - Cleanup node-type handling in the unordered
> containers.
> >
> > This time I kept  working!
> >
> > This patch is the first in a series of patches that's meant to better
> > support unordered_map. unordered_map has a special "value_type" that
> > differs from pair. In order to meet the
> EmplaceConstructible
> > and CopyInsertable requirements we need to teach __hash_table about this
> > special value_type.
> >
> > This patch creates a "__hash_node_types" traits class that contains
> > all of the typedefs needed by the unordered containers and it's
> iterators.
> > These typedefs include ones for each node type and  node pointer type,
> > as well as special typedefs for "unordered_map"'s value type.
> >
> > As a result of this change all of the unordered containers now all
> support
> > incomplete types.
> >
> > As a drive-by fix I changed the difference_type in __hash_table to always
> > be ptrdiff_t. There is a corresponding change to size_type but it cannot
> > take affect until an ABI break.
> >
> > This patch will be followed up shortly with fixes for various
> unordered_map
> > bugs and problems.
> >
> > Added:
> > libcxx/trunk/test/libcxx/containers/unord/key_value_traits.pass.cpp
> >
>  libcxx/trunk/test/std/containers/unord/iterator_difference_type.pass.cpp
> >
>  libcxx/trunk/test/std/containers/unord/unord.map/incomplete_type.pass.cpp
> >
>  libcxx/trunk/test/std/containers/unord/unord.multimap/incomplete.pass.cpp
> >
>  libcxx/trunk/test/std/containers/unord/unord.multiset/incomplete.pass.cpp
> > libcxx/trunk/test/std/containers/unord/unord.set/incomplete.pass.cpp
> > Modified:
> > libcxx/trunk/include/__config
> > libcxx/trunk/include/__hash_table
> > libcxx/trunk/include/ext/hash_map
> > libcxx/trunk/include/unordered_map
> >
> > Modified: libcxx/trunk/include/__config
> > URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=260431=260430=260431=diff
> >
> ==
> > --- libcxx/trunk/include/__config (original)
> > +++ libcxx/trunk/include/__config Wed Feb 10 14:46:23 2016
> > @@ -42,6 +42,7 @@
> >  // Fix undefined behavior in how std::list stores it's linked nodes.
> >  #define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB
> >  #define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
> > +#define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
> >  #endif
> >
> >  #define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
> >
> > Modified: libcxx/trunk/include/__hash_table
> > URL:
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__hash_table?rev=260431=260430=260431=diff
> >
> ==
> > --- libcxx/trunk/include/__hash_table (original)
> > +++ libcxx/trunk/include/__hash_table Wed Feb 10 14:46:23 2016
> > @@ -17,6 +17,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >
> >  #include <__undef_min_max>
> >  #include <__undef___deallocate>
> > @@ -49,10 +50,10 @@ struct __hash_node
> >   typename __rebind_pointer<_VoidPtr, __hash_node<_Tp,
> _VoidPtr> >::type
> >   >
> >  {
> > -typedef _Tp value_type;
> > +typedef _Tp __node_value_type;
> >
> >  size_t __hash_;
> > -value_type __value_;
> > +__node_value_type __value_;
> >  };
> >
> >  inline _LIBCPP_INLINE_VISIBILITY
> > @@ -77,23 +78,126 @@ __next_hash_pow2(size_t __n)
> >  }
> >

Re: [libcxx] r260431 - Recommit r260012 - Cleanup node-type handling in the unordered containers.

2016-02-13 Thread Evgenii Stepanov via cfe-commits
Hi,

this is my error message:

In file included from z.cc:1:
/code/build-llvm/bin/../include/c++/v1/ext/hash_map:213:5: warning:
Use of the header  is deprecated. Migrate to
 [-W#warnings]
#   warning Use of the header  is deprecated.  Migrate
to 
^
/code/build-llvm/bin/../include/c++/v1/ext/hash_map:432:57: error:
'__non_const_iterator' is a private member of
  'std::__1::__hash_const_iterator, void *> *>'
__hash_map_iterator __i)
^
/code/build-llvm/bin/../include/c++/v1/ext/hash_map:659:16: note: in
instantiation of template class
  
'__gnu_cxx::__hash_map_const_iterator, void *> *> >' requested here
insert(__u.begin(), __u.end());
   ^
z.cc:4:16: note: in instantiation of member function
'__gnu_cxx::hash_map >::hash_map' requested here
template class hash_map;
   ^
/code/build-llvm/bin/../include/c++/v1/__hash_table:383:39: note:
implicitly declared private here
typedef __hash_iterator<_NodePtr> __non_const_iterator;
  ^
1 warning and 1 error generated.


and this is my test case:

#include 

namespace __gnu_cxx {
template class hash_map;
}


On Sat, Feb 13, 2016 at 12:17 AM, Eric Fiselier  wrote:
>> The "hash_map" part of the name means they belong to "",
>> and the actual type is defined in that header.
>
> Woops, Sorry I guess the name is used in both "std::__1::" in unordered_map
> and "__gnu_cxx::" in . My intention in the changes was to
> forward declare "std::__1::__hash_map_iterator".
>
> On Sat, Feb 13, 2016 at 1:11 AM, Eric Fiselier  wrote:
>>
>> > hash_map still looks broken to me.
>>
>> Uh oh, Sorry :-S. The original breakage was caused by the removal of a
>> typedef "hash_map" used, but I'm sure I fixed that.
>>
>> > should not they be prefixed with __gnu_cxx:: ?
>>
>> No, they are in the correct namespace. The "hash_map" part of the name
>> means they belong to "", and the actual type is defined in
>> that header.
>>
>> Could you give me more information about the breakage your seeing? The
>> actual compiler diagnostics if possible? I also committed other sizable
>> changes to <__hash_table> in r260513 so that may be related.
>>
>> Let me know if you need this reverted. If possible I would like to hold
>> off, at least until more is known.
>>
>> /Eric
>>
>> On Fri, Feb 12, 2016 at 1:31 PM, Evgenii Stepanov
>>  wrote:
>>>
>>> Hi,
>>>
>>> hash_map still looks broken to me.
>>> I don't have a simple reproducer, but these declarations in __hash_table:
>>>
>>> template  class _LIBCPP_TYPE_VIS_ONLY
>>> __hash_map_iterator;
>>>  template  class _LIBCPP_TYPE_VIS_ONLY
>>> __hash_map_const_iterator;
>>>
>>> should not they be prefixed with __gnu_cxx:: ?
>>>
>>> Clang says that std::__1::__hash_const_iterator and
>>> __gnu_cxx::__hash_map_const_iterator are not friends and
>>> __non_const_iterator at ext/hash_map:432 is private.
>>>
>>>
>>> On Wed, Feb 10, 2016 at 12:46 PM, Eric Fiselier via cfe-commits
>>>  wrote:
>>> > Author: ericwf
>>> > Date: Wed Feb 10 14:46:23 2016
>>> > New Revision: 260431
>>> >
>>> > URL: http://llvm.org/viewvc/llvm-project?rev=260431=rev
>>> > Log:
>>> > Recommit r260012 - Cleanup node-type handling in the unordered
>>> > containers.
>>> >
>>> > This time I kept  working!
>>> >
>>> > This patch is the first in a series of patches that's meant to better
>>> > support unordered_map. unordered_map has a special "value_type" that
>>> > differs from pair. In order to meet the
>>> > EmplaceConstructible
>>> > and CopyInsertable requirements we need to teach __hash_table about
>>> > this
>>> > special value_type.
>>> >
>>> > This patch creates a "__hash_node_types" traits class that contains
>>> > all of the typedefs needed by the unordered containers and it's
>>> > iterators.
>>> > These typedefs include ones for each node type and  node pointer type,
>>> > as well as special typedefs for "unordered_map"'s value type.
>>> >
>>> > As a result of this change all of the unordered containers now all
>>> > support
>>> > incomplete types.
>>> >
>>> > As a drive-by fix I changed the difference_type in __hash_table to
>>> > always
>>> > be ptrdiff_t. There is a corresponding change to size_type but it
>>> > cannot
>>> > take affect until an ABI break.
>>> >
>>> > This patch will be followed up shortly with fixes for various
>>> > unordered_map
>>> > bugs and problems.
>>> >
>>> > Added:
>>> > libcxx/trunk/test/libcxx/containers/unord/key_value_traits.pass.cpp
>>> >
>>> > libcxx/trunk/test/std/containers/unord/iterator_difference_type.pass.cpp
>>> >
>>> > libcxx/trunk/test/std/containers/unord/unord.map/incomplete_type.pass.cpp

Re: [libcxx] r260431 - Recommit r260012 - Cleanup node-type handling in the unordered containers.

2016-02-12 Thread Evgenii Stepanov via cfe-commits
Hi,

hash_map still looks broken to me.
I don't have a simple reproducer, but these declarations in __hash_table:

template  class _LIBCPP_TYPE_VIS_ONLY __hash_map_iterator;
 template  class _LIBCPP_TYPE_VIS_ONLY
__hash_map_const_iterator;

should not they be prefixed with __gnu_cxx:: ?

Clang says that std::__1::__hash_const_iterator and
__gnu_cxx::__hash_map_const_iterator are not friends and
__non_const_iterator at ext/hash_map:432 is private.


On Wed, Feb 10, 2016 at 12:46 PM, Eric Fiselier via cfe-commits
 wrote:
> Author: ericwf
> Date: Wed Feb 10 14:46:23 2016
> New Revision: 260431
>
> URL: http://llvm.org/viewvc/llvm-project?rev=260431=rev
> Log:
> Recommit r260012 - Cleanup node-type handling in the unordered containers.
>
> This time I kept  working!
>
> This patch is the first in a series of patches that's meant to better
> support unordered_map. unordered_map has a special "value_type" that
> differs from pair. In order to meet the EmplaceConstructible
> and CopyInsertable requirements we need to teach __hash_table about this
> special value_type.
>
> This patch creates a "__hash_node_types" traits class that contains
> all of the typedefs needed by the unordered containers and it's iterators.
> These typedefs include ones for each node type and  node pointer type,
> as well as special typedefs for "unordered_map"'s value type.
>
> As a result of this change all of the unordered containers now all support
> incomplete types.
>
> As a drive-by fix I changed the difference_type in __hash_table to always
> be ptrdiff_t. There is a corresponding change to size_type but it cannot
> take affect until an ABI break.
>
> This patch will be followed up shortly with fixes for various unordered_map
> bugs and problems.
>
> Added:
> libcxx/trunk/test/libcxx/containers/unord/key_value_traits.pass.cpp
> libcxx/trunk/test/std/containers/unord/iterator_difference_type.pass.cpp
> libcxx/trunk/test/std/containers/unord/unord.map/incomplete_type.pass.cpp
> libcxx/trunk/test/std/containers/unord/unord.multimap/incomplete.pass.cpp
> libcxx/trunk/test/std/containers/unord/unord.multiset/incomplete.pass.cpp
> libcxx/trunk/test/std/containers/unord/unord.set/incomplete.pass.cpp
> Modified:
> libcxx/trunk/include/__config
> libcxx/trunk/include/__hash_table
> libcxx/trunk/include/ext/hash_map
> libcxx/trunk/include/unordered_map
>
> Modified: libcxx/trunk/include/__config
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=260431=260430=260431=diff
> ==
> --- libcxx/trunk/include/__config (original)
> +++ libcxx/trunk/include/__config Wed Feb 10 14:46:23 2016
> @@ -42,6 +42,7 @@
>  // Fix undefined behavior in how std::list stores it's linked nodes.
>  #define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB
>  #define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
> +#define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
>  #endif
>
>  #define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
>
> Modified: libcxx/trunk/include/__hash_table
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__hash_table?rev=260431=260430=260431=diff
> ==
> --- libcxx/trunk/include/__hash_table (original)
> +++ libcxx/trunk/include/__hash_table Wed Feb 10 14:46:23 2016
> @@ -17,6 +17,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #include <__undef_min_max>
>  #include <__undef___deallocate>
> @@ -49,10 +50,10 @@ struct __hash_node
>   typename __rebind_pointer<_VoidPtr, __hash_node<_Tp, 
> _VoidPtr> >::type
>   >
>  {
> -typedef _Tp value_type;
> +typedef _Tp __node_value_type;
>
>  size_t __hash_;
> -value_type __value_;
> +__node_value_type __value_;
>  };
>
>  inline _LIBCPP_INLINE_VISIBILITY
> @@ -77,23 +78,126 @@ __next_hash_pow2(size_t __n)
>  }
>
>  template  class 
> __hash_table;
> +
> +template   class _LIBCPP_TYPE_VIS_ONLY __hash_iterator;
>  template  class _LIBCPP_TYPE_VIS_ONLY 
> __hash_const_iterator;
> +template   class _LIBCPP_TYPE_VIS_ONLY 
> __hash_local_iterator;
> +template  class _LIBCPP_TYPE_VIS_ONLY 
> __hash_const_local_iterator;
>  template  class _LIBCPP_TYPE_VIS_ONLY 
> __hash_map_iterator;
>  template  class _LIBCPP_TYPE_VIS_ONLY 
> __hash_map_const_iterator;
>
> +#if __cplusplus >= 201103L
> +template 
> +union __hash_value_type;
> +#else
> +template 
> +struct __hash_value_type;
> +#endif
> +
> +template 
> +struct __key_value_types {
> +  static_assert(!is_reference<_Tp>::value && !is_const<_Tp>::value, "");
> +  typedef _Tp key_type;
> +  typedef _Tp __node_value_type;
> +  typedef _Tp __container_value_type;
> +  static const bool __is_map = false;
> +};
> +
> +template 
> +struct __key_value_types<__hash_value_type<_Key, _Tp> > {
> +  typedef _Key   

[libcxx] r260431 - Recommit r260012 - Cleanup node-type handling in the unordered containers.

2016-02-10 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Wed Feb 10 14:46:23 2016
New Revision: 260431

URL: http://llvm.org/viewvc/llvm-project?rev=260431=rev
Log:
Recommit r260012 - Cleanup node-type handling in the unordered containers.

This time I kept  working!

This patch is the first in a series of patches that's meant to better
support unordered_map. unordered_map has a special "value_type" that
differs from pair. In order to meet the EmplaceConstructible
and CopyInsertable requirements we need to teach __hash_table about this
special value_type.

This patch creates a "__hash_node_types" traits class that contains
all of the typedefs needed by the unordered containers and it's iterators.
These typedefs include ones for each node type and  node pointer type,
as well as special typedefs for "unordered_map"'s value type.

As a result of this change all of the unordered containers now all support
incomplete types.

As a drive-by fix I changed the difference_type in __hash_table to always
be ptrdiff_t. There is a corresponding change to size_type but it cannot
take affect until an ABI break.

This patch will be followed up shortly with fixes for various unordered_map
bugs and problems.

Added:
libcxx/trunk/test/libcxx/containers/unord/key_value_traits.pass.cpp
libcxx/trunk/test/std/containers/unord/iterator_difference_type.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.map/incomplete_type.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.multimap/incomplete.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.multiset/incomplete.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.set/incomplete.pass.cpp
Modified:
libcxx/trunk/include/__config
libcxx/trunk/include/__hash_table
libcxx/trunk/include/ext/hash_map
libcxx/trunk/include/unordered_map

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=260431=260430=260431=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Wed Feb 10 14:46:23 2016
@@ -42,6 +42,7 @@
 // Fix undefined behavior in how std::list stores it's linked nodes.
 #define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB
 #define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
+#define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
 #endif
 
 #define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y

Modified: libcxx/trunk/include/__hash_table
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__hash_table?rev=260431=260430=260431=diff
==
--- libcxx/trunk/include/__hash_table (original)
+++ libcxx/trunk/include/__hash_table Wed Feb 10 14:46:23 2016
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include <__undef_min_max>
 #include <__undef___deallocate>
@@ -49,10 +50,10 @@ struct __hash_node
  typename __rebind_pointer<_VoidPtr, __hash_node<_Tp, 
_VoidPtr> >::type
  >
 {
-typedef _Tp value_type;
+typedef _Tp __node_value_type;
 
 size_t __hash_;
-value_type __value_;
+__node_value_type __value_;
 };
 
 inline _LIBCPP_INLINE_VISIBILITY
@@ -77,23 +78,126 @@ __next_hash_pow2(size_t __n)
 }
 
 template  class 
__hash_table;
+
+template   class _LIBCPP_TYPE_VIS_ONLY __hash_iterator;
 template  class _LIBCPP_TYPE_VIS_ONLY 
__hash_const_iterator;
+template   class _LIBCPP_TYPE_VIS_ONLY 
__hash_local_iterator;
+template  class _LIBCPP_TYPE_VIS_ONLY 
__hash_const_local_iterator;
 template  class _LIBCPP_TYPE_VIS_ONLY __hash_map_iterator;
 template  class _LIBCPP_TYPE_VIS_ONLY 
__hash_map_const_iterator;
 
+#if __cplusplus >= 201103L
+template 
+union __hash_value_type;
+#else
+template 
+struct __hash_value_type;
+#endif
+
+template 
+struct __key_value_types {
+  static_assert(!is_reference<_Tp>::value && !is_const<_Tp>::value, "");
+  typedef _Tp key_type;
+  typedef _Tp __node_value_type;
+  typedef _Tp __container_value_type;
+  static const bool __is_map = false;
+};
+
+template 
+struct __key_value_types<__hash_value_type<_Key, _Tp> > {
+  typedef _Key key_type;
+  typedef _Tp  mapped_type;
+  typedef __hash_value_type<_Key, _Tp> __node_value_type;
+  typedef pair__container_value_type;
+  typedef __container_value_type   __map_value_type;
+  static const bool __is_map = true;
+};
+
+template ,
+  bool = _KVTypes::__is_map>
+struct __map_pointer_types {};
+
+template 
+struct __map_pointer_types<_Tp, _AllocPtr, _KVTypes, true> {
+  typedef typename _KVTypes::__map_value_type   _Mv;
+  typedef typename __rebind_pointer<_AllocPtr, _Mv>::type
+   
__map_value_type_pointer;
+  typedef typename __rebind_pointer<_AllocPtr, const _Mv>::type
+