Adding the ability to get the language from a mangled name. This isn't used in the SVN LLDB, but will be used in another codebase based on the SVN LLDB.

llvm-svn: 226962
This commit is contained in:
Greg Clayton 2015-01-23 23:18:53 +00:00
parent 0b9858dca5
commit 94976f70af
2 changed files with 34 additions and 0 deletions

View File

@ -290,6 +290,25 @@ public:
void
SetValue (const ConstString &name);
//----------------------------------------------------------------------
/// Get the language only if it is definitive what the language is from
/// the mangling.
///
/// For a mangled name to have a language it must have both a mangled
/// and a demangled name and it must be definitive from the mangling
/// what the language is.
///
/// Standard C function names will return eLanguageTypeUnknown because
/// they aren't mangled and it isn't clear what language the name
/// represents (there will be no mangled name).
///
/// @return
/// The language for the mangled/demangled name, eLanguageTypeUnknown
/// if there is no mangled or demangled counterpart.
//----------------------------------------------------------------------
lldb::LanguageType
GetLanguage ();
private:
//----------------------------------------------------------------------
/// Mangled member variables.

View File

@ -5352,6 +5352,21 @@ Mangled::MemorySize () const
return m_mangled.MemorySize() + m_demangled.MemorySize();
}
lldb::LanguageType
Mangled::GetLanguage ()
{
ConstString mangled = GetMangledName();
if (mangled)
{
if (GetDemangledName())
{
if (cstring_is_mangled(mangled.GetCString()))
return lldb::eLanguageTypeC_plus_plus;
}
}
return lldb::eLanguageTypeUnknown;
}
//----------------------------------------------------------------------
// Dump OBJ to the supplied stream S.
//----------------------------------------------------------------------