summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Core')
-rw-r--r--lldb/source/Core/FormatManager.cpp4
-rw-r--r--lldb/source/Core/Module.cpp82
-rw-r--r--lldb/source/Core/ModuleList.cpp7
-rw-r--r--lldb/source/Core/ValueObject.cpp27
-rw-r--r--lldb/source/Core/ValueObjectChild.cpp22
-rw-r--r--lldb/source/Core/ValueObjectConstResult.cpp2
-rw-r--r--lldb/source/Core/ValueObjectDynamicValue.cpp8
-rw-r--r--lldb/source/Core/ValueObjectMemory.cpp2
-rw-r--r--lldb/source/Core/ValueObjectRegister.cpp2
-rw-r--r--lldb/source/Core/ValueObjectVariable.cpp12
10 files changed, 108 insertions, 60 deletions
diff --git a/lldb/source/Core/FormatManager.cpp b/lldb/source/Core/FormatManager.cpp
index 958ac18c9b6..0496780724a 100644
--- a/lldb/source/Core/FormatManager.cpp
+++ b/lldb/source/Core/FormatManager.cpp
@@ -630,7 +630,7 @@ FormatManager::LoadSTLFormatters()
std_string_summary_sp);
gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<char,std::char_traits<char>,std::allocator<char> >"),
std_string_summary_sp);
- gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<char, class std::char_traits<char>, class std::allocator<char> >"),
+ gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<char, std::char_traits<char>, std::allocator<char> >"),
std_string_summary_sp);
@@ -676,7 +676,7 @@ FormatManager::LoadLibcxxFormatters()
libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::string"),
std_string_summary_sp);
- libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::basic_string<char, class std::__1::char_traits<char>, class std::__1::allocator<char> >"),
+ libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >"),
std_string_summary_sp);
SyntheticChildren::Flags stl_synth_flags;
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index dea7b1f4b0b..48fc499c91b 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -632,7 +632,12 @@ Module::FindFunctions (const RegularExpression& regex,
}
uint32_t
-Module::FindTypes_Impl (const SymbolContext& sc, const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, TypeList& types)
+Module::FindTypes_Impl (const SymbolContext& sc,
+ const ConstString &name,
+ const ClangNamespaceDecl *namespace_decl,
+ bool append,
+ uint32_t max_matches,
+ TypeList& types)
{
Timer scoped_timer(__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
if (sc.module_sp.get() == NULL || sc.module_sp.get() == this)
@@ -644,46 +649,59 @@ Module::FindTypes_Impl (const SymbolContext& sc, const ConstString &name, const
return 0;
}
-// depending on implementation details, type lookup might fail because of
-// embedded spurious namespace:: prefixes. this call strips them, paying
-// attention to the fact that a type might have namespace'd type names as
-// arguments to templates, and those must not be stripped off
-static const char*
-StripTypeName(const char* name_cstr)
+uint32_t
+Module::FindTypesInNamespace (const SymbolContext& sc,
+ const ConstString &type_name,
+ const ClangNamespaceDecl *namespace_decl,
+ uint32_t max_matches,
+ TypeList& type_list)
{
- // Protect against null c string.
- if (!name_cstr)
- return name_cstr;
- const char* skip_namespace = strstr(name_cstr, "::");
- const char* template_arg_char = strchr(name_cstr, '<');
- while (skip_namespace != NULL)
- {
- if (template_arg_char != NULL &&
- skip_namespace > template_arg_char) // but namespace'd template arguments are still good to go
- break;
- name_cstr = skip_namespace+2;
- skip_namespace = strstr(name_cstr, "::");
- }
- return name_cstr;
+ const bool append = true;
+ return FindTypes_Impl(sc, type_name, namespace_decl, append, max_matches, type_list);
}
uint32_t
-Module::FindTypes (const SymbolContext& sc, const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, TypeList& types)
+Module::FindTypes (const SymbolContext& sc,
+ const ConstString &name,
+ bool exact_match,
+ uint32_t max_matches,
+ TypeList& types)
{
- uint32_t retval = FindTypes_Impl(sc, name, namespace_decl, append, max_matches, types);
-
- if (retval == 0)
+ uint32_t num_matches = 0;
+ const char *type_name_cstr = name.GetCString();
+ std::string type_scope;
+ std::string type_basename;
+ const bool append = true;
+ if (Type::GetTypeScopeAndBasename (type_name_cstr, type_scope, type_basename))
{
- const char *orig_name = name.GetCString();
- const char *stripped = StripTypeName(orig_name);
- // Only do this lookup if StripTypeName has stripped the name:
- if (stripped != orig_name)
- return FindTypes_Impl(sc, ConstString(stripped), namespace_decl, append, max_matches, types);
+ // Check if "name" starts with "::" which means the qualified type starts
+ // from the root namespace and implies and exact match. The typenames we
+ // get back from clang do not start with "::" so we need to strip this off
+ // in order to get the qualfied names to match
+
+ if (type_scope.size() >= 2 && type_scope[0] == ':' && type_scope[1] == ':')
+ {
+ type_scope.erase(0,2);
+ exact_match = true;
+ }
+ ConstString type_basename_const_str (type_basename.c_str());
+ if (FindTypes_Impl(sc, type_basename_const_str, NULL, append, max_matches, types))
+ {
+ types.RemoveMismatchedTypes (type_scope, type_basename, exact_match);
+ num_matches = types.GetSize();
+ }
else
- return 0;
+ {
+ types.Clear();
+ }
}
else
- return retval;
+ {
+ // The type is not in a namespace/class scope, just search for it by basename
+ num_matches = FindTypes_Impl(sc, name, NULL, append, max_matches, types);
+ }
+
+ return num_matches;
}
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index 0cc97988029..b612a0cd9d8 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -352,19 +352,16 @@ ModuleList::FindModule (const UUID &uuid)
uint32_t
-ModuleList::FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types)
+ModuleList::FindTypes2 (const SymbolContext& sc, const ConstString &name, bool name_is_fully_qualified, uint32_t max_matches, TypeList& types)
{
Mutex::Locker locker(m_modules_mutex);
-
- if (!append)
- types.Clear();
uint32_t total_matches = 0;
collection::const_iterator pos, end = m_modules.end();
for (pos = m_modules.begin(); pos != end; ++pos)
{
if (sc.module_sp.get() == NULL || sc.module_sp.get() == (*pos).get())
- total_matches += (*pos)->FindTypes (sc, name, NULL, true, max_matches, types);
+ total_matches += (*pos)->FindTypes (sc, name, name_is_fully_qualified, max_matches, types);
if (total_matches >= max_matches)
break;
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index 3d3d03aa746..e072b491652 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -1676,6 +1676,19 @@ ValueObject::GetDeclaration (Declaration &decl)
return false;
}
+ConstString
+ValueObject::GetTypeName()
+{
+ return ClangASTType::GetConstTypeName (GetClangAST(), GetClangType());
+}
+
+ConstString
+ValueObject::GetQualifiedTypeName()
+{
+ return ClangASTType::GetConstQualifiedTypeName (GetClangAST(), GetClangType());
+}
+
+
LanguageType
ValueObject::GetObjectRuntimeLanguage ()
{
@@ -2640,13 +2653,10 @@ ValueObject::GetValueForExpressionPath_Impl(const char* expression_cstr,
else
{
if (ClangASTType::GetMinimumLanguage(root->GetClangAST(),
- root->GetClangType()) == eLanguageTypeObjC
- &&
- ClangASTContext::IsPointerType(ClangASTType::GetPointeeType(root->GetClangType())) == false
- &&
- root->HasSyntheticValue()
- &&
- options.m_no_synthetic_children == false)
+ root->GetClangType()) == eLanguageTypeObjC
+ && ClangASTContext::IsPointerType(ClangASTType::GetPointeeType(root->GetClangType())) == false
+ && root->HasSyntheticValue()
+ && options.m_no_synthetic_children == false)
{
root = root->GetSyntheticValue()->GetChildAtIndex(index, true);
}
@@ -3152,7 +3162,8 @@ DumpValueObject_Impl (Stream &s,
// Always show the type for the top level items.
if (options.m_show_types || (curr_depth == 0 && !options.m_flat_output))
{
- const char* typeName = valobj->GetTypeName().AsCString("<invalid type>");
+ const char* typeName = valobj->GetQualifiedTypeName().AsCString("<invalid type>");
+ //const char* typeName = valobj->GetTypeName().AsCString("<invalid type>");
s.Printf("(%s", typeName);
// only show dynamic types if the user really wants to see types
if (options.m_show_types && options.m_use_dynamic != eNoDynamicValues &&
diff --git a/lldb/source/Core/ValueObjectChild.cpp b/lldb/source/Core/ValueObjectChild.cpp
index 0cb0d6e9eac..52e773d3772 100644
--- a/lldb/source/Core/ValueObjectChild.cpp
+++ b/lldb/source/Core/ValueObjectChild.cpp
@@ -73,7 +73,7 @@ ValueObjectChild::GetTypeName()
{
if (m_type_name.IsEmpty())
{
- m_type_name = ClangASTType::GetConstTypeName (GetClangType());
+ m_type_name = ClangASTType::GetConstTypeName (GetClangAST(), GetClangType());
if (m_type_name)
{
if (m_bitfield_bit_size > 0)
@@ -91,6 +91,26 @@ ValueObjectChild::GetTypeName()
return m_type_name;
}
+ConstString
+ValueObjectChild::GetQualifiedTypeName()
+{
+ ConstString qualified_name = ClangASTType::GetConstQualifiedTypeName (GetClangAST(), GetClangType());
+ if (qualified_name)
+ {
+ if (m_bitfield_bit_size > 0)
+ {
+ const char *clang_type_name = qualified_name.AsCString();
+ if (clang_type_name)
+ {
+ std::vector<char> bitfield_type_name (strlen(clang_type_name) + 32, 0);
+ ::snprintf (&bitfield_type_name.front(), bitfield_type_name.size(), "%s:%u", clang_type_name, m_bitfield_bit_size);
+ qualified_name.SetCString(&bitfield_type_name.front());
+ }
+ }
+ }
+ return qualified_name;
+}
+
bool
ValueObjectChild::UpdateValue ()
{
diff --git a/lldb/source/Core/ValueObjectConstResult.cpp b/lldb/source/Core/ValueObjectConstResult.cpp
index dfa4cfa981a..08d983276a9 100644
--- a/lldb/source/Core/ValueObjectConstResult.cpp
+++ b/lldb/source/Core/ValueObjectConstResult.cpp
@@ -316,7 +316,7 @@ ConstString
ValueObjectConstResult::GetTypeName()
{
if (m_type_name.IsEmpty())
- m_type_name = ClangASTType::GetConstTypeName (GetClangType());
+ m_type_name = ClangASTType::GetConstTypeName (GetClangAST(), GetClangType());
return m_type_name;
}
diff --git a/lldb/source/Core/ValueObjectDynamicValue.cpp b/lldb/source/Core/ValueObjectDynamicValue.cpp
index 2e9f06728f4..6fd4ee88592 100644
--- a/lldb/source/Core/ValueObjectDynamicValue.cpp
+++ b/lldb/source/Core/ValueObjectDynamicValue.cpp
@@ -66,12 +66,6 @@ ValueObjectCast::GetClangTypeImpl ()
return m_cast_type.GetOpaqueQualType();
}
-ConstString
-ValueObjectCast::GetTypeName()
-{
- return ClangASTType::GetConstTypeName (GetClangType());
-}
-
uint32_t
ValueObjectCast::CalculateNumChildren()
{
@@ -172,7 +166,7 @@ ValueObjectDynamicValue::GetTypeName()
{
const bool success = UpdateValueIfNeeded(false);
if (success && m_type_sp)
- return ClangASTType::GetConstTypeName (GetClangType());
+ return ClangASTType::GetConstTypeName (GetClangAST(), GetClangType());
else
return m_parent->GetTypeName();
}
diff --git a/lldb/source/Core/ValueObjectMemory.cpp b/lldb/source/Core/ValueObjectMemory.cpp
index 960895fa66e..7b3dbf2f307 100644
--- a/lldb/source/Core/ValueObjectMemory.cpp
+++ b/lldb/source/Core/ValueObjectMemory.cpp
@@ -143,7 +143,7 @@ ValueObjectMemory::GetTypeName()
{
if (m_type_sp)
return m_type_sp->GetName();
- return ClangASTType::GetConstTypeName (m_clang_type.GetOpaqueQualType());
+ return ClangASTType::GetConstTypeName (GetClangAST(), m_clang_type.GetOpaqueQualType());
}
uint32_t
diff --git a/lldb/source/Core/ValueObjectRegister.cpp b/lldb/source/Core/ValueObjectRegister.cpp
index 425b461cdcb..befd610f65f 100644
--- a/lldb/source/Core/ValueObjectRegister.cpp
+++ b/lldb/source/Core/ValueObjectRegister.cpp
@@ -326,7 +326,7 @@ ConstString
ValueObjectRegister::GetTypeName()
{
if (m_type_name.IsEmpty())
- m_type_name = ClangASTType::GetConstTypeName (GetClangType());
+ m_type_name = ClangASTType::GetConstTypeName (GetClangAST(), GetClangType());
return m_type_name;
}
diff --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp
index f5c5d0132da..d71ec97ce3c 100644
--- a/lldb/source/Core/ValueObjectVariable.cpp
+++ b/lldb/source/Core/ValueObjectVariable.cpp
@@ -67,8 +67,16 @@ ValueObjectVariable::GetTypeName()
Type * var_type = m_variable_sp->GetType();
if (var_type)
return var_type->GetName();
- ConstString empty_type_name;
- return empty_type_name;
+ return ConstString();
+}
+
+ConstString
+ValueObjectVariable::GetQualifiedTypeName()
+{
+ Type * var_type = m_variable_sp->GetType();
+ if (var_type)
+ return var_type->GetQualifiedName();
+ return ConstString();
}
uint32_t
OpenPOWER on IntegriCloud