summaryrefslogtreecommitdiffstats
path: root/lldb/source/Symbol
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Symbol')
-rw-r--r--lldb/source/Symbol/Variable.cpp40
-rw-r--r--lldb/source/Symbol/VariableList.cpp4
2 files changed, 33 insertions, 11 deletions
diff --git a/lldb/source/Symbol/Variable.cpp b/lldb/source/Symbol/Variable.cpp
index 6511c01c8ab..f264e142fef 100644
--- a/lldb/source/Symbol/Variable.cpp
+++ b/lldb/source/Symbol/Variable.cpp
@@ -10,6 +10,7 @@
#include "lldb/Symbol/Variable.h"
#include "lldb/Core/Stream.h"
+#include "lldb/Core/RegularExpression.h"
#include "lldb/Symbol/Block.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/SymbolContext.h"
@@ -26,17 +27,22 @@ using namespace lldb_private;
//----------------------------------------------------------------------
// Variable constructor
//----------------------------------------------------------------------
-Variable::Variable(lldb::user_id_t uid,
- const ConstString& name,
- Type *type,
- ValueType scope,
- SymbolContextScope *context,
- Declaration* decl_ptr,
- const DWARFExpression& location,
- bool external,
- bool artificial) :
+Variable::Variable
+(
+ lldb::user_id_t uid,
+ const char *name,
+ const char *mangled, // The mangled variable name for variables in namespaces
+ Type *type,
+ ValueType scope,
+ SymbolContextScope *context,
+ Declaration* decl_ptr,
+ const DWARFExpression& location,
+ bool external,
+ bool artificial
+) :
UserID(uid),
m_name(name),
+ m_mangled (mangled, true),
m_type(type),
m_scope(scope),
m_owner_scope(context),
@@ -55,6 +61,22 @@ Variable::~Variable()
}
+const ConstString&
+Variable::GetName() const
+{
+ if (m_mangled)
+ return m_mangled.GetName();
+ return m_name;
+}
+
+bool
+Variable::NameMatches (const RegularExpression& regex) const
+{
+ if (regex.Execute (m_name.AsCString()))
+ return true;
+ return m_mangled.NameMatches (regex);
+}
+
void
Variable::Dump(Stream *s, bool show_context) const
{
diff --git a/lldb/source/Symbol/VariableList.cpp b/lldb/source/Symbol/VariableList.cpp
index 75106ffc6fb..7dd80a4c100 100644
--- a/lldb/source/Symbol/VariableList.cpp
+++ b/lldb/source/Symbol/VariableList.cpp
@@ -91,7 +91,7 @@ VariableList::FindVariable(const ConstString& name)
iterator pos, end = m_variables.end();
for (pos = m_variables.begin(); pos != end; ++pos)
{
- if ((*pos)->GetName() == name)
+ if ((*pos)->NameMatches(name))
{
var_sp = (*pos);
break;
@@ -107,7 +107,7 @@ VariableList::AppendVariablesIfUnique (const RegularExpression& regex, VariableL
iterator pos, end = m_variables.end();
for (pos = m_variables.begin(); pos != end; ++pos)
{
- if (regex.Execute ((*pos)->GetName().AsCString()))
+ if ((*pos)->NameMatches (regex))
{
// Note the total matches found
total_matches++;
OpenPOWER on IntegriCloud