Move the responsibility for translating the various eFunctionNameType lookups to the
SymbolFIle (it was done mostly in the BreakpointResolverName resolver before.) Then
tailor our searches to the way the indexed maps are laid out. This removes a bunch
of test case failures using indexed dSYM's.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@141428 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Target/CPPLanguageRuntime.cpp b/source/Target/CPPLanguageRuntime.cpp
index d80ed21..22fbd84 100644
--- a/source/Target/CPPLanguageRuntime.cpp
+++ b/source/Target/CPPLanguageRuntime.cpp
@@ -40,3 +40,81 @@
// C++ has no generic way to do this.
return false;
}
+
+bool
+CPPLanguageRuntime::IsCPPMangledName (const char *name)
+{
+ // FIXME, we should really run through all the known C++ Language plugins and ask each one if
+ // this is a C++ mangled name, but we can put that off till there is actually more than one
+ // we care about.
+
+ if (name && name[0] == '_' && name[1] == 'Z')
+ return true;
+ else
+ return false;
+}
+
+bool
+CPPLanguageRuntime::StripNamespacesFromVariableName (const char *name, const char *&base_name_start, const char *&base_name_end)
+{
+ if (base_name_end == NULL)
+ base_name_end = name + strlen (name);
+
+ const char *last_colon = NULL;
+ for (const char *ptr = base_name_end; ptr != name; ptr--)
+ {
+ if (*ptr == ':')
+ {
+ last_colon = ptr;
+ break;
+ }
+ }
+
+ if (last_colon == NULL)
+ {
+ base_name_start = name;
+ return true;
+ }
+
+ // Can't have a C++ name that begins with a single ':', nor contains an internal single ':'
+ if (last_colon == name)
+ return false;
+ else if (last_colon[-1] != ':')
+ return false;
+ else
+ {
+ // FIXME: should check if there is
+ base_name_start = last_colon + 1;
+ return true;
+ }
+}
+bool
+CPPLanguageRuntime::IsPossibleCPPCall (const char *name, const char *&base_name_start, const char *&base_name_end)
+{
+ if (!name)
+ return false;
+ // For now, I really can't handle taking template names apart, so if you
+ // have < or > I'll say "could be CPP but leave the base_name empty which
+ // means I couldn't figure out what to use for that.
+ // FIXME: Do I need to do more sanity checking here?
+
+ if (strchr(name, '>') != NULL || strchr (name, '>') != NULL)
+ return true;
+
+ size_t name_len = strlen (name);
+
+ if (name[name_len - 1] == ')')
+ {
+ // We've got arguments.
+ base_name_end = strchr (name, '(');
+ if (base_name_end == NULL)
+ return false;
+
+ // FIXME: should check that this parenthesis isn't a template specialized
+ // on a function type or something gross like that...
+ }
+ else
+ base_name_end = name + strlen (name);
+
+ return StripNamespacesFromVariableName (name, base_name_start, base_name_end);
+}