This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Remove workarounds for missing rvalue references
ClosedPublic

Authored by ldionne on Jul 30 2020, 6:46 AM.

Details

Reviewers
EricWF
Group Reviewers
Restricted Project
Commits
rG8d4860aa9ee7: [libc++] Remove workarounds for missing rvalue references
Summary

We don't support GCC in C++03 mode, and Clang provides rvalue references
even in C++03 mode. So there's effectively no supported compiler that
doesn't support rvalue references.

Diff Detail

Event Timeline

ldionne created this revision.Jul 30 2020, 6:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 30 2020, 6:46 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne requested review of this revision.Jul 30 2020, 6:46 AM
mclow.lists added inline comments.
libcxx/include/__hash_table
2565

The comment here (and in other places) is now incorrect.

ldionne added inline comments.Jul 30 2020, 6:56 AM
libcxx/include/__hash_table
2565

Indeed, good catch. Do you agree we could just return __h; and let the compiler RVO? I think that would be correct for all places where this comment appears.

curdeius added inline comments.
libcxx/include/__hash_table
2579

The parentheses seem unnecessary here (there would be a difference only if you had decltype(auto) return type. And they hinder the reading.

ldionne updated this revision to Diff 281948.Jul 30 2020, 8:54 AM

Address comments by reviewers and fix tests in C++03 mode

ldionne marked 2 inline comments as done.Jul 30 2020, 8:54 AM

Not sure if this is the right patch or if it would be better as a follow-up, but there are a lot of places (vector, unique_ptr, valarray, etc.) where rvalues (or in the case of unique_ptr, lvalue references) are gated on _LIBCPP_CXX03_LANG rather than _LIBCPP_HAS_NO_RVALUE_REFERENCES. We should probably try to remove those workarounds as well.

Not sure if this is the right patch or if it would be better as a follow-up, but there are a lot of places (vector, unique_ptr, valarray, etc.) where rvalues (or in the case of unique_ptr, lvalue references) are gated on _LIBCPP_CXX03_LANG rather than _LIBCPP_HAS_NO_RVALUE_REFERENCES. We should probably try to remove those workarounds as well.

I fully agree. I was trying to get rid of _LIBCPP_HAS_NO_RVALUE_REFERENCES specifically.

EricWF accepted this revision.Aug 12 2020, 8:40 AM
This revision is now accepted and ready to land.Aug 12 2020, 8:40 AM
This revision was landed with ongoing or failed builds.Aug 12 2020, 9:04 AM
This revision was automatically updated to reflect the committed changes.