[llvm] [ADT] Fix llvm::concat_iterator for `ValueT == common_base_class *` (PR #144744)
Javier Lopez-Gomez via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 16 07:36:00 PDT 2025
jalopezg-git wrote:
Apologies for coming back to this w/ almost a 3-month delay :sweat_smile:; it has been quite hectic due to work in a different project.
@kuhar `handle_type` was a major cause of headaches here; therefore, I first simplified `lllvm::concat_iterator` to get rid of it. IMHO, the result is simpler / more maintainable. See commit https://github.com/llvm/llvm-project/pull/144744/commits/cd1127c3f7d7b3f7a2d30cb7fa55f4249dcde803.
> I think the two pieces of feedback in [#144744 (comment)](https://github.com/llvm/llvm-project/pull/144744#discussion_r2159675066) haven't been addressed yet:
>
> 1. I think we should test whether the values we iterate over are references to elements or not
>
Tests have been updated; in particular, PTAL at https://github.com/llvm/llvm-project/pull/144744/files#diff-3ec26250dd1ddfd2682b4abed65da0d8cbb509991fc1a7a3795bb29389e3da6cR548 and https://github.com/llvm/llvm-project/pull/144744/files#diff-3ec26250dd1ddfd2682b4abed65da0d8cbb509991fc1a7a3795bb29389e3da6cR569.
> 2. For containers of the same pointer type as in `concat<T *>`, I think we should keep existing behavior and allow for modification
In case all `IterTs...` yield the same value type as `ValueT` (see https://github.com/llvm/llvm-project/pull/144744/files#diff-d6563ab6a854637e8bc9e97fe718cd19dda63da0321091e9f0bf71ecb20d8003R999), `reference_type` is a reference type and allows for container modification.
See test at https://github.com/llvm/llvm-project/pull/144744/files#diff-3ec26250dd1ddfd2682b4abed65da0d8cbb509991fc1a7a3795bb29389e3da6cR550.
https://github.com/llvm/llvm-project/pull/144744
More information about the llvm-commits
mailing list