summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/ClangExpressionDeclMap.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2015-04-06 17:14:02 +0000
committerGreg Clayton <gclayton@apple.com>2015-04-06 17:14:02 +0000
commitb23c24c2a84bbc367240fc1eaf17863320793200 (patch)
tree0cc5e30ca5ef14e61eeae94097c706988e1f50f5 /lldb/source/Expression/ClangExpressionDeclMap.cpp
parent936c56393c99e9268e787baee382614c1df12451 (diff)
downloadbcm5719-llvm-b23c24c2a84bbc367240fc1eaf17863320793200.tar.gz
bcm5719-llvm-b23c24c2a84bbc367240fc1eaf17863320793200.zip
We have an issue where if you use a C function right now that has no prototype, it isn't marked as extern "C" and the name to lookup is some C++ mangled form of the name.
This used to be the case for "printf" before a function prototype was added to the builtin expression prefix file. This fix makes sure that if we get a mangled name that we don't find in the current target, that we only fall back to looking up function by basename if the function isn't contained in a namespace or class (no decl context). llvm-svn: 234178
Diffstat (limited to 'lldb/source/Expression/ClangExpressionDeclMap.cpp')
-rw-r--r--lldb/source/Expression/ClangExpressionDeclMap.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp
index 5b92e74174f..1a694f76d73 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();
+ }
}
}
OpenPOWER on IntegriCloud