diff options
author | Sean Callanan <scallanan@apple.com> | 2010-09-07 21:49:41 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2010-09-07 21:49:41 +0000 |
commit | 3883b5ae4e08c953aa0175bd4553debb2de43a6e (patch) | |
tree | b2db8be3ba4b5bc3d6b7f9221ab4195a60f80b10 /lldb/source/Expression/ClangExpressionDeclMap.cpp | |
parent | 9877af3b46d225f1d953215c316804b87b4c3de2 (diff) | |
download | bcm5719-llvm-3883b5ae4e08c953aa0175bd4553debb2de43a6e.tar.gz bcm5719-llvm-3883b5ae4e08c953aa0175bd4553debb2de43a6e.zip |
Improved function lookup to avoid conflicts between
symbols with the same name and no debug information.
Also improved the way functions are called so we
don't automatically define them as variadic functions
in the IR.
llvm-svn: 113290
Diffstat (limited to 'lldb/source/Expression/ClangExpressionDeclMap.cpp')
-rw-r--r-- | lldb/source/Expression/ClangExpressionDeclMap.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp index 3c2913a7fc9..2f4440c1c6f 100644 --- a/lldb/source/Expression/ClangExpressionDeclMap.cpp +++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp @@ -734,6 +734,9 @@ ClangExpressionDeclMap::GetDecls(NameSearchContext &context, m_sym_ctx->FindFunctionsByName(name_cs, false, sym_ctxs); + bool found_generic = false; + bool found_specific = false; + for (uint32_t index = 0, num_indices = sym_ctxs.GetSize(); index < num_indices; ++index) @@ -742,9 +745,21 @@ ClangExpressionDeclMap::GetDecls(NameSearchContext &context, sym_ctxs.GetContextAtIndex(index, sym_ctx); if (sym_ctx.function) - AddOneFunction(context, sym_ctx.function, NULL); + { + // TODO only do this if it's a C function; C++ functions may be + // overloaded + if (!found_specific) + AddOneFunction(context, sym_ctx.function, NULL); + found_specific = true; + } else if(sym_ctx.symbol) - AddOneFunction(context, NULL, sym_ctx.symbol); + { + if (!found_generic && !found_specific) + { + AddOneFunction(context, NULL, sym_ctx.symbol); + found_generic = true; + } + } } Variable *var = FindVariableInScope(*m_sym_ctx, name); @@ -993,7 +1008,7 @@ ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context, entity.m_parser_vars->m_lldb_value = fun_location.release(); if (log) - log->Printf("Found function %s, returned (NamedDecl)%p", context.Name.getAsString().c_str(), fun_decl); + log->Printf("Found %s function %s, returned (NamedDecl)%p", (fun ? "specific" : "generic"), context.Name.getAsString().c_str(), fun_decl); } void |