diff options
author | Ravitheja Addepally <ravitheja.addepally@intel.com> | 2015-10-08 09:45:41 +0000 |
---|---|---|
committer | Ravitheja Addepally <ravitheja.addepally@intel.com> | 2015-10-08 09:45:41 +0000 |
commit | 4069730c75152f082ae61b0ab1526f1a685e9587 (patch) | |
tree | c86651fe8e4c40e7d8216a32e52beda41c826e0e /lldb/source/Core/Module.cpp | |
parent | f24e7b1f609cdbf6c750c74c10a69acc0d56f009 (diff) | |
download | bcm5719-llvm-4069730c75152f082ae61b0ab1526f1a685e9587.tar.gz bcm5719-llvm-4069730c75152f082ae61b0ab1526f1a685e9587.zip |
Testcase and fix for bug 24074
Summary:
In bug 24074, the type information is not shown
correctly. This commit includes the following -
-> Changes for displaying correct type based on
current lexical scope for the command "image
lookup -t"
-> The corresponding testcase.
-> This patch was reverted due to segfaults in
FreeBSD and Mac, I fixed the problems for both now.
Reviewers: emaste, granata.enrico, jingham, clayborg
Differential Revision: http://reviews.llvm.org/D13290
llvm-svn: 249673
Diffstat (limited to 'lldb/source/Core/Module.cpp')
-rw-r--r-- | lldb/source/Core/Module.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index 8f6a4a10ac2..63bbba9afdb 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -36,6 +36,7 @@ #include "lldb/Target/Target.h" #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h" #include "Plugins/Language/ObjC/ObjCLanguage.h" +#include "lldb/Symbol/TypeMap.h" #include "Plugins/ObjectFile/JIT/ObjectFileJIT.h" @@ -940,7 +941,7 @@ Module::FindTypes_Impl (const SymbolContext& sc, const CompilerDeclContext *parent_decl_ctx, bool append, size_t max_matches, - TypeList& types) + TypeMap& types) { Timer scoped_timer(__PRETTY_FUNCTION__, __PRETTY_FUNCTION__); if (sc.module_sp.get() == NULL || sc.module_sp.get() == this) @@ -960,7 +961,11 @@ Module::FindTypesInNamespace (const SymbolContext& sc, TypeList& type_list) { const bool append = true; - return FindTypes_Impl(sc, type_name, parent_decl_ctx, append, max_matches, type_list); + TypeMap types_map; + size_t num_types = FindTypes_Impl(sc, type_name, parent_decl_ctx, append, max_matches, types_map); + if (num_types > 0) + sc.SortTypeList(types_map, type_list); + return num_types; } lldb::TypeSP @@ -989,6 +994,7 @@ Module::FindTypes (const SymbolContext& sc, std::string type_basename; const bool append = true; TypeClass type_class = eTypeClassAny; + TypeMap typesmap; if (Type::GetTypeScopeAndBasename (type_name_cstr, type_scope, type_basename, type_class)) { // Check if "name" starts with "::" which means the qualified type starts @@ -1002,10 +1008,10 @@ Module::FindTypes (const SymbolContext& sc, 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)) + if (FindTypes_Impl(sc, type_basename_const_str, NULL, append, max_matches, typesmap)) { - types.RemoveMismatchedTypes (type_scope, type_basename, type_class, exact_match); - num_matches = types.GetSize(); + typesmap.RemoveMismatchedTypes (type_scope, type_basename, type_class, exact_match); + num_matches = typesmap.GetSize(); } } else @@ -1015,18 +1021,18 @@ Module::FindTypes (const SymbolContext& sc, { // The "type_name_cstr" will have been modified if we have a valid type class // prefix (like "struct", "class", "union", "typedef" etc). - FindTypes_Impl(sc, ConstString(type_name_cstr), NULL, append, max_matches, types); - types.RemoveMismatchedTypes (type_class); - num_matches = types.GetSize(); + FindTypes_Impl(sc, ConstString(type_name_cstr), NULL, append, max_matches, typesmap); + typesmap.RemoveMismatchedTypes (type_class); + num_matches = typesmap.GetSize(); } else { - num_matches = FindTypes_Impl(sc, name, NULL, append, max_matches, types); + num_matches = FindTypes_Impl(sc, name, NULL, append, max_matches, typesmap); } } - + if (num_matches > 0) + sc.SortTypeList(typesmap, types); return num_matches; - } SymbolVendor* |