[all-commits] [llvm/llvm-project] e81948: [LifetimeSafety] 'erase' does not invaldiate node-...

Utkarsh Saxena via All-commits all-commits at lists.llvm.org
Sun Feb 15 13:16:52 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e819483c20ea502e9a0f3cc29276cc05a3f35e98
      https://github.com/llvm/llvm-project/commit/e819483c20ea502e9a0f3cc29276cc05a3f35e98
  Author: Utkarsh Saxena <usx at google.com>
  Date:   2026-02-15 (Sun, 15 Feb 2026)

  Changed paths:
    M clang/lib/Analysis/LifetimeSafety/LifetimeAnnotations.cpp
    M clang/test/Sema/Inputs/lifetime-analysis.h
    M clang/test/Sema/warn-lifetime-safety-invalidations.cpp

  Log Message:
  -----------
  [LifetimeSafety] 'erase' does not invaldiate node-based containers (#181216)

```cpp
// This pattern was previously flagged as a lifetime violation
for (auto it = my_map.begin(); it != my_map.end(); ) {
    if (should_delete(*it)) {
        my_map.erase(it++); // Safe in map, but flagged as invalidating 'it'
    } else {
        ++it;
    }
}
```



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