[all-commits] [llvm/llvm-project] c2df14: [StringMap] Add remove_if and use it for erase-whi...

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon Jun 8 02:18:52 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c2df14973f7f51abfe284641125abe02b3bd374c
      https://github.com/llvm/llvm-project/commit/c2df14973f7f51abfe284641125abe02b3bd374c
  Author: Fangrui Song <i at maskray.me>
  Date:   2026-06-08 (Mon, 08 Jun 2026)

  Changed paths:
    M llvm/include/llvm/ADT/StringMap.h
    M llvm/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h
    M llvm/include/llvm/ProfileData/HashKeyMap.h
    M llvm/tools/llvm-profdata/llvm-profdata.cpp
    M llvm/unittests/ADT/StringMapTest.cpp

  Log Message:
  -----------
  [StringMap] Add remove_if and use it for erase-while-iterating (#202272)

Add a `remove_if` member to StringMap (and to HashKeyMap, the base of
SampleProfileMap) as a replacement for the erase-while-iterating idiom,
and convert the two in-tree users: SymbolStringPool::clearDeadEntries
and llvm-profdata's filterFunctions (a template over StringMap and
SampleProfileMap).

Extracted from #202237 - making StringMap's mutation invalidates
iterators
so that we can remove the tombstone state.

Aided by Claude Opus 4.8



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