Skip to content

Commit b23c24c

Browse files
author
Greg Clayton
committedApr 6, 2015
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
1 parent 936c563 commit b23c24c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed
 

‎lldb/source/Expression/ClangExpressionDeclMap.cpp

+10-6
Original file line numberDiff line numberDiff line change
@@ -598,13 +598,17 @@ ClangExpressionDeclMap::GetFunctionAddress
598598
Mangled mangled(name, is_mangled);
599599

600600
CPPLanguageRuntime::MethodName method_name(mangled.GetDemangledName());
601-
602-
llvm::StringRef basename = method_name.GetBasename();
603-
604-
if (!basename.empty())
601+
602+
// the C++ context must be empty before we can think of searching for symbol by a simple basename
603+
if (method_name.GetContext().empty())
605604
{
606-
FindCodeSymbolInContext(ConstString(basename), m_parser_vars->m_sym_ctx, sc_list);
607-
sc_list_size = sc_list.GetSize();
605+
llvm::StringRef basename = method_name.GetBasename();
606+
607+
if (!basename.empty())
608+
{
609+
FindCodeSymbolInContext(ConstString(basename), m_parser_vars->m_sym_ctx, sc_list);
610+
sc_list_size = sc_list.GetSize();
611+
}
608612
}
609613
}
610614

0 commit comments

Comments
 (0)