[Lldb-commits] [lldb] r226962 - 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.
Greg Clayton
gclayton at apple.com
Fri Jan 23 15:18:53 PST 2015
Author: gclayton
Date: Fri Jan 23 17:18:53 2015
New Revision: 226962
URL: http://llvm.org/viewvc/llvm-project?rev=226962&view=rev
Log:
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.
Modified:
lldb/trunk/include/lldb/Core/Mangled.h
lldb/trunk/source/Core/Mangled.cpp
Modified: lldb/trunk/include/lldb/Core/Mangled.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Mangled.h?rev=226962&r1=226961&r2=226962&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Mangled.h (original)
+++ lldb/trunk/include/lldb/Core/Mangled.h Fri Jan 23 17:18:53 2015
@@ -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.
Modified: lldb/trunk/source/Core/Mangled.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Mangled.cpp?rev=226962&r1=226961&r2=226962&view=diff
==============================================================================
--- lldb/trunk/source/Core/Mangled.cpp (original)
+++ lldb/trunk/source/Core/Mangled.cpp Fri Jan 23 17:18:53 2015
@@ -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.
//----------------------------------------------------------------------
More information about the lldb-commits
mailing list