From dc25a0bc648ae855f62c782fb0e42de620f90aae Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Thu, 31 Oct 2013 16:59:47 +0000 Subject: Fixes from code review by Jim Ingham that reinstate preferring an external vs non-external symbol when finding function addresses. llvm-svn: 193761 --- lldb/source/Expression/ClangExpressionDeclMap.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'lldb/source/Expression/ClangExpressionDeclMap.cpp') diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp index 4570e018619..87c984ddcfb 100644 --- a/lldb/source/Expression/ClangExpressionDeclMap.cpp +++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp @@ -1361,7 +1361,8 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context, if (sc_list.GetSize()) { - Symbol *symbol = NULL; + Symbol *extern_symbol = NULL; + Symbol *non_extern_symbol = NULL; for (uint32_t index = 0, num_indices = sc_list.GetSize(); index < num_indices; @@ -1390,17 +1391,29 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context, else if (sym_ctx.symbol) { if (sym_ctx.symbol->GetType() == eSymbolTypeReExported) - symbol = sym_ctx.symbol->ResolveReExportedSymbol(*target); + { + sym_ctx.symbol = sym_ctx.symbol->ResolveReExportedSymbol(*target); + if (sym_ctx.symbol == NULL) + continue; + } + + if (sym_ctx.symbol->IsExternal()) + extern_symbol = sym_ctx.symbol; else - symbol = sym_ctx.symbol; + non_extern_symbol = sym_ctx.symbol; } } if (!context.m_found.function_with_type_info) { - if (symbol) + if (extern_symbol) + { + AddOneFunction (context, NULL, extern_symbol, current_id); + context.m_found.function = true; + } + else if (non_extern_symbol) { - AddOneFunction (context, NULL, symbol, current_id); + AddOneFunction (context, NULL, non_extern_symbol, current_id); context.m_found.function = true; } } -- cgit v1.2.3