[libcxx-commits] [libcxx] [libc++][NFC] Make data members of counted_iterator private (PR #70491)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Oct 27 11:29:35 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Louis Dionne (ldionne)
<details>
<summary>Changes</summary>
There's no reason for them to be public AFAICT. I came across this while auditing the code bases for places where we'd be using [[no_unique_address]] incorrectly. Since one of these members is marked as [[no_unique_address]], this is an extra reason to keep this private to ensure the member isn't escaped anywhere.
---
Full diff: https://github.com/llvm/llvm-project/pull/70491.diff
1 Files Affected:
- (modified) libcxx/include/__iterator/counted_iterator.h (+1-1)
``````````diff
diff --git a/libcxx/include/__iterator/counted_iterator.h b/libcxx/include/__iterator/counted_iterator.h
index 41b7e57d28c1451..5e82a496c8093bd 100644
--- a/libcxx/include/__iterator/counted_iterator.h
+++ b/libcxx/include/__iterator/counted_iterator.h
@@ -73,10 +73,10 @@ class counted_iterator
, public __counted_iterator_category<_Iter>
, public __counted_iterator_value_type<_Iter>
{
-public:
_LIBCPP_NO_UNIQUE_ADDRESS _Iter __current_ = _Iter();
iter_difference_t<_Iter> __count_ = 0;
+public:
using iterator_type = _Iter;
using difference_type = iter_difference_t<_Iter>;
``````````
</details>
https://github.com/llvm/llvm-project/pull/70491
More information about the libcxx-commits
mailing list