diff options
author | dim <dim@FreeBSD.org> | 2015-09-06 14:32:30 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-09-06 14:32:30 +0000 |
commit | 80b639cd40df427b9e325318efeec2d885a65f62 (patch) | |
tree | 94980f450aa3daec3e1fec217374704ad62cfe45 /source/Core/Mangled.cpp | |
parent | 8037fa4ee916fa20b3c63cbf531f4ee7e1c76138 (diff) | |
download | FreeBSD-src-80b639cd40df427b9e325318efeec2d885a65f62.zip FreeBSD-src-80b639cd40df427b9e325318efeec2d885a65f62.tar.gz |
Vendor import of (stripped) lldb trunk r242221:
https://llvm.org/svn/llvm-project/lldb/trunk@242221
Diffstat (limited to 'source/Core/Mangled.cpp')
-rw-r--r-- | source/Core/Mangled.cpp | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/source/Core/Mangled.cpp b/source/Core/Mangled.cpp index 3e1a8bb..a1916fe 100644 --- a/source/Core/Mangled.cpp +++ b/source/Core/Mangled.cpp @@ -66,7 +66,7 @@ cstring_is_mangled(const char *s) } static const ConstString & -get_demangled_name_without_arguments (const Mangled *obj) +get_demangled_name_without_arguments (ConstString mangled, ConstString demangled) { // This pair is <mangled name, demangled name without function arguments> static std::pair<ConstString, ConstString> g_most_recent_mangled_to_name_sans_args; @@ -77,9 +77,6 @@ get_demangled_name_without_arguments (const Mangled *obj) static ConstString g_last_mangled; static ConstString g_last_demangled; - ConstString mangled = obj->GetMangledName (); - ConstString demangled = obj->GetDemangledName (); - if (mangled && g_most_recent_mangled_to_name_sans_args.first == mangled) { return g_most_recent_mangled_to_name_sans_args.second; @@ -197,7 +194,7 @@ Mangled::Clear () int Mangled::Compare (const Mangled& a, const Mangled& b) { - return ConstString::Compare(a.GetName(ePreferMangled), a.GetName(ePreferMangled)); + return ConstString::Compare(a.GetName(lldb::eLanguageTypeUnknown, ePreferMangled), a.GetName(lldb::eLanguageTypeUnknown, ePreferMangled)); } @@ -261,7 +258,7 @@ Mangled::SetValue (const ConstString &name) // object's lifetime. //---------------------------------------------------------------------- const ConstString& -Mangled::GetDemangledName () const +Mangled::GetDemangledName (lldb::LanguageType language) const { // Check to make sure we have a valid mangled name and that we // haven't already decoded our mangled name. @@ -339,13 +336,20 @@ Mangled::GetDemangledName () const } +ConstString +Mangled::GetDisplayDemangledName (lldb::LanguageType language) const +{ + return GetDemangledName(language); +} + bool -Mangled::NameMatches (const RegularExpression& regex) const +Mangled::NameMatches (const RegularExpression& regex, lldb::LanguageType language) const { if (m_mangled && regex.Execute (m_mangled.AsCString())) return true; - - if (GetDemangledName() && regex.Execute (m_demangled.AsCString())) + + ConstString demangled = GetDemangledName(language); + if (demangled && regex.Execute (demangled.AsCString())) return true; return false; } @@ -353,30 +357,28 @@ Mangled::NameMatches (const RegularExpression& regex) const //---------------------------------------------------------------------- // Get the demangled name if there is one, else return the mangled name. //---------------------------------------------------------------------- -const ConstString& -Mangled::GetName (Mangled::NamePreference preference) const +ConstString +Mangled::GetName (lldb::LanguageType language, Mangled::NamePreference preference) const { + ConstString demangled = GetDemangledName(language); + if (preference == ePreferDemangledWithoutArguments) { - // Call the accessor to make sure we get a demangled name in case - // it hasn't been demangled yet... - GetDemangledName(); - - return get_demangled_name_without_arguments (this); + return get_demangled_name_without_arguments (m_mangled, demangled); } if (preference == ePreferDemangled) { // Call the accessor to make sure we get a demangled name in case // it hasn't been demangled yet... - if (GetDemangledName()) - return m_demangled; + if (demangled) + return demangled; return m_mangled; } else { if (m_mangled) return m_mangled; - return GetDemangledName(); + return demangled; } } @@ -429,7 +431,7 @@ Mangled::GuessLanguage () const ConstString mangled = GetMangledName(); if (mangled) { - if (GetDemangledName()) + if (GetDemangledName(lldb::eLanguageTypeUnknown)) { if (cstring_is_mangled(mangled.GetCString())) return lldb::eLanguageTypeC_plus_plus; @@ -447,7 +449,7 @@ operator << (Stream& s, const Mangled& obj) if (obj.GetMangledName()) s << "mangled = '" << obj.GetMangledName() << "'"; - const ConstString& demangled = obj.GetDemangledName(); + const ConstString& demangled = obj.GetDemangledName(lldb::eLanguageTypeUnknown); if (demangled) s << ", demangled = '" << demangled << '\''; else |