[all-commits] [llvm/llvm-project] 10d4bd: [libc++] Opt `std::*set` out of map key extraction...

George Burgess IV via All-commits all-commits at lists.llvm.org
Wed Sep 9 06:20:07 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 10d4bdf93a82fb290b8c55da6ed19ff54da67296
      https://github.com/llvm/llvm-project/commit/10d4bdf93a82fb290b8c55da6ed19ff54da67296
  Author: George Burgess IV <george.burgess.iv at gmail.com>
  Date:   2026-09-09 (Wed, 09 Sep 2026)

  Changed paths:
    M libcxx/include/__hash_table
    M libcxx/include/__tree
    M libcxx/include/__utility/try_key_extraction.h
    M libcxx/test/std/containers/associative/set/emplace.pass.cpp
    M libcxx/test/std/containers/unord/unord.set/emplace.pass.cpp

  Log Message:
  -----------
  [libc++] Opt `std::*set` out of map key extraction optimization (#220452)

PR #154512 (relanded by #155565) removed `__can_extract_map_key`, which
had a blanket opt-out for `std::*set`s. The new logic does not have that
opt-out, leading to `std::set`s being incorrectly constructed.

The new regression tests demonstrate this, but essentially the idea is:
1. Have `std::set<T> foo;`
2. Call `foo.emplace(some_t,
arg_that_influences_comparisons_or_hashes);`
3. The emplace will internally search using `some_t` as the key, *not*
`T(some_t, arg_that_influences_comparisons_or_hashes);`

This opts out `std::*set` from this optimization to match previous
behavior.

Tests and fix were produced by an LLM. I reviewed them and they seem
reasonable to me, though I don't have a strong background in libc++
testing conventions.

(Credit to Deva S, our partner who tracked this down. Unfortunately I
don't know his GH handle)

Fixes #220451



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list