There's a bit of duplication in use of common_input_iterator as noted in
https://reviews.llvm.org/D141216. Lift common_input_iterator into
test_iterators.h.
Details
- Reviewers
philnik huixie90 Mordante - Group Reviewers
Restricted Project - Commits
- rGcf9ee8791e8b: [libc++][test] Move `common_input_iterator` to `test_iterators.h`
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks for the cleanup! LGTM with comment applied and green CI.
libcxx/test/support/test_iterators.h | ||
---|---|---|
700 |
libcxx/test/support/test_iterators.h | ||
---|---|---|
700 | Just switched to using >= 20. Did we decide on using >= always going forward? I thought there was a discussion within the last 6 months or so, but I forget and am used to the old-school way. |
@philnik mind if I land this? CI isn't green yet due to unrelated issues.
- https://reviews.llvm.org/harbormaster/unit/view/5710279/ is fixed with https://reviews.llvm.org/D141284
- https://reviews.llvm.org/harbormaster/unit/view/5710280/ is a separate issue — module map problem?
Given that I've found a small issue I think it would be better to rebase and have a green CI. The second failure is also a problem with includes. I'll fix it myself.
libcxx/test/support/test_iterators.h | ||
---|---|---|
700 | Yes, we decided to use >=. Not sure when exactly it was, but I think was within this release cycle. | |
720 | @huixie90 This is different in the two versions we have. Is std::iter_reference_t<Base> correct here, or should we just use decltype(auto)? |
libcxx/test/support/test_iterators.h | ||
---|---|---|
720 | Thanks for calling this out explicitly. I noticed this and stuck with std::iter_reference_t<Base> rather than decltype(auto) that @CaseyCarter fixed in https://reviews.llvm.org/D141216. I think using iter_reference_t is fine, but I'll let others chime in here. |
Use decltype(auto) in operator* in case the base type is const qualified
libcxx/test/support/test_iterators.h | ||
---|---|---|
720 | Actually, based on the rationale in https://reviews.llvm.org/D141216, it seems the problem is when the template type parameter Base is const-qualified, we'd actually need to use std::iter_const_reference_t and not std::iter_reference_t. Given that, it's easier to just always use decltype(auto) and let the deduction happen for us. But I'm not sure we have a call site or test mandating that behavior, but we should change it to use decltype(auto) AFAICT now. Is that right, @CaseyCarter @huixie90? In any case, I just changed it to use decltype(auto). |