Fixed the expression parser to ignore C++ and
Objective-C method names when looking for functions
in the top level or a namespace. Method names should
only be found via FindExternalLexicalDecls.
<rdar://problem/11711679>
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160907 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangExpressionDeclMap.cpp b/source/Expression/ClangExpressionDeclMap.cpp
index e85239d..e4c5a17 100644
--- a/source/Expression/ClangExpressionDeclMap.cpp
+++ b/source/Expression/ClangExpressionDeclMap.cpp
@@ -2703,6 +2703,9 @@
{
const bool include_symbols = true;
+ // TODO Fix FindFunctions so that it doesn't return
+ // instance methods for eFunctionNameTypeBase.
+
target->GetImages().FindFunctions(name,
eFunctionNameTypeBase,
include_symbols,
@@ -2725,6 +2728,14 @@
if (sym_ctx.function)
{
+ clang::DeclContext *decl_ctx = sym_ctx.function->GetClangDeclContext();
+
+ // Filter out class/instance methods.
+ if (dyn_cast<clang::ObjCMethodDecl>(decl_ctx))
+ continue;
+ if (dyn_cast<clang::CXXMethodDecl>(decl_ctx))
+ continue;
+
// TODO only do this if it's a C function; C++ functions may be
// overloaded
if (!context.m_found.function_with_type_info)
@@ -3281,10 +3292,15 @@
{
ASTDumper ast_dumper(fun_decl);
- log->Printf(" CEDM::FEVD[%u] Found %s function %s, returned %s",
+ StreamString ss;
+
+ fun_address->Dump(&ss, m_parser_vars->m_exe_ctx.GetBestExecutionContextScope(), Address::DumpStyleResolvedDescription);
+
+ log->Printf(" CEDM::FEVD[%u] Found %s function %s (description %s), returned %s",
current_id,
(fun ? "specific" : "generic"),
- decl_name.c_str(),
+ decl_name.c_str(),
+ ss.GetData(),
ast_dumper.GetCString());
}
}