Updated the expression parser to ignore non-external
functions it finds in libraries unless it cannot find
an external function with the desired name.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115721 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangExpressionDeclMap.cpp b/source/Expression/ClangExpressionDeclMap.cpp
index b98ff23..8937571 100644
--- a/source/Expression/ClangExpressionDeclMap.cpp
+++ b/source/Expression/ClangExpressionDeclMap.cpp
@@ -945,8 +945,9 @@
m_sym_ctx->FindFunctionsByName(name_cs, false, sym_ctxs);
- bool found_generic = false;
bool found_specific = false;
+ Symbol *generic_symbol = NULL;
+ Symbol *non_extern_symbol = NULL;
for (uint32_t index = 0, num_indices = sym_ctxs.GetSize();
index < num_indices;
@@ -954,7 +955,7 @@
{
SymbolContext sym_ctx;
sym_ctxs.GetContextAtIndex(index, sym_ctx);
-
+
if (sym_ctx.function)
{
// TODO only do this if it's a C function; C++ functions may be
@@ -963,16 +964,23 @@
AddOneFunction(context, sym_ctx.function, NULL);
found_specific = true;
}
- else if(sym_ctx.symbol)
+ else if (sym_ctx.symbol)
{
- if (!found_generic && !found_specific)
- {
- AddOneFunction(context, NULL, sym_ctx.symbol);
- found_generic = true;
- }
+ if (sym_ctx.symbol->IsExternal())
+ generic_symbol = sym_ctx.symbol;
+ else
+ non_extern_symbol = sym_ctx.symbol;
}
}
+ if (!found_specific)
+ {
+ if (generic_symbol)
+ AddOneFunction(context, NULL, generic_symbol);
+ else if (non_extern_symbol)
+ AddOneFunction(context, NULL, non_extern_symbol);
+ }
+
Variable *var = FindVariableInScope(*m_exe_ctx->frame, name);
if (var)