[clang] [LifetimeSafety] Avoid adding already present items in sets/maps (PR #159582)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 19 07:42:19 PDT 2025


usx95 wrote:

> Ugh, I wonder if this is unintentional and we should change the implementation of these data structures. I also find this behavior very surprising. 

I can try changing the data structure. Let me do that in a separate PR. It would need an extra Value comparison which needs to be done [while inserting the element](https://github.com/llvm/llvm-project/blob/e2467cbfa8fdc440debac1cfb930ee476f3d5e42/llvm/include/llvm/ADT/ImmutableSet.h#L542) and this could be a slight concern for other users. Let me give it a try.

https://github.com/llvm/llvm-project/pull/159582


More information about the cfe-commits mailing list