[Lldb-commits] [lldb] r234178 - 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.
Greg Clayton
gclayton at apple.com
Mon Apr 6 10:14:03 PDT 2015
Author: gclayton
Date: Mon Apr 6 12:14:02 2015
New Revision: 234178
URL: http://llvm.org/viewvc/llvm-project?rev=234178&view=rev
Log:
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).
Modified:
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=234178&r1=234177&r2=234178&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Mon Apr 6 12:14:02 2015
@@ -598,13 +598,17 @@ ClangExpressionDeclMap::GetFunctionAddre
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();
+ }
}
}
More information about the lldb-commits
mailing list