[libcxx-commits] [libcxx] [libc++][NFC] Make data members of counted_iterator private (PR #70491)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Oct 27 11:28:22 PDT 2023
https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/70491
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.
>From 74d6ce11e431da5e72d8cbbb8a80db65bd1f8b34 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Fri, 27 Oct 2023 14:26:21 -0400
Subject: [PATCH] [libc++][NFC] Make data members of counted_iterator private
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.
---
libcxx/include/__iterator/counted_iterator.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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>;
More information about the libcxx-commits
mailing list