aboutsummaryrefslogtreecommitdiff
path: root/source/Symbol/Variable.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-09-06 14:32:30 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-09-06 14:32:30 +0000
commit027f1c9655391dcb2b0117f931f720211ac933db (patch)
tree94980f450aa3daec3e1fec217374704ad62cfe45 /source/Symbol/Variable.cpp
parent5e95aa85bb660d45e9905ef1d7180b2678280660 (diff)
Vendor import of (stripped) lldb trunk r242221:vendor/lldb/lldb-trunk-r242221
Notes
Notes: svn path=/vendor/lldb/dist/; revision=287503 svn path=/vendor/lldb/lldb-trunk-r242221/; revision=287504; tag=vendor/lldb/lldb-trunk-r242221
Diffstat (limited to 'source/Symbol/Variable.cpp')
-rw-r--r--source/Symbol/Variable.cpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/source/Symbol/Variable.cpp b/source/Symbol/Variable.cpp
index 5665e4702ca6..2490e98ac1e8 100644
--- a/source/Symbol/Variable.cpp
+++ b/source/Symbol/Variable.cpp
@@ -15,6 +15,7 @@
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectVariable.h"
#include "lldb/Symbol/Block.h"
+#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/Type.h"
@@ -65,22 +66,48 @@ Variable::~Variable()
{
}
+lldb::LanguageType
+Variable::GetLanguage () const
+{
+ SymbolContext variable_sc;
+ m_owner_scope->CalculateSymbolContext(&variable_sc);
+ if (variable_sc.comp_unit)
+ return variable_sc.comp_unit->GetLanguage();
+ return lldb::eLanguageTypeUnknown;
+}
+
-const ConstString&
+
+ConstString
Variable::GetName() const
{
- const ConstString &name = m_mangled.GetName();
+ ConstString name = m_mangled.GetName(GetLanguage());
if (name)
return name;
return m_name;
}
bool
+Variable::NameMatches (const ConstString &name) const
+{
+ if (m_name == name)
+ return true;
+ SymbolContext variable_sc;
+ m_owner_scope->CalculateSymbolContext(&variable_sc);
+
+ LanguageType language = eLanguageTypeUnknown;
+ if (variable_sc.comp_unit)
+ language = variable_sc.comp_unit->GetLanguage();
+ return m_mangled.NameMatches (name, language);
+}
+bool
Variable::NameMatches (const RegularExpression& regex) const
{
if (regex.Execute (m_name.AsCString()))
return true;
- return m_mangled.NameMatches (regex);
+ if (m_mangled)
+ return m_mangled.NameMatches (regex, GetLanguage());
+ return false;
}
Type *