diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -2183,9 +2183,10 @@ std::vector DWARFASTParserClang::GetDIEForDeclContext( lldb_private::CompilerDeclContext decl_context) { std::vector result; - for (auto it = m_decl_ctx_to_die.find( - (clang::DeclContext *)decl_context.GetOpaqueDeclContext()); - it != m_decl_ctx_to_die.end(); it++) + auto opaque_decl_ctx = + (clang::DeclContext *)decl_context.GetOpaqueDeclContext(); + for (auto it = m_decl_ctx_to_die.find(opaque_decl_ctx); + it != m_decl_ctx_to_die.end() && it->first == opaque_decl_ctx; it++) result.push_back(it->second); return result; }