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
This commit is contained in:
Greg Clayton 2015-04-06 17:14:02 +00:00
parent 936c56393c
commit b23c24c2a8
1 changed files with 10 additions and 6 deletions

View File

@ -599,6 +599,9 @@ ClangExpressionDeclMap::GetFunctionAddress
CPPLanguageRuntime::MethodName method_name(mangled.GetDemangledName()); CPPLanguageRuntime::MethodName method_name(mangled.GetDemangledName());
// the C++ context must be empty before we can think of searching for symbol by a simple basename
if (method_name.GetContext().empty())
{
llvm::StringRef basename = method_name.GetBasename(); llvm::StringRef basename = method_name.GetBasename();
if (!basename.empty()) if (!basename.empty())
@ -607,6 +610,7 @@ ClangExpressionDeclMap::GetFunctionAddress
sc_list_size = sc_list.GetSize(); sc_list_size = sc_list.GetSize();
} }
} }
}
lldb::addr_t intern_callable_load_addr = LLDB_INVALID_ADDRESS; lldb::addr_t intern_callable_load_addr = LLDB_INVALID_ADDRESS;