-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[NFC][libc++][TZDB] Improves some internals. #84800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-libcxx Author: Mark de Wever (mordante) ChangesRemoves some unneeded overloads in the pimpl class; they implementation could be in the caller. Full diff: https://github.com/llvm/llvm-project/pull/84800.diff 2 Files Affected:
diff --git a/libcxx/src/include/tzdb/tzdb_list_private.h b/libcxx/src/include/tzdb/tzdb_list_private.h
index f43d7d8ea772be..969b2b9f8a9f63 100644
--- a/libcxx/src/include/tzdb/tzdb_list_private.h
+++ b/libcxx/src/include/tzdb/tzdb_list_private.h
@@ -54,14 +54,14 @@ class tzdb_list::__impl {
using const_iterator = tzdb_list::const_iterator;
- const tzdb& front() const noexcept {
+ const tzdb& __front() const noexcept {
#ifndef _LIBCPP_HAS_NO_THREADS
shared_lock __lock{__mutex_};
#endif
return __tzdb_.front();
}
- const_iterator erase_after(const_iterator __p) {
+ const_iterator __erase_after(const_iterator __p) {
#ifndef _LIBCPP_HAS_NO_THREADS
unique_lock __lock{__mutex_};
#endif
@@ -70,20 +70,17 @@ class tzdb_list::__impl {
return __tzdb_.erase_after(__p);
}
- const_iterator begin() const noexcept {
+ const_iterator __begin() const noexcept {
#ifndef _LIBCPP_HAS_NO_THREADS
shared_lock __lock{__mutex_};
#endif
return __tzdb_.begin();
}
- const_iterator end() const noexcept {
+ const_iterator __end() const noexcept {
// forward_list<T>::end does not access the list, so no need to take a lock.
return __tzdb_.end();
}
- const_iterator cbegin() const noexcept { return begin(); }
- const_iterator cend() const noexcept { return end(); }
-
private:
// Loads the tzdbs
// pre: The caller ensures the locking, if needed, is done.
diff --git a/libcxx/src/tzdb_list.cpp b/libcxx/src/tzdb_list.cpp
index d3ee8b58f98bf2..32975e0d40a69e 100644
--- a/libcxx/src/tzdb_list.cpp
+++ b/libcxx/src/tzdb_list.cpp
@@ -19,25 +19,25 @@ namespace chrono {
_LIBCPP_EXPORTED_FROM_ABI tzdb_list::~tzdb_list() { delete __impl_; }
_LIBCPP_NODISCARD_EXT _LIBCPP_EXPORTED_FROM_ABI const tzdb& tzdb_list::front() const noexcept {
- return __impl_->front();
+ return __impl_->__front();
}
_LIBCPP_EXPORTED_FROM_ABI tzdb_list::const_iterator tzdb_list::erase_after(const_iterator __p) {
- return __impl_->erase_after(__p);
+ return __impl_->__erase_after(__p);
}
_LIBCPP_NODISCARD_EXT _LIBCPP_EXPORTED_FROM_ABI tzdb_list::const_iterator tzdb_list::begin() const noexcept {
- return __impl_->begin();
+ return __impl_->__begin();
}
_LIBCPP_NODISCARD_EXT _LIBCPP_EXPORTED_FROM_ABI tzdb_list::const_iterator tzdb_list::end() const noexcept {
- return __impl_->end();
+ return __impl_->__end();
}
_LIBCPP_NODISCARD_EXT _LIBCPP_EXPORTED_FROM_ABI tzdb_list::const_iterator tzdb_list::cbegin() const noexcept {
- return __impl_->cbegin();
+ return __impl_->__begin();
}
_LIBCPP_NODISCARD_EXT _LIBCPP_EXPORTED_FROM_ABI tzdb_list::const_iterator tzdb_list::cend() const noexcept {
- return __impl_->cend();
+ return __impl_->__end();
}
} // namespace chrono
|
libcxx/src/tzdb_list.cpp
Outdated
@@ -19,25 +19,25 @@ namespace chrono { | |||
_LIBCPP_EXPORTED_FROM_ABI tzdb_list::~tzdb_list() { delete __impl_; } | |||
|
|||
_LIBCPP_NODISCARD_EXT _LIBCPP_EXPORTED_FROM_ABI const tzdb& tzdb_list::front() const noexcept { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would make sense to also make these public member functions not part of the ABI (by exporting private names instead) in this patch.
b77a528
to
187ff8a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with my comment.
Removes some unneeded overloads in the pimpl class; they implementation could be in the caller. The pimpl member functions are __uglified.
187ff8a
to
8082a54
Compare
Removes some unneeded overloads in the pimpl class; they implementation could be in the caller.
The pimpl member functions are __uglified.