diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp index 5b92e74174f8..1a694f76d733 100644 --- a/lldb/source/Expression/ClangExpressionDeclMap.cpp +++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp @@ -598,13 +598,17 @@ ClangExpressionDeclMap::GetFunctionAddress Mangled mangled(name, is_mangled); CPPLanguageRuntime::MethodName method_name(mangled.GetDemangledName()); - - llvm::StringRef basename = method_name.GetBasename(); - - if (!basename.empty()) + + // the C++ context must be empty before we can think of searching for symbol by a simple basename + if (method_name.GetContext().empty()) { - FindCodeSymbolInContext(ConstString(basename), m_parser_vars->m_sym_ctx, sc_list); - sc_list_size = sc_list.GetSize(); + llvm::StringRef basename = method_name.GetBasename(); + + if (!basename.empty()) + { + FindCodeSymbolInContext(ConstString(basename), m_parser_vars->m_sym_ctx, sc_list); + sc_list_size = sc_list.GetSize(); + } } }