[libcxx-commits] [libcxx] [NFC][libc++][TZDB] Improves some internals. (PR #84800)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Mar 11 10:35:49 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Mark de Wever (mordante)
<details>
<summary>Changes</summary>
Removes some unneeded overloads in the pimpl class; they implementation could be in the caller.
The pimpl member functions are __uglified.
---
Full diff: https://github.com/llvm/llvm-project/pull/84800.diff
2 Files Affected:
- (modified) libcxx/src/include/tzdb/tzdb_list_private.h (+4-7)
- (modified) libcxx/src/tzdb_list.cpp (+6-6)
``````````diff
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
``````````
</details>
https://github.com/llvm/llvm-project/pull/84800
More information about the libcxx-commits
mailing list