[Lldb-commits] [lldb] 8446759 - [lldb] Don't assume non-erased DenseMap entries remain valid after erase. NFC (#199499)
via lldb-commits
lldb-commits at lists.llvm.org
Mon May 25 01:51:05 PDT 2026
Author: Fangrui Song
Date: 2026-05-25T08:50:59Z
New Revision: 8446759ee610fe5ad1c5ab9cb2239ef3ad2e4c30
URL: https://github.com/llvm/llvm-project/commit/8446759ee610fe5ad1c5ab9cb2239ef3ad2e4c30
DIFF: https://github.com/llvm/llvm-project/commit/8446759ee610fe5ad1c5ab9cb2239ef3ad2e4c30.diff
LOG: [lldb] Don't assume non-erased DenseMap entries remain valid after erase. NFC (#199499)
Similar to #198982
Added:
Modified:
lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h
Removed:
################################################################################
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h
index f13d8678f22b9..e081ae27ba4a1 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h
@@ -399,13 +399,8 @@ class ClangASTImporter {
/// Useful when an ASTContext is about to be deleted and all the dangling
/// pointers to it need to be removed.
void removeOriginsWithContext(clang::ASTContext *ctx) {
- for (OriginMap::iterator iter = m_origins.begin();
- iter != m_origins.end();) {
- if (iter->second.ctx == ctx)
- m_origins.erase(iter++);
- else
- ++iter;
- }
+ m_origins.remove_if(
+ [ctx](const auto &origin) { return origin.second.ctx == ctx; });
}
/// Returns the DeclOrigin for the given Decl or an invalid DeclOrigin
More information about the lldb-commits
mailing list